Skip to content

Commit a219e42

Browse files
LukasParkeclaude
andcommitted
ci: drop the external-token requirement from this repo
Two changes so the pipeline runs entirely on the native GITHUB_TOKEN: - Cron and blank manual dispatches now resolve the latest published @openrouter/agent version from the public npm registry and port that release tag, instead of porting upstream main HEAD. This makes the weekly cron fully equivalent to the repository_dispatch fast path (same tag either way), so the cross-repo PAT dispatch in typescript-agent becomes a latency optimization, not a requirement — and it also fixes cron runs violating the 'ports track releases' principle by syncing to mid-flight upstream commits. - PRs opened with the native GITHUB_TOKEN don't trigger other workflows (GitHub's recursion guard), which was the standard argument for a PAT here. workflow_dispatch is exempt from that guard, so the port job now explicitly dispatches ci.yaml at the upstreamer/sync branch after opening the PR. Requires actions: write, added to the permissions block. No PAT or external secret is referenced anywhere in this repo now; the only secrets are OPENROUTER_API_KEY (inference) and the built-in token. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 51ce402 commit a219e42

1 file changed

Lines changed: 32 additions & 3 deletions

File tree

.github/workflows/upstreamer-port.yaml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ on:
2929
permissions:
3030
contents: write
3131
pull-requests: write
32+
actions: write # to dispatch ci.yaml onto the generated PR branch
3233

3334
concurrency:
3435
group: upstreamer-port
@@ -51,6 +52,24 @@ jobs:
5152
- name: Set up language toolchain
5253
uses: ./.github/actions/port-toolchain
5354

55+
# Ports track published releases, not upstream main. When no ref arrives
56+
# (cron, or a manual dispatch with the input left blank), resolve the
57+
# latest published @openrouter/agent version from the public npm registry
58+
# and port its release tag. This makes the cron fully equivalent to the
59+
# repository_dispatch fast path — same tag either way — so the pipeline
60+
# works with no cross-repo token at all if the dispatch is unavailable.
61+
- name: Resolve target ref
62+
id: target
63+
run: |
64+
set -euo pipefail
65+
REF="${{ inputs.ref || github.event.client_payload.ref }}"
66+
if [ -z "$REF" ]; then
67+
VERSION="$(curl -fsSL 'https://registry.npmjs.org/@openrouter%2Fagent/latest' | python3 -c 'import json,sys; print(json.load(sys.stdin)["version"])')"
68+
REF="@openrouter/agent@${VERSION}"
69+
echo "No ref provided — resolved latest npm release: $REF"
70+
fi
71+
echo "ref=$REF" >> "$GITHUB_OUTPUT"
72+
5473
- name: Run port
5574
env:
5675
# Provide these in repo settings:
@@ -65,10 +84,8 @@ jobs:
6584
echo "::error::OPENROUTER_API_KEY secret is not set. See .upstreamer/port.env.example."
6685
exit 1
6786
fi
68-
args=()
87+
args=(--ref "${{ steps.target.outputs.ref }}")
6988
[ "${{ inputs.force }}" = "true" ] && args+=(--force)
70-
REF="${{ inputs.ref || github.event.client_payload.ref }}"
71-
[ -n "$REF" ] && args+=(--ref "$REF")
7289
./scripts/upstream "${args[@]}"
7390
7491
- name: Check for changes
@@ -96,6 +113,7 @@ jobs:
96113
fi
97114
98115
- name: Open PR
116+
id: open-pr
99117
if: steps.diff.outputs.changed == 'true'
100118
uses: peter-evans/create-pull-request@v6
101119
with:
@@ -124,6 +142,17 @@ jobs:
124142
`.upstreamer/state.yaml` did not advance, the eval did not pass and this
125143
PR must not be merged as-is.
126144
145+
# Events created with the native GITHUB_TOKEN deliberately do not trigger
146+
# other workflows (GitHub's recursion guard), so the PR opened above gets
147+
# no CI checks on its own. workflow_dispatch is exempt from that guard:
148+
# kick ci.yaml at the PR branch explicitly. This keeps the whole pipeline
149+
# on the native token — no PAT anywhere in this repo.
150+
- name: Trigger CI on the port PR
151+
if: steps.diff.outputs.changed == 'true' && steps.open-pr.outputs.pull-request-operation != 'none'
152+
env:
153+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
154+
run: gh workflow run ci.yaml --repo "$GITHUB_REPOSITORY" --ref upstreamer/sync
155+
127156
- name: Upload logs
128157
if: always()
129158
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)