Skip to content

Commit e3755ac

Browse files
petschkiclaude
andcommitted
maint: allow selecting the buildout.coredev branch for robot tests
/run-coredev-robottests keeps testing against the default branch; /run-coredev-6.1-robottests (or 6.2, 6.3, ...) checks out that buildout.coredev branch instead. Unknown branches get an error comment. Also run update-check with always() so the check run no longer stays in_progress when the tests fail. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 33b91d0 commit e3755ac

1 file changed

Lines changed: 50 additions & 8 deletions

File tree

.github/workflows/coredev-robot-tests.yml

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Robot Tests (Coredev)
22

3+
# Trigger commands (PR comments):
4+
# /run-coredev-robottests -> tests against the buildout.coredev default branch
5+
# /run-coredev-6.3-robottests -> tests against an explicit coredev branch (6.1, 6.2, 6.3, ...)
36
on:
47
issue_comment:
58
types: [created]
@@ -8,28 +11,65 @@ jobs:
811
create-check:
912
if: >
1013
github.event.issue.pull_request &&
11-
contains(github.event.comment.body, '/run-coredev-robottests')
14+
contains(github.event.comment.body, '/run-coredev') &&
15+
contains(github.event.comment.body, '-robottests')
1216
runs-on: ubuntu-latest
1317
outputs:
18+
matched: ${{ steps.create.outputs.matched }}
19+
coredev_branch: ${{ steps.create.outputs.coredev_branch }}
1420
check_run_id: ${{ steps.create.outputs.check_run_id }}
1521
sha: ${{ steps.create.outputs.sha }}
1622
steps:
17-
- name: Get PR SHA and create Check Run
23+
- name: Parse command, get PR SHA and create Check Run
1824
id: create
1925
uses: actions/github-script@v9
2026
with:
2127
script: |
28+
const body = context.payload.comment.body;
29+
// "/run-coredev-robottests" or "/run-coredev-<major.minor>-robottests"
30+
const match = body.match(/\/run-coredev(?:-([0-9]+\.[0-9]+))?-robottests/);
31+
if (!match) {
32+
core.setOutput('matched', 'false');
33+
core.notice(`Comment matched the coarse filter but not the command syntax.`);
34+
return;
35+
}
36+
const coredevBranch = match[1] || '';
37+
core.setOutput('matched', 'true');
38+
core.setOutput('coredev_branch', coredevBranch);
39+
40+
if (coredevBranch) {
41+
try {
42+
await github.rest.repos.getBranch({
43+
owner: 'plone',
44+
repo: 'buildout.coredev',
45+
branch: coredevBranch,
46+
});
47+
} catch (e) {
48+
await github.rest.issues.createComment({
49+
owner: context.repo.owner,
50+
repo: context.repo.repo,
51+
issue_number: context.issue.number,
52+
body: `:x: Branch \`${coredevBranch}\` does not exist on plone/buildout.coredev.`,
53+
});
54+
core.setFailed(`Unknown coredev branch: ${coredevBranch}`);
55+
return;
56+
}
57+
}
58+
2259
const pr = await github.rest.pulls.get({
2360
owner: context.repo.owner,
2461
repo: context.repo.repo,
2562
pull_number: context.issue.number,
2663
});
2764
const sha = pr.data.head.sha;
2865
66+
const checkName = coredevBranch
67+
? `Coredev robot tests (${coredevBranch})`
68+
: 'Coredev robot tests';
2969
const check = await github.rest.checks.create({
3070
owner: context.repo.owner,
3171
repo: context.repo.repo,
32-
name: 'Coredev robot tests',
72+
name: checkName,
3373
head_sha: sha,
3474
status: 'in_progress',
3575
details_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
@@ -40,8 +80,9 @@ jobs:
4080
4181
robot-tests:
4282
needs: create-check
83+
if: needs.create-check.outputs.matched == 'true'
4384

44-
name: Coredev robot tests
85+
name: Coredev robot tests ${{ needs.create-check.outputs.coredev_branch }}
4586
runs-on: ubuntu-latest
4687
env:
4788
PYTHONWARNINGS: ignore
@@ -61,8 +102,8 @@ jobs:
61102

62103
- name: Info
63104
run: |
64-
echo "Workflow triggered with comment '/run-coredev-robottests' "
65-
echo "on PR #${{ github.event.issue.number }}"
105+
echo "Workflow triggered by comment on PR #${{ github.event.issue.number }}"
106+
echo "buildout.coredev branch: '${{ needs.create-check.outputs.coredev_branch }}' (empty = default branch)"
66107
67108
- name: locale
68109
# needed for CMFPlone testUnicodeSplitter test on Ubuntu
@@ -80,6 +121,7 @@ jobs:
80121
uses: actions/checkout@v4
81122
with:
82123
repository: plone/buildout.coredev
124+
ref: ${{ needs.create-check.outputs.coredev_branch }}
83125
path: tests
84126

85127
# ── 2. Node.js setup ──────────────────────────────────────────────────────
@@ -128,15 +170,15 @@ jobs:
128170
if: always()
129171
uses: actions/upload-artifact@v4
130172
with:
131-
name: robot-results
173+
name: robot-results-${{ needs.create-check.outputs.coredev_branch || 'default' }}
132174
path: |
133175
tests/test_*
134176
tests/robot_*
135177
if-no-files-found: ignore
136178

137179
update-check:
138180
needs: [create-check, robot-tests]
139-
if: needs.create-check.outputs.check_run_id
181+
if: always() && needs.create-check.outputs.check_run_id
140182
runs-on: ubuntu-latest
141183
steps:
142184
- name: Update Check Run

0 commit comments

Comments
 (0)