Skip to content

Commit 5b4614b

Browse files
yzld2002claude
andcommitted
ci(spec-sync): use fine-grained PAT (SPEC_SYNC_TOKEN) instead of a GitHub App
Org-owned App creation needs org-owner permission; a repo-scoped fine-grained PAT (Contents+PRs RW) is the self-serve workaround and still satisfies the anti-recursion requirement (not GITHUB_TOKEN, so gate workflows fire). All three writes — checkout, claude-code-action, gh pr create — use the same token. Swappable for an org App later. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent d2c839e commit 5b4614b

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

‎.github/workflows/spec-sync.yml‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@ jobs:
1515
env:
1616
V1_SPEC_URL: https://api.va.staging.landing.ai/v1/ade/openapi.json # staging drives the loop
1717
steps:
18-
- name: Mint GitHub App token
19-
id: app-token
20-
uses: actions/create-github-app-token@v1
21-
with:
22-
app-id: ${{ secrets.SPEC_SYNC_APP_ID }}
23-
private-key: ${{ secrets.SPEC_SYNC_APP_PRIVATE_KEY }}
24-
2518
- uses: actions/checkout@v6
2619
with:
27-
token: ${{ steps.app-token.outputs.token }}
20+
# SPEC_SYNC_TOKEN is a fine-grained PAT (Contents: RW, Pull requests: RW)
21+
# scoped to this repo. It must NOT be the default GITHUB_TOKEN: pushes/PRs
22+
# authored by GITHUB_TOKEN do not trigger the gate workflows (anti-recursion).
23+
token: ${{ secrets.SPEC_SYNC_TOKEN }}
2824
fetch-depth: 0 # tags needed for surface-lock baseline
2925

3026
- name: Install Rye
@@ -76,7 +72,7 @@ jobs:
7672
uses: anthropics/claude-code-action@v1
7773
with:
7874
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
79-
github_token: ${{ steps.app-token.outputs.token }}
75+
github_token: ${{ secrets.SPEC_SYNC_TOKEN }}
8076
prompt: |
8177
The previous commit updated specs/v1-ade.json and regenerated reference
8278
models in specs/_generated/v1_models.py. Update the SDK to match the spec
@@ -93,7 +89,7 @@ jobs:
9389
- name: Open sync PR
9490
if: steps.drift.outputs.code == '10'
9591
env:
96-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
92+
GH_TOKEN: ${{ secrets.SPEC_SYNC_TOKEN }}
9793
run: |
9894
gh pr create \
9995
--base main \

‎CONTRIBUTING.md‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,13 @@ Every spec-sync PR (and any PR to `main`) must pass `.github/workflows/pr-gates.
147147

148148
Spec-sync PRs are AI-drafted and **require human review** before merge.
149149

150-
**Secrets required:** `SPEC_SYNC_APP_ID` + `SPEC_SYNC_APP_PRIVATE_KEY` (a GitHub App with
151-
`contents: write` and `pull-requests: write` — needed because commits pushed with the default
152-
`GITHUB_TOKEN` do not trigger the gate workflows), `ANTHROPIC_API_KEY`, and
153-
`LANDINGAI_ADE_STAGING_APIKEY`.
150+
**Secrets required:** `SPEC_SYNC_TOKEN` (a fine-grained PAT scoped to this repo with
151+
`Contents: Read and write` and `Pull requests: Read and write`), `ANTHROPIC_API_KEY`, and
152+
`LANDINGAI_ADE_STAGING_APIKEY`. `SPEC_SYNC_TOKEN` must **not** be the default `GITHUB_TOKEN`:
153+
pushes and PRs authored by `GITHUB_TOKEN` do not trigger the gate workflows (GitHub
154+
anti-recursion), so the gates would never run on the sync PR. A GitHub App installation token
155+
(org-owned) is the cleaner long-term choice and can replace the PAT without other workflow
156+
changes.
154157

155158
**V2:** once the aide gateway serves its curated spec unauthenticated, add `specs/v2-aide.json` and
156159
its URL as a second drift-check in the workflow; the two-phase machinery is unchanged.

0 commit comments

Comments
 (0)