@@ -9,7 +9,66 @@ concurrency:
99 group : ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
1010 cancel-in-progress : true
1111
12+ permissions :
13+ contents : read
14+ pull-requests : write
15+ checks : write
16+
1217jobs :
18+ Shellcheck :
19+ runs-on : ubuntu-latest
20+ if : github.event.workflow_run && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
21+ steps :
22+ - name : echo event
23+ run : cat $GITHUB_EVENT_PATH
24+ - name : Download PR number artifact
25+ uses : dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5
26+ with :
27+ workflow : Build
28+ run_id : ${{ github.event.workflow_run.id }}
29+ name : PR_NUMBER
30+ - name : Read PR_NUMBER.txt
31+ id : pr_number
32+ uses : juliangruber/read-file-action@b549046febe0fe86f8cb4f93c24e284433f9ab58
33+ with :
34+ path : ./PR_NUMBER.txt
35+ - name : Request GitHub API for PR data
36+ uses : octokit/request-action@05a2312de9f8207044c4c9e41fe19703986acc13
37+ id : get_pr_data
38+ with :
39+ route : GET /repos/{full_name}/pulls/{number}
40+ number : ${{ steps.pr_number.outputs.content }}
41+ full_name : ${{ github.event.repository.full_name }}
42+ env :
43+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
44+ - uses : actions/checkout@v6
45+ with :
46+ repository : ${{ github.event.workflow_run.head_repository.full_name }}
47+ ref : ${{ github.event.workflow_run.head_branch }}
48+ fetch-depth : 0
49+ - name : Checkout base branch
50+ env :
51+ HEAD_BRANCH : ${{ github.event.workflow_run.head_branch }}
52+ run : |
53+ git remote add upstream ${{ github.event.repository.clone_url }}
54+ git fetch upstream
55+ git checkout -B ${{ fromJson(steps.get_pr_data.outputs.data).base.ref }} upstream/${{ fromJson(steps.get_pr_data.outputs.data).base.ref }}
56+ git checkout "${HEAD_BRANCH}"
57+ git clean -ffdx && git reset --hard HEAD
58+ - name : shellcheck
59+ uses : reviewdog/action-shellcheck@4c07458293ac342d477251099501a718ae5ef86e
60+ with :
61+ github_token : ${{ secrets.GITHUB_TOKEN }}
62+ reporter : github-pr-review # Change reporter.
63+ path : " ." # Optional.
64+ pattern : " *.sh" # Optional.
65+ level : " error"
66+ fail_level : " error"
67+ exclude : |
68+ "./.git/*"
69+ "**/target"
70+ check_all_files_with_shebangs : " false" # Optional.
71+ shellcheck_flags : " --external-sources --severity=error"
1372 Sonar :
1473 runs-on : ubuntu-latest
1574 if : github.event.workflow_run && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
0 commit comments