File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -44,11 +44,16 @@ jobs:
4444 uses : actions/github-script@v7
4545 with :
4646 script : |
47+ const headSha = context.payload.workflow_run?.head_sha;
48+ if (!headSha || !/^[a-f0-9]{40}$/i.test(headSha)) {
49+ core.setFailed('Invalid head SHA');
50+ return;
51+ }
4752 const { data: runs } = await github.rest.actions.listWorkflowRuns({
4853 owner: context.repo.owner,
4954 repo: context.repo.repo,
5055 workflow_id: 'lint.yaml',
51- head_sha: '${{ github.event.workflow_run.head_sha }}' ,
56+ head_sha: headSha ,
5257 per_page: 1
5358 });
5459 if (runs.workflow_runs.length > 0 && runs.workflow_runs[0].conclusion !== 'success') {
Original file line number Diff line number Diff line change @@ -30,11 +30,16 @@ jobs:
3030 uses : actions/github-script@v7
3131 with :
3232 script : |
33+ const headSha = context.payload.workflow_run?.head_sha;
34+ if (!headSha || !/^[a-f0-9]{40}$/i.test(headSha)) {
35+ core.setFailed('Invalid head SHA');
36+ return;
37+ }
3338 const { data: runs } = await github.rest.actions.listWorkflowRuns({
3439 owner: context.repo.owner,
3540 repo: context.repo.repo,
3641 workflow_id: 'lint.yaml',
37- head_sha: '${{ github.event.workflow_run.head_sha }}' ,
42+ head_sha: headSha ,
3843 per_page: 1
3944 });
4045 if (runs.workflow_runs.length > 0 && runs.workflow_runs[0].conclusion !== 'success') {
Original file line number Diff line number Diff line change @@ -24,11 +24,16 @@ jobs:
2424 uses : actions/github-script@v7
2525 with :
2626 script : |
27+ const headSha = context.payload.workflow_run?.head_sha;
28+ if (!headSha || !/^[a-f0-9]{40}$/i.test(headSha)) {
29+ core.setFailed('Invalid head SHA');
30+ return;
31+ }
2732 const { data: runs } = await github.rest.actions.listWorkflowRuns({
2833 owner: context.repo.owner,
2934 repo: context.repo.repo,
3035 workflow_id: 'lint.yaml',
31- head_sha: '${{ github.event.workflow_run.head_sha }}' ,
36+ head_sha: headSha ,
3237 per_page: 1
3338 });
3439 if (runs.workflow_runs.length > 0 && runs.workflow_runs[0].conclusion !== 'success') {
You can’t perform that action at this time.
0 commit comments