@@ -5,7 +5,9 @@ name: Review Checks Reporter
55# SECURITY: This workflow runs with base-repository privileges after the
66# evaluator completes. It must not check out or execute PR code, and it must not
77# consume artifacts from the untrusted workflow. It only reads trusted workflow
8- # metadata and publishes a narrow commit-status update.
8+ # metadata and returns a normal workflow result.
9+
10+ name : PR approval check
911
1012on :
1113 workflow_run :
1618
1719permissions :
1820 contents : read
19- statuses : write
2021
2122jobs :
2223 publish-approval-status :
23- name : Publish approval status
24+ name : PR approval check
2425 runs-on : ubuntu-latest
26+ if : github.event.workflow_run.event != 'merge_group'
2527
2628 # SECURITY: Do not add a checkout step to this job. See comment at the top of this file.
2729 steps :
28- - name : PR approval check
30+ - name : Evaluate approval status
2931 uses : actions/github-script@v7
3032 with :
3133 github-token : ${{ secrets.GITHUB_TOKEN }}
3234 script : |
33- if (context.payload.workflow_run.event === "merge_group") {
34- core.info("Merge group runs publish approval status directly from the evaluator.");
35- return;
36- }
37-
38- const conclusion = context.payload.workflow_run.conclusion;
39-
40- let state;
41- let description;
35+ const workflowRun = context.payload.workflow_run;
36+ const conclusion = workflowRun.conclusion;
4237
4338 if (conclusion === "success") {
44- state = "success";
45- description = "Approval requirements satisfied";
46- } else if (conclusion === "cancelled" || conclusion === "timed_out") {
47- state = "error";
48- description = `Approval evaluation ${conclusion}`;
49- } else {
50- state = "failure";
51- description = "Approval requirements not satisfied";
39+ core.info("Approval requirements satisfied.");
40+ return;
5241 }
5342
54- core.info(
55- `Publishing ${state} for ${context.payload.workflow_run.head_sha} from evaluator conclusion ${conclusion}`
56- );
43+ if (conclusion === "cancelled" || conclusion === "timed_out") {
44+ core.setFailed(`Approval evaluation ${conclusion}`);
45+ return;
46+ }
5747
58- await github.rest.repos.createCommitStatus({
59- owner: context.repo.owner,
60- repo: context.repo.repo,
61- sha: context.payload.workflow_run.head_sha,
62- state,
63- context: contextName,
64- description,
65- target_url: context.payload.workflow_run.html_url,
66- });
48+ core.setFailed("Approval requirements not satisfied.");
0 commit comments