1+ name : Post Merge Actions
2+ on :
3+ pull_request :
4+ types : [closed]
5+
6+ jobs :
7+ check-ci-and-notify :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - uses : actions/github-script@v8
11+ with :
12+ script : |
13+ const GRAALVMBOT_LOGIN = "graalvmbot";
14+ const pr = context.payload.pull_request;
15+ if (!pr || !pr.number || pr.state !== "closed") return;
16+
17+ const author = pr.user;
18+ const assignees = pr.assignees || [];
19+ if (!author || author.login !== GRAALVMBOT_LOGIN) return;
20+ if (assignees.length !== 1) return;
21+
22+ const sha = pr.head.sha;
23+
24+ const runsResp = await github.rest.actions.listWorkflowRunsForRepo({
25+ owner: context.repo.owner,
26+ repo: context.repo.repo,
27+ head_sha: sha,
28+ event: "pull_request",
29+ per_page: 10
30+ });
31+
32+ const failedRun = runsResp.data.workflow_runs.find(run =>
33+ run.head_sha === sha &&
34+ run.status === "completed" &&
35+ run.conclusion !== "success"
36+ );
37+
38+ if (!failedRun) {
39+ console.log("No failed CI workflow found for the PR.");
40+ return;
41+ }
42+
43+ await github.rest.issues.createComment({
44+ issue_number: pr.number,
45+ owner: context.repo.owner,
46+ repo: context.repo.repo,
47+ body: `@${assignees[0].login} - One or more CI jobs failed - [View details](${failedRun.html_url})`
48+ });
49+ console.log("CI failed, assignee notified.")
0 commit comments