Skip to content

Commit 6a6cb6e

Browse files
committed
[GR-72982] Comment Github PR on CI fail
PullRequest: graalpython/4236
2 parents e372222 + 1056049 commit 6a6cb6e

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed

.github/scripts/extract_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"ECLIPSE": "https://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/R-4.26-202211231800/eclipse-SDK-4.26-linux-gtk-x86_64.tar.gz"
7676
}
7777

78-
# Gitlab Runners OSS
78+
# Github Runners OSS
7979
OSS = {
8080
"macos-latest": ["darwin", "aarch64"],
8181
"ubuntu-latest": ["linux", "amd64"],
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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.")

.github/workflows/ci-unittests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
artifacts_retention_days: 0
1515

1616
run-tests:
17-
if: github.event.pull_request.draft == false && success()
17+
if: success()
1818
needs: build-standalone-artifacts
1919
uses: ./.github/workflows/ci-matrix-gen.yml
2020
with:
21-
jobs_to_run: ^(?!python-svm-build|style).*-gate.*$
21+
jobs_to_run: ^(?!python-svm-build|style).*-gate.*$

0 commit comments

Comments
 (0)