update action permissions #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test SDC Tasks | |
| on: | |
| push: | |
| paths: | |
| - 'individual-shell-tools/**.sh' | |
| - 'shell-pipelines/**.sh' | |
| - 'jq/*.sh' | |
| pull_request_target: | |
| types: | |
| - labeled | |
| - unlabeled | |
| - opened | |
| - edited | |
| - reopened | |
| jobs: | |
| test_sdc_tasks: | |
| name: Test SDC Tasks | |
| runs-on: ubuntu-slim | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: checkout pushed PR | |
| uses: actions/checkout@v5 | |
| # with: | |
| # fetch-depth: 2 | |
| # - name: checkout expected output | |
| # uses: actions/checkout@v5 | |
| # with: | |
| # ref: origin/expected-solutions | |
| # path: expect | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v47.0.5 | |
| - name: List all changed files | |
| env: | |
| ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
| run: | | |
| for file in ${ALL_CHANGED_FILES}; do | |
| echo "$file was changed" | |
| done | |
| - name: test individual shell tools | |
| if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') | |
| run: ./test-sdc.sh individual-shell-tools | |
| shell: bash | |
| - name: test jq | |
| if: contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') | |
| run: ./test-sdc.sh jq | |
| shell: bash | |
| - name: test shell-pipelines | |
| if: contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') | |
| run: ./test-sdc.sh shell-pipelines | |
| shell: bash | |
| - name: read test output | |
| id: read-test-output | |
| run: | | |
| echo 'testoutput<<EOF' >> $GITHUB_OUTPUT | |
| cat testoutput.txt >> $GITHUB_OUTPUT | |
| echo EOF >> $GITHUB_OUTPUT | |
| - uses: actions/github-script@v7 | |
| id: get_pr_data | |
| with: | |
| script: | | |
| return ( | |
| await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
| commit_sha: context.sha, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }) | |
| ).data[0]; | |
| - name: make output comment | |
| uses: peter-evans/create-or-update-comment@v5.0.0 | |
| with: | |
| issue-number: ${{ fromJson(steps.get_pr_data.outputs.result).number }} # ${{ github.event.number }} | |
| body: ${{ steps.read-test-output.outputs.testoutput }} | |