Skip to content

Commit 2b82af0

Browse files
committed
openkal-compat: the job that proposes a measurement is the only one that may write
1 parent a62e055 commit 2b82af0

1 file changed

Lines changed: 33 additions & 18 deletions

File tree

‎.github/workflows/openkal-compat.yml‎

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ on:
2525
- ".github/workflows/openkal-compat.yml"
2626

2727
permissions:
28-
contents: write
29-
pull-requests: write
28+
contents: read
3029

3130
env:
3231
MCPP_VERSION: "2026.9.17.2"
@@ -37,6 +36,8 @@ jobs:
3736
name: measure (linux, windows through wine)
3837
runs-on: ubuntu-24.04
3938
timeout-minutes: 240
39+
outputs:
40+
members: ${{ steps.select.outputs.members }}
4041
steps:
4142
- uses: actions/checkout@v4
4243
with:
@@ -117,11 +118,40 @@ jobs:
117118
python3 tests/openkal/compat.py check \
118119
--results openkal-compat.json --baseline .xpkgindex/openkal-compat.json
119120
121+
- name: Summary
122+
if: always() && steps.select.outputs.members != ''
123+
shell: bash
124+
run: |
125+
[ -f openkal-compat.json ] || exit 0
126+
python3 - <<'PY' >> "$GITHUB_STEP_SUMMARY"
127+
import json
128+
r = json.load(open("openkal-compat.json"))
129+
print("| member | target | result | first diagnostic |")
130+
print("| --- | --- | --- | --- |")
131+
for m, e in sorted(r["members"].items()):
132+
for t, rec in sorted(e["targets"].items()):
133+
d = rec.get("diagnostic", "").replace("|", "\\|")
134+
print(f"| {m} | {t} | {rec['status']} | {d} |")
135+
PY
136+
137+
# Only this job may write, and it does not run for a pull request.
138+
propose:
139+
name: propose the measurement
140+
needs: measure
141+
if: needs.measure.outputs.members != '' && github.event_name != 'pull_request' && github.event.inputs.members == ''
142+
runs-on: ubuntu-24.04
143+
permissions:
144+
contents: write
145+
pull-requests: write
146+
steps:
147+
- uses: actions/checkout@v4
148+
- uses: actions/download-artifact@v4
149+
with:
150+
name: openkal-compat
120151
# A scheduled or requested measurement that differs from the published file
121152
# is proposed as a pull request rather than committed, so that a label
122153
# changes only through review.
123154
- name: Propose the new measurement
124-
if: steps.select.outputs.members != '' && github.event_name != 'pull_request' && github.event.inputs.members == ''
125155
shell: bash
126156
env:
127157
GH_TOKEN: ${{ github.token }}
@@ -148,18 +178,3 @@ jobs:
148178
--body "Measured by .github/workflows/openkal-compat.yml run ${{ github.run_id }}. See the run summary for every member and target." \
149179
|| echo "a pull request for $branch already exists"
150180
151-
- name: Summary
152-
if: always() && steps.select.outputs.members != ''
153-
shell: bash
154-
run: |
155-
[ -f openkal-compat.json ] || exit 0
156-
python3 - <<'PY' >> "$GITHUB_STEP_SUMMARY"
157-
import json
158-
r = json.load(open("openkal-compat.json"))
159-
print("| member | target | result | first diagnostic |")
160-
print("| --- | --- | --- | --- |")
161-
for m, e in sorted(r["members"].items()):
162-
for t, rec in sorted(e["targets"].items()):
163-
d = rec.get("diagnostic", "").replace("|", "\\|")
164-
print(f"| {m} | {t} | {rec['status']} | {d} |")
165-
PY

0 commit comments

Comments
 (0)