code-foundry 0.34.8 → 0.34.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,19 +41,24 @@ jobs:
41
41
  # The partial clone (filter: blob:none) defers blob downloads, so the
42
42
  # merge-base/diff comparison below can trigger a promisor fetch. With
43
43
  # persist-credentials disabled, git has no auth for that fetch; configure
44
- # the credential helper with the same token the Check step uses. The token
45
- # is scoped to contents: read, so this never enables write credentials.
44
+ # the credential helper with the short-lived workflow token. NiftyLeague
45
+ # rejects long-lived fine-grained automation tokens with HTTP 403 even
46
+ # on REST, so all read-only operations use github.token; it is scoped
47
+ # to contents: read, so this never enables write credentials.
46
48
  env:
47
- GH_TOKEN: ${{ secrets.CODE_FOUNDRY_TOKEN || secrets.RELEASE_PLEASE_TOKEN || github.token }}
49
+ GH_TOKEN: ${{ github.token }}
48
50
  run: gh auth setup-git
49
51
 
50
52
  - name: Check
51
53
  id: check-pr
52
54
  env:
53
- GH_TOKEN: ${{ secrets.CODE_FOUNDRY_TOKEN || secrets.RELEASE_PLEASE_TOKEN || github.token }}
55
+ GH_TOKEN: ${{ github.token }}
54
56
  run: |
55
57
  set -euo pipefail
56
- # The existing-promotion-PR lookup uses authenticated REST (gh api)
58
+ # Every lookup in this step is read-only and uses the short-lived
59
+ # workflow token: NiftyLeague rejects long-lived fine-grained
60
+ # automation tokens with HTTP 403 even on REST. The
61
+ # existing-promotion-PR lookup uses authenticated REST (gh api)
57
62
  # rather than gh pr list, which issues a GraphQL query that
58
63
  # NiftyLeague's long-lived fine-grained token policy rejects. The
59
64
  # REST query keeps the exact base/head/state filter and the per_page=1
@@ -206,11 +211,31 @@ jobs:
206
211
  echo "::notice title=Manual PR readiness required::Created draft promotion PR because no automation token is configured. Configure CODE_FOUNDRY_TOKEN or RELEASE_PLEASE_TOKEN, or mark this PR ready manually to trigger validation."
207
212
  fi
208
213
 
209
- if ! gh api "${CREATE_ARGS[@]}"; then
210
- # The create-race lookup uses the same authenticated REST query as
211
- # the Check step; gh pr list issues a GraphQL query that
212
- # NiftyLeague's long-lived fine-grained token policy rejects.
213
- EXISTING_NUMBER=$(gh api \
214
+ # Prefer the configured automation token for the write, but
215
+ # NiftyLeague rejects long-lived fine-grained tokens with HTTP 403
216
+ # even on REST, so retry the POST once with the short-lived workflow
217
+ # token before the create-race fallback. With no automation token
218
+ # configured, the first attempt already runs as github.token, so the
219
+ # retry only applies when an automation token was configured.
220
+ CREATED=false
221
+ if gh api "${CREATE_ARGS[@]}"; then
222
+ CREATED=true
223
+ elif [ "$HAS_AUTOMATION_TOKEN" = true ]; then
224
+ echo "::warning title=Token fallback::Automation token PR creation failed; retrying with the short-lived workflow token."
225
+ if GH_TOKEN="${{ github.token }}" gh api "${CREATE_ARGS[@]}"; then
226
+ CREATED=true
227
+ fi
228
+ fi
229
+
230
+ if [ "$CREATED" != true ]; then
231
+ # The create-race lookup runs only after creation failed: with a
232
+ # configured automation token that was rejected (its github.token
233
+ # retry also failed), or with no automation token configured, when
234
+ # the first attempt already ran as github.token. The lookup uses
235
+ # the same authenticated REST query as the Check step, always with
236
+ # the short-lived workflow token; gh pr list issues a GraphQL query
237
+ # that NiftyLeague's long-lived fine-grained token policy rejects.
238
+ EXISTING_NUMBER=$(GH_TOKEN="${{ github.token }}" gh api \
214
239
  "repos/${GITHUB_REPOSITORY}/pulls?base=main&head=staging&state=open&per_page=1" \
215
240
  --jq '.[0].number // empty')
216
241
  if [ -z "$EXISTING_NUMBER" ]; then
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.34.9](https://github.com/0xPlayerOne/code-foundry/compare/v0.34.8...v0.34.9) (2026-08-02)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **ci:** fall back to github token for promotion ([37ff019](https://github.com/0xPlayerOne/code-foundry/commit/37ff019e95a9024338c05fec7579476bd5cf0b3f))
9
+
3
10
  ## [0.34.8](https://github.com/0xPlayerOne/code-foundry/compare/v0.34.7...v0.34.8) (2026-08-02)
4
11
 
5
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-foundry",
3
- "version": "0.34.8",
3
+ "version": "0.34.9",
4
4
  "description": "A fast, language-aware repository factory for agent-ready workflows, testing, security, and release automation.",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-or-later",