@@ -20,27 +20,38 @@ jobs:
2020 github.event.workflow_run.conclusion == 'success'
2121
2222 steps :
23- - name : ' Download artifact'
24- uses :
actions/[email protected] # v8.0.0 23+ - name : Download artifacts
24+ id : download-artifacts
25+ uses : dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11
26+ with :
27+ workflow : doc-build.yml
28+ run_id : ${{ github.event.workflow_run.id }}
29+ if_no_artifact_found : ignore
30+
31+ - name : Load PR number
32+ if : steps.download-artifacts.outputs.found_artifact == 'true'
33+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
2534 with :
2635 script : |
27- var artifacts = await github.actions.listWorkflowRunArtifacts({
28- owner: context.repo.owner,
29- repo: context.repo.repo,
30- run_id: ${{github.event.workflow_run.id }},
31- });
32- var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
33- return artifact.name == "pr"
34- })[0];
35- var download = await github.actions.downloadArtifact({
36- owner: context.repo.owner,
37- repo: context.repo.repo,
38- artifact_id: matchArtifact.id,
39- archive_format: 'zip',
40- });
41- var fs = require('fs');
42- fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
43- - run : unzip pr.zip
36+ let fs = require("fs");
37+ let pr_number = Number(fs.readFileSync("./NR"));
38+ core.exportVariable("PR_NUM", pr_number);
39+
40+ - name : Check PR number
41+ if : steps.download-artifacts.outputs.found_artifact == 'true'
42+ id : check-pr
43+ uses : carpentries/actions/check-valid-pr@2e20fd5ee53b691e27455ce7ca3b16ea885140e8 # v0.15.0
44+ with :
45+ pr : ${{ env.PR_NUM }}
46+ sha : ${{ github.event.workflow_run.head_sha }}
47+
48+ - name : Validate PR number
49+ if : |
50+ steps.download-artifacts.outputs.found_artifact == 'true' &&
51+ steps.check-pr.outputs.VALID != 'true'
52+ run : |
53+ echo "ABORT: PR number validation failed!"
54+ exit 1
4455
4556 - name : Check out source code
4657 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
0 commit comments