File tree Expand file tree Collapse file tree 3 files changed +43
-8
lines changed Expand file tree Collapse file tree 3 files changed +43
-8
lines changed Original file line number Diff line number Diff line change 11name : Validate filenames
22
33on :
4- pull_request :
4+ pull_request_target :
55 paths :
66 - " ct/*.sh"
77 - " install/*.sh"
88 - " json/*.json"
9- - " .github/workflows/validate-filenames.yml"
109
1110jobs :
1211 check-files :
1312 name : Check changed files
1413 runs-on : ubuntu-latest
14+ permissions :
15+ pull-requests : write
1516
1617 steps :
18+ - name : Get pull request information
19+ uses : actions/github-script@v7
20+ id : pr
21+ with :
22+ script : |
23+ const { data: pullRequest } = await github.rest.pulls.get({
24+ ...context.repo,
25+ pull_number: context.payload.pull_request.number,
26+ });
27+ return pullRequest;
28+
1729 - name : Checkout code
1830 uses : actions/checkout@v4
1931 with :
2032 fetch-depth : 0 # Ensure the full history is fetched for accurate diffing
33+ ref : ${{ fromJSON(steps.pr.outputs.result).merge_commit_sha }}
2134
2235 - name : Get changed files
2336 id : changed-files
Original file line number Diff line number Diff line change 44 push :
55 branches :
66 - main
7- pull_request :
7+ pull_request_target :
88 paths :
99 - " **/*.sh"
1010 - " **/*.func"
11- - " .github/workflows/validate-formatting.yaml"
1211
1312jobs :
1413 shfmt :
@@ -18,10 +17,22 @@ jobs:
1817 pull-requests : write
1918
2019 steps :
20+ - name : Get pull request information
21+ uses : actions/github-script@v7
22+ id : pr
23+ with :
24+ script : |
25+ const { data: pullRequest } = await github.rest.pulls.get({
26+ ...context.repo,
27+ pull_number: context.payload.pull_request.number,
28+ });
29+ return pullRequest;
30+
2131 - name : Checkout code
2232 uses : actions/checkout@v4
2333 with :
24- fetch-depth : 0
34+ fetch-depth : 0 # Ensure the full history is fetched for accurate diffing
35+ ref : ${{ fromJSON(steps.pr.outputs.result).merge_commit_sha }}
2536
2637 - name : Get changed files
2738 id : changed-files
Original file line number Diff line number Diff line change 33 push :
44 branches :
55 - main
6- pull_request :
6+ pull_request_target :
77 paths :
88 - " ct/*.sh"
99 - " install/*.sh"
10- - " .github/workflows/validate-scripts.yml"
1110
1211jobs :
1312 check-scripts :
@@ -17,10 +16,22 @@ jobs:
1716 pull-requests : write
1817
1918 steps :
19+ - name : Get pull request information
20+ uses : actions/github-script@v7
21+ id : pr
22+ with :
23+ script : |
24+ const { data: pullRequest } = await github.rest.pulls.get({
25+ ...context.repo,
26+ pull_number: context.payload.pull_request.number,
27+ });
28+ return pullRequest;
29+
2030 - name : Checkout code
2131 uses : actions/checkout@v4
2232 with :
23- fetch-depth : ${{ github.event_name == 'pull_request' && 2 || 0 }}
33+ fetch-depth : 0 # Ensure the full history is fetched for accurate diffing
34+ ref : ${{fromJSON(steps.pr.outputs.result).merge_commit_sha}}
2435
2536 - name : Set execute permission for .sh files
2637 run : |
You can’t perform that action at this time.
0 commit comments