Skip to content

Commit 7d07d08

Browse files
committed
Drop trusted-script snapshot; run scripts directly from main checkout
1 parent ee82d03 commit 7d07d08

2 files changed

Lines changed: 8 additions & 23 deletions

File tree

.github/scripts/pr-triage/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ Invariants (see the comments at the top of each entry-point file):
2323
from a malicious PR build script.
2424
* `copilot-worker` must never invoke `./gradlew` or any other PR-controlled
2525
build tooling. PR build files would otherwise see `COPILOT_GITHUB_TOKEN`.
26-
* `poster` runs only trusted code snapshotted from the default branch
27-
(`$RUNNER_TEMP/pr-triage-trusted`). It never executes anything from the
28-
PR working tree, so `gh pr checkout` is safe even though the otelbot
29-
token is in scope.
26+
* `poster` runs only trusted code from the default-branch checkout in
27+
`$GITHUB_WORKSPACE`. It never executes anything from the PR working
28+
tree, so it is safe to handle the otelbot token even though it
29+
applies a bundle produced by a worker job.
3030
* `/fix` hands off between the two workers via a CI bundle written to
3131
`out_dir/ci-bundle/` plus a `needs-copilot.txt` marker. The
3232
copilot-worker downloads that artifact and runs Copilot on the bundle;

.github/workflows/pr-triage-comments.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ jobs:
5858
with:
5959
fetch-depth: 0
6060

61-
- name: Snapshot trusted PR triage scripts
62-
run: |
63-
mkdir -p "$RUNNER_TEMP/pr-triage-trusted"
64-
cp -r .github/scripts/pr-triage/. "$RUNNER_TEMP/pr-triage-trusted/"
65-
6661
- name: Check out PR into a separate directory
6762
env:
6863
GH_TOKEN: ${{ github.token }}
@@ -105,7 +100,7 @@ jobs:
105100
# always succeed even when the worker fails before writing any
106101
# outputs of its own.
107102
touch "$RUNNER_TEMP/work/.placeholder"
108-
python3 "$RUNNER_TEMP/pr-triage-trusted/worker_gradle.py" --out-dir "$RUNNER_TEMP/work"
103+
python3 .github/scripts/pr-triage/worker_gradle.py --out-dir "$RUNNER_TEMP/work"
109104
110105
- name: Upload gradle work bundle
111106
if: always()
@@ -137,11 +132,6 @@ jobs:
137132
with:
138133
fetch-depth: 0
139134

140-
- name: Snapshot trusted PR triage scripts
141-
run: |
142-
mkdir -p "$RUNNER_TEMP/pr-triage-trusted"
143-
cp -r .github/scripts/pr-triage/. "$RUNNER_TEMP/pr-triage-trusted/"
144-
145135
- name: Check out PR into a separate directory
146136
env:
147137
GH_TOKEN: ${{ github.token }}
@@ -182,7 +172,7 @@ jobs:
182172
# The script operates on the PR tree at $PR_TRIAGE_REPO_ROOT.
183173
mkdir -p "$RUNNER_TEMP/work"
184174
touch "$RUNNER_TEMP/work/.placeholder"
185-
python3 "$RUNNER_TEMP/pr-triage-trusted/worker_copilot.py" --out-dir "$RUNNER_TEMP/work"
175+
python3 .github/scripts/pr-triage/worker_copilot.py --out-dir "$RUNNER_TEMP/work"
186176
187177
- name: Run copilot-phase worker (fix)
188178
if: needs.authorize-command.outputs.command == 'fix'
@@ -195,7 +185,7 @@ jobs:
195185
# The script operates on the PR tree at $PR_TRIAGE_REPO_ROOT.
196186
mkdir -p "$RUNNER_TEMP/work"
197187
touch "$RUNNER_TEMP/work/.placeholder"
198-
python3 "$RUNNER_TEMP/pr-triage-trusted/worker_copilot.py" \
188+
python3 .github/scripts/pr-triage/worker_copilot.py \
199189
--out-dir "$RUNNER_TEMP/work" \
200190
--in-dir "$RUNNER_TEMP/gradle-in"
201191
@@ -228,11 +218,6 @@ jobs:
228218
steps:
229219
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
230220

231-
- name: Snapshot trusted PR triage scripts
232-
run: |
233-
mkdir -p "$RUNNER_TEMP/pr-triage-trusted"
234-
cp -r .github/scripts/pr-triage/. "$RUNNER_TEMP/pr-triage-trusted/"
235-
236221
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
237222
id: otelbot-token
238223
with:
@@ -262,4 +247,4 @@ jobs:
262247
env:
263248
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
264249
PR_TRIAGE_REPO_ROOT: ${{ github.workspace }}
265-
run: python3 "$RUNNER_TEMP/pr-triage-trusted/poster.py" --in-dir "$RUNNER_TEMP/work"
250+
run: python3 .github/scripts/pr-triage/poster.py --in-dir "$RUNNER_TEMP/work"

0 commit comments

Comments
 (0)