code-foundry 0.34.7 → 0.34.8

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.
@@ -53,13 +53,14 @@ jobs:
53
53
  GH_TOKEN: ${{ secrets.CODE_FOUNDRY_TOKEN || secrets.RELEASE_PLEASE_TOKEN || github.token }}
54
54
  run: |
55
55
  set -euo pipefail
56
- EXISTING=$(gh pr list \
57
- --repo "$GITHUB_REPOSITORY" \
58
- --limit 1 \
59
- --base main \
60
- --head staging \
61
- --state open \
62
- --json number | node -e 'let d=""; process.stdin.on("data", c => d += c).on("end", () => console.log(JSON.parse(d || "[]").length))')
56
+ # The existing-promotion-PR lookup uses authenticated REST (gh api)
57
+ # rather than gh pr list, which issues a GraphQL query that
58
+ # NiftyLeague's long-lived fine-grained token policy rejects. The
59
+ # REST query keeps the exact base/head/state filter and the per_page=1
60
+ # cap (existing is 0 or 1) and fails closed on any API error.
61
+ EXISTING=$(gh api \
62
+ "repos/${GITHUB_REPOSITORY}/pulls?base=main&head=staging&state=open&per_page=1" \
63
+ --jq 'length')
63
64
  MAIN_TREE=$(gh api "repos/${GITHUB_REPOSITORY}/commits/main" --jq '.commit.tree.sha')
64
65
  STAGING_TREE=$(gh api "repos/${GITHUB_REPOSITORY}/commits/staging" --jq '.commit.tree.sha')
65
66
  TREE_EQUAL=false
@@ -186,26 +187,31 @@ jobs:
186
187
  - After merge, Release Please opens a separate versioned release PR with the changelog.
187
188
  EOF
188
189
 
189
- DRAFT_ARGS=()
190
+ # Creation uses authenticated REST (gh api POST) rather than
191
+ # `gh pr create`, which issues a GraphQL mutation that
192
+ # NiftyLeague's long-lived fine-grained token policy rejects. The
193
+ # REST payload keeps the exact base/head/title/body fields, adds
194
+ # draft=true only when no automation token is configured, and stays
195
+ # fail-closed through the create-race fallback below.
196
+ CREATE_ARGS=(
197
+ "repos/${GITHUB_REPOSITORY}/pulls"
198
+ --method POST
199
+ --field base=main
200
+ --field head=staging
201
+ --field title="Promote staging -> main ($DATE)"
202
+ --field body=@"$BODY_FILE"
203
+ )
190
204
  if [ "$HAS_AUTOMATION_TOKEN" != true ]; then
191
- DRAFT_ARGS+=(--draft)
205
+ CREATE_ARGS+=(--field draft=true)
192
206
  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."
193
207
  fi
194
208
 
195
- if ! gh pr create \
196
- --repo "$GITHUB_REPOSITORY" \
197
- --base main \
198
- --head staging \
199
- "${DRAFT_ARGS[@]}" \
200
- --title "Promote staging -> main ($DATE)" \
201
- --body-file "$BODY_FILE"; then
202
- EXISTING_NUMBER=$(gh pr list \
203
- --repo "$GITHUB_REPOSITORY" \
204
- --limit 1 \
205
- --base main \
206
- --head staging \
207
- --state open \
208
- --json number \
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
+ "repos/${GITHUB_REPOSITORY}/pulls?base=main&head=staging&state=open&per_page=1" \
209
215
  --jq '.[0].number // empty')
210
216
  if [ -z "$EXISTING_NUMBER" ]; then
211
217
  echo 'Pull request creation failed and no existing promotion PR was found.' >&2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.34.8](https://github.com/0xPlayerOne/code-foundry/compare/v0.34.7...v0.34.8) (2026-08-02)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **ci:** create promotion PRs through REST ([c123e21](https://github.com/0xPlayerOne/code-foundry/commit/c123e21e868de685a91de228ca57cf6614767bb7))
9
+
3
10
  ## [0.34.7](https://github.com/0xPlayerOne/code-foundry/compare/v0.34.6...v0.34.7) (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.7",
3
+ "version": "0.34.8",
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",