code-foundry 0.34.10 → 0.34.11
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.
- package/.github/workflows/draft-pr.yml +41 -19
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
|
@@ -18,9 +18,6 @@ permissions:
|
|
|
18
18
|
contents: read
|
|
19
19
|
pull-requests: write
|
|
20
20
|
|
|
21
|
-
env:
|
|
22
|
-
HAS_AUTOMATION_TOKEN: ${{ secrets.CODE_FOUNDRY_TOKEN != '' || secrets.RELEASE_PLEASE_TOKEN != '' }}
|
|
23
|
-
|
|
24
21
|
jobs:
|
|
25
22
|
create-draft-pr:
|
|
26
23
|
name: Create
|
|
@@ -34,7 +31,7 @@ jobs:
|
|
|
34
31
|
id: check-pr
|
|
35
32
|
env:
|
|
36
33
|
HEAD_REF: ${{ github.ref_name }}
|
|
37
|
-
GH_TOKEN: ${{
|
|
34
|
+
GH_TOKEN: ${{ github.token }}
|
|
38
35
|
run: |
|
|
39
36
|
BRANCH="$HEAD_REF"
|
|
40
37
|
EXISTING=$(gh pr list --repo "$GITHUB_REPOSITORY" --limit 1 --base staging --head "$BRANCH" --state open --json number,title 2>/dev/null | node -e 'let d=""; process.stdin.on("data", c => d += c).on("end", () => console.log(JSON.parse(d || "[]").length))')
|
|
@@ -43,9 +40,11 @@ jobs:
|
|
|
43
40
|
- name: Create
|
|
44
41
|
if: steps.check-pr.outputs.existing == '0'
|
|
45
42
|
env:
|
|
43
|
+
AUTOMATION_TOKEN: ${{ secrets.CODE_FOUNDRY_TOKEN || secrets.RELEASE_PLEASE_TOKEN }}
|
|
44
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
46
45
|
HEAD_REF: ${{ github.ref_name }}
|
|
47
|
-
GH_TOKEN: ${{ secrets.CODE_FOUNDRY_TOKEN || secrets.RELEASE_PLEASE_TOKEN || github.token }}
|
|
48
46
|
run: |
|
|
47
|
+
set -euo pipefail
|
|
49
48
|
BRANCH="$HEAD_REF"
|
|
50
49
|
PREFIX="${BRANCH%%/*}"
|
|
51
50
|
SUFFIX="${BRANCH#*/}"
|
|
@@ -71,19 +70,42 @@ jobs:
|
|
|
71
70
|
PR_TITLE="$BRANCH"
|
|
72
71
|
fi
|
|
73
72
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
BODY_FILE=$(mktemp)
|
|
74
|
+
ERROR_FILE=$(mktemp)
|
|
75
|
+
trap 'rm -f -- "$BODY_FILE" "$ERROR_FILE"' EXIT
|
|
76
|
+
cat > "$BODY_FILE" <<EOF
|
|
77
|
+
CI PR created automatically by this workflow.
|
|
78
|
+
|
|
79
|
+
This PR is ready for review once required validation passes. If the
|
|
80
|
+
configured automation token is rejected, it is intentionally opened
|
|
81
|
+
as a draft for manual readiness.
|
|
82
|
+
|
|
83
|
+
**CI Status:** Pending — this workflow triggered on push to $BRANCH.
|
|
84
|
+
EOF
|
|
85
|
+
|
|
86
|
+
CREATE_ARGS=(
|
|
87
|
+
"repos/${GITHUB_REPOSITORY}/pulls"
|
|
88
|
+
--method POST
|
|
89
|
+
--field base=staging
|
|
90
|
+
--field head="$BRANCH"
|
|
91
|
+
--field title="$PR_TITLE"
|
|
92
|
+
--field body="@$BODY_FILE"
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
CREATED=false
|
|
96
|
+
if [ -n "$AUTOMATION_TOKEN" ] && GH_TOKEN="$AUTOMATION_TOKEN" gh api "${CREATE_ARGS[@]}" > /dev/null 2> "$ERROR_FILE"; then
|
|
97
|
+
CREATED=true
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
if [ "$CREATED" != true ]; then
|
|
101
|
+
DRAFT_ARGS=("${CREATE_ARGS[@]}" --field draft=true)
|
|
102
|
+
if GH_TOKEN="$GITHUB_TOKEN" gh api "${DRAFT_ARGS[@]}" > /dev/null 2> "$ERROR_FILE"; then
|
|
103
|
+
echo "::notice title=Manual PR readiness required::The configured automation token was absent or rejected; this PR was opened as a draft with the short-lived workflow token."
|
|
104
|
+
CREATED=true
|
|
105
|
+
fi
|
|
81
106
|
fi
|
|
82
107
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"${DRAFT_ARGS[@]}" \
|
|
88
|
-
--title "$PR_TITLE" \
|
|
89
|
-
--body "CI PR created automatically by this workflow.\n\n $BODY_NOTICE\n\n **CI Status:** Pending \u2014 this workflow triggered on push to \`$BRANCH\`."
|
|
108
|
+
if [ "$CREATED" != true ]; then
|
|
109
|
+
echo "::error title=Draft PR creation failed::Both the configured automation token and the workflow token failed to create the pull request."
|
|
110
|
+
exit 1
|
|
111
|
+
fi
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.34.11](https://github.com/0xPlayerOne/code-foundry/compare/v0.34.10...v0.34.11) (2026-08-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **draft-pr:** fall back to workflow token ([#350](https://github.com/0xPlayerOne/code-foundry/issues/350)) ([aef07db](https://github.com/0xPlayerOne/code-foundry/commit/aef07db6945badd7d7b3526b5490b1512ac1a468))
|
|
9
|
+
|
|
3
10
|
## [0.34.10](https://github.com/0xPlayerOne/code-foundry/compare/v0.34.9...v0.34.10) (2026-08-02)
|
|
4
11
|
|
|
5
12
|
|
package/package.json
CHANGED