Skip to content

Commit c49ae09

Browse files
authored
fix(ci): grant actions:read and contents:read to E2E label helper (ai-openshell#995)
1 parent 5975805 commit c49ae09

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎.github/workflows/e2e-label-help.yml‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
runs-on: ubuntu-latest
2424
permissions:
2525
pull-requests: write
26+
actions: read
27+
contents: read
2628
steps:
2729
- name: Post comment
2830
env:
@@ -54,11 +56,12 @@ jobs:
5456
run_id=$(gh api "repos/$GH_REPO/actions/workflows/$workflow_file/runs?head_sha=$PR_HEAD_SHA&event=push" \
5557
--jq '.workflow_runs | sort_by(.created_at) | reverse | .[0].id // empty')
5658
if [ -n "$run_id" ]; then
57-
run_link="[the existing run](https://github.com/$GH_REPO/actions/runs/$run_id)"
59+
instructions="Open [the existing run](https://github.com/$GH_REPO/actions/runs/$run_id) and click **Re-run all jobs** to execute with the label set."
5860
else
59-
run_link="[$workflow_name](https://github.com/$GH_REPO/actions/workflows/$workflow_file)"
61+
workflow_link="[$workflow_name](https://github.com/$GH_REPO/actions/workflows/$workflow_file)"
62+
instructions="Open $workflow_link, find the run for commit \`$short_pr\`, and click **Re-run all jobs** to execute with the label set."
6063
fi
61-
body="Label \`$LABEL_NAME\` applied for \`$short_pr\`. Open $run_link and click **Re-run all jobs** to execute with the label set. The \`E2E Gate\` check on this PR will flip green automatically once the run finishes."
64+
body="Label \`$LABEL_NAME\` applied for \`$short_pr\`. $instructions The \`E2E Gate\` check on this PR will flip green automatically once the run finishes."
6265
fi
6366
6467
gh pr comment "$PR_NUMBER" --body "$body"

‎CI.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Prerequisites:
6363
Flow:
6464

6565
1. Open the PR. copy-pr-bot mirrors it to `pull-request/<N>` automatically.
66-
2. The first push of `pull-request/<N>` runs `Branch E2E Checks`, but it skips the build/E2E jobs because no label is set yet. The PR's `E2E Gate` check stays neutral (no label, no requirement).
66+
2. The first push of `pull-request/<N>` runs `Branch E2E Checks`, but it skips the build/E2E jobs because no label is set yet. The PR's `E2E Gate` check passes as a no-op (no label, no requirement).
6767
3. A maintainer applies `test:e2e` and/or `test:e2e-gpu`. `E2E Label Help` posts a comment with a link to the existing `Branch E2E Checks` run.
6868
4. The maintainer opens that link and clicks **Re-run all jobs**. This time `pr_metadata` sees the label and the build/E2E jobs run.
6969
5. When the run finishes, the `E2E Gate` check on the PR flips to green automatically.

‎architecture/ci-e2e.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Every workflow declares `permissions: {}` at the top. Per-job grants are the min
150150
| `e2e-gate.yml` | `e2e`, `gpu` (`workflow_call`) | inherits via the called workflow |
151151
| | `rerun-on-completion` | `actions: write` |
152152
| `e2e-gate-check.yml` | `check` | `contents: read`, `pull-requests: read`, `actions: read` |
153-
| `e2e-label-help.yml` | `hint` | `pull-requests: write` |
153+
| `e2e-label-help.yml` | `hint` | `pull-requests: write`, `actions: read`, `contents: read` |
154154

155155
The reusable worker workflows (`e2e-test.yml`, `e2e-gpu-test.yaml`, `docker-build.yml`) declare their own internal permissions; the calling job grants are an upper bound for them.
156156

0 commit comments

Comments
 (0)