Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

thread-transfer-report.yml

77 lines3.2 KB

1name: Thread Transfer Report
2​
3on:
4 workflow_run:
5 workflows: [CI]
6 types: [completed]
7​
8permissions:
9 contents: read
10​
11jobs:
12 publish:
13 name: Publish PR comment
14 if: github.event.workflow_run.event == 'pull_request'
15 runs-on: ubuntu-24.04
16 permissions:
17 actions: read
18 contents: read
19 pull-requests: write
20 concurrency:
21 group: thread-transfer-report-${{ github.event.workflow_run.pull_requests[0].number || github.event.workflow_run.id }}
22 cancel-in-progress: true
23 steps:
24 # workflow_run has a write-capable token even for fork PRs. Only load the
25 # publisher from the trusted default branch and never execute PR code.
26 - name: Checkout trusted publisher
27 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
28 with:
29 ref: ${{ github.event.repository.default_branch }}
30 sparse-checkout: .github/scripts
31​
32 - name: Test trusted publisher
33 run: node --test .github/scripts/thread-transfer-report.test.cjs
34​
35 - id: resolve
36 name: Resolve PR and baseline artifacts
37 uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
38 with:
39 script: |
40 const reporter = require("./.github/scripts/thread-transfer-report.cjs");
41 await reporter.resolve({ github, context, core });
42​
43 - name: Download PR result
44 if: steps.resolve.outputs.publish == 'true' && steps.resolve.outputs.pr_artifact == 'true'
45 uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
46 with:
47 name: thread-transfer-results
48 path: ${{ runner.temp }}/thread-transfer/pr
49 github-token: ${{ secrets.GITHUB_TOKEN }}
50 run-id: ${{ steps.resolve.outputs.pr_run_id }}
51​
52 - name: Download main baseline
53 if: steps.resolve.outputs.publish == 'true' && steps.resolve.outputs.baseline_artifact == 'true'
54 uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
55 with:
56 name: thread-transfer-results
57 path: ${{ runner.temp }}/thread-transfer/main
58 github-token: ${{ secrets.GITHUB_TOKEN }}
59 run-id: ${{ steps.resolve.outputs.baseline_run_id }}
60​
61 - name: Update thread transfer comment
62 if: steps.resolve.outputs.publish == 'true'
63 uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
64 env:
65 PR_NUMBER: ${{ steps.resolve.outputs.pull_number }}
66 PR_SHA: ${{ steps.resolve.outputs.pr_sha }}
67 PR_CONCLUSION: ${{ steps.resolve.outputs.pr_conclusion }}
68 PR_RUN_ID: ${{ steps.resolve.outputs.pr_run_id }}
69 PR_RESULT_DIR: ${{ runner.temp }}/thread-transfer/pr
70 BASELINE_SHA: ${{ steps.resolve.outputs.baseline_sha }}
71 BASELINE_MATCHES_BASE: ${{ steps.resolve.outputs.baseline_matches_base }}
72 BASELINE_RUN_ID: ${{ steps.resolve.outputs.baseline_run_id }}
73 BASELINE_RESULT_DIR: ${{ runner.temp }}/thread-transfer/main
74 with:
75 script: |
76 const reporter = require("./.github/scripts/thread-transfer-report.cjs");
77 await reporter.publish({ github, context, core });