Skip to content

Commit 1b9f6dd

Browse files
committed
ci: keep workflow scratch files out of the PR
* Write ai_prompt.md and resolution_output.txt under $RUNNER_TEMP instead of the checkout root, so peter-evans/create-pull-request can't pick them up. * Add add-paths: patches/*.patch + patches/patches.json on the PR step as belt-and-suspenders so only the patch artefacts are ever committed, regardless of what else lands in the workspace. * Drop the secrets.MODELS_PAT override now that org-level Models is enabled — the auto-injected GITHUB_TOKEN with permissions:models:read works, and the workflow is fully secret-free again. * Bump the action version mention in the PR body template to v2.
1 parent 839e00f commit 1b9f6dd

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

.github/workflows/patch-node.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,16 @@ jobs:
7676
7777
- name: Build AI prompt
7878
if: steps.apply.outputs.needs_ai == 'true'
79-
run: python3 .github/scripts/ai_resolver.py prepare ../node ai_prompt.md
79+
# Write the prompt to RUNNER_TEMP — anything inside the checkout
80+
# gets picked up by peter-evans/create-pull-request below.
81+
run: python3 .github/scripts/ai_resolver.py prepare ../node "$RUNNER_TEMP/ai_prompt.md"
8082

8183
- name: Resolve conflicts with AI
8284
if: steps.apply.outputs.needs_ai == 'true'
8385
id: ai
8486
uses: actions/ai-inference@v2
8587
with:
86-
prompt-file: ai_prompt.md
88+
prompt-file: ${{ runner.temp }}/ai_prompt.md
8789
system-prompt: |
8890
You are an expert C/C++/JavaScript developer maintaining a Git patch against the Node.js source tree.
8991
Output ONLY the requested search/replace blocks in the exact format the user specifies.
@@ -94,12 +96,6 @@ jobs:
9496
# CoT tokens. 1M input / 32K output / "high" rate-limit tier.
9597
model: openai/gpt-4.1
9698
max-completion-tokens: 16000
97-
# The auto-injected GITHUB_TOKEN cannot access GitHub Models on
98-
# orgs that don't have Models enabled at the org/enterprise level
99-
# (returns 403 with no body). A fine-grained PAT scoped only to
100-
# account-level "Models: Read" works regardless of org policy.
101-
# See: https://github.com/actions/ai-inference/issues/155
102-
token: ${{ secrets.MODELS_PAT }}
10399

104100
- name: Apply AI resolutions
105101
if: steps.apply.outputs.needs_ai == 'true'
@@ -108,10 +104,10 @@ jobs:
108104
# Python exits non-zero on unresolved conflicts; pipefail+set -e
109105
# ensures the whole step fails so the PR step is skipped.
110106
python3 .github/scripts/ai_resolver.py apply ../node "${{ steps.ai.outputs.response-file }}" \
111-
| tee resolution_output.txt
107+
| tee "$RUNNER_TEMP/resolution_output.txt"
112108
{
113109
echo "RESOLUTION_OUTPUT<<EOF"
114-
cat resolution_output.txt
110+
cat "$RUNNER_TEMP/resolution_output.txt"
115111
echo "EOF"
116112
} >> "$GITHUB_ENV"
117113
@@ -147,13 +143,18 @@ jobs:
147143
148144
This PR updates the Node.js patch to version ${{ inputs.nodeVersion }}.
149145
150-
Patch conflicts (if any) were resolved with `actions/ai-inference@v1`
146+
Patch conflicts (if any) were resolved with `actions/ai-inference@v2`
151147
using GitHub Models — no third-party API key required.
152148
153149
${{ env.RESOLUTION_OUTPUT && '### AI Resolution Details' || '' }}
154150
${{ env.RESOLUTION_OUTPUT }}
155151
branch: "nodejs-v${{ inputs.nodeVersion }}"
156152
base: "main"
153+
# Be explicit — only patch files belong in the PR, never any
154+
# workspace scratch files that might appear during the run.
155+
add-paths: |
156+
patches/*.patch
157+
patches/patches.json
157158
delete-branch: true
158159
labels: "enhancement,nodejs"
159160
draft: false

0 commit comments

Comments
 (0)