@@ -6,19 +6,13 @@ name: PR comment trigger
6
6
types : [created]
7
7
8
8
jobs :
9
- debug :
10
- name : Debug
11
- runs-on : ubuntu-latest
12
- steps :
13
- - uses : hmarr/debug-action@v3
14
9
check-comment :
15
10
name : PR Comment
16
11
runs-on : ubuntu-latest
17
12
permissions :
18
13
contents : read
19
- checks : write
20
14
outputs :
21
- sha : ${{ steps.get-pr-info.outputs.sha }}
15
+ sha : ${{ fromJson( steps.get-pr-info.outputs.result) .sha }}
22
16
if : |
23
17
github.event.issue.pull_request &&
24
18
github.event.comment.body == '/run-tests' &&
39
33
if (!pr) {
40
34
throw new Error('Pull request not found');
41
35
}
36
+ console.log(`Pull request head SHA: ${pr.head.sha}`);
42
37
return {
43
38
sha: pr.head.sha
44
39
};
@@ -55,23 +50,38 @@ jobs:
55
50
pr-checkpoint-status :
56
51
name : " PR Checkpoint Status"
57
52
runs-on : ubuntu-latest
53
+ permissions :
54
+ actions : read
55
+ statuses : write
56
+ checks : write
58
57
needs : [check-comment, build-test-lint]
59
58
steps :
60
59
- name : Set status check
61
60
uses : actions/github-script@v7
61
+ env :
62
+ SHA : ${{ needs.check-comment.outputs.sha }}
62
63
with :
63
64
github-token : ${{ secrets.GITHUB_TOKEN }}
64
65
script : |
65
66
const { owner, repo } = context.repo;
66
- const sha = ${{ needs.check-comment.outputs.sha }}
67
-
68
- // Set the status check
69
- await github.rest.repos.createCommitStatus({
67
+ const sha = process.env.SHA;
68
+ console.log(`Setting status check for SHA: ${sha}`);
69
+ await github.rest.checks.create({
70
+ owner,
71
+ repo,
72
+ name: 'PR Checkpoint Status',
73
+ head_sha: sha,
74
+ status: 'completed',
75
+ conclusion: 'success',
76
+ output: {
77
+ title: 'Build & Test Completed',
78
+ summary: 'All checks passed successfully.',
79
+ text: 'All checks passed successfully.'
80
+ }
81
+ });
82
+ const { data: checkRuns } = await github.rest.checks.listForRef({
70
83
owner,
71
84
repo,
72
- sha,
73
- state: 'success', // 'error', 'failure', 'pending'
74
- target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}',
75
- description: 'Build and test completed successfully',
76
- context: 'PR Checkpoint Status' // This must match the name in branch protection
85
+ ref: sha
77
86
});
87
+ console.log(`Check runs: ${JSON.stringify(checkRuns)}`);
0 commit comments