@@ -11,43 +11,31 @@ jobs:
1111 check :
1212 runs-on : ubuntu-latest
1313 steps :
14- - name : Compare the fallback expression against the secret alone
14+ - name : Isolate which field triggers the 403
1515 env :
16- TOK_EXPR : ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }}
17- TOK_DIRECT : ${{ secrets.RELEASE_PLEASE_TOKEN }}
16+ TOK : ${{ secrets.RELEASE_PLEASE_TOKEN }}
1817 run : |
1918 set -u
20- echo "expr len=${#TOK_EXPR} prefix=${TOK_EXPR%%_*}_"
21- echo "direct len=${#TOK_DIRECT} prefix=${TOK_DIRECT%%_*}_"
22- if [ "$TOK_EXPR" = "$TOK_DIRECT" ]; then echo "SAME token"; else echo "DIFFERENT token"; fi
23-
24- echo "--- A: same payload but Authorization: Bearer ---"
25- curl -sS -o /tmp/b.json -w 'http=%{http_code}\n' \
26- -X POST -H "Authorization: Bearer $TOK_EXPR" \
27- -H "Accept: application/vnd.github+json" \
28- https://api.github.com/repos/${{ github.repository }}/releases \
29- -d '{"name":"v1.3.0-diagB","tag_name":"v1.3.0-diagB","body":"diag notes","draft":false,"prerelease":false,"target_commitish":"25403c7"}'
30- echo "BEARER result: $(jq -r '.message // "created"' /tmp/b.json)"
31- idb=$(jq -r '.id // empty' /tmp/b.json)
32- if [ -n "$idb" ]; then
33- curl -sS -o /dev/null -X DELETE -H "Authorization: Bearer $TOK_EXPR" \
34- https://api.github.com/repos/${{ github.repository }}/releases/$idb
35- curl -sS -o /dev/null -X DELETE -H "Authorization: Bearer $TOK_EXPR" \
36- https://api.github.com/repos/${{ github.repository }}/git/refs/tags/v1.3.0-diagB
37- echo "(bearer variant cleaned up)"
38- fi
39-
40- echo "--- exact release-please payload, via the expression token ---"
41- curl -sS -o /tmp/a.json -w 'http=%{http_code}\n' \
42- -X POST -H "Authorization: token $TOK_EXPR" \
43- -H "Accept: application/vnd.github+json" \
44- https://api.github.com/repos/${{ github.repository }}/releases \
45- -d '{"name":"v1.3.0-diag","tag_name":"v1.3.0-diag","body":"diag notes","draft":false,"prerelease":false,"target_commitish":"25403c7"}'
46- echo "expr result: $(jq -r '.message // "created"' /tmp/a.json)"
47- ida=$(jq -r '.id // empty' /tmp/a.json)
48- if [ -n "$ida" ]; then
49- curl -sS -o /dev/null -w 'cleanup rel=%{http_code}\n' -X DELETE -H "Authorization: token $TOK_EXPR" \
50- https://api.github.com/repos/${{ github.repository }}/releases/$ida
51- curl -sS -o /dev/null -w 'cleanup tag=%{http_code}\n' -X DELETE -H "Authorization: token $TOK_EXPR" \
52- https://api.github.com/repos/${{ github.repository }}/git/refs/tags/v1.3.0-diag
53- fi
19+ try() {
20+ local label="$1"; local payload="$2"
21+ code=$(curl -sS -o /tmp/o.json -w '%{http_code}' -X POST \
22+ -H "Authorization: Bearer $TOK" -H "Accept: application/vnd.github+json" \
23+ https://api.github.com/repos/${{ github.repository }}/releases -d "$payload")
24+ msg=$(jq -r '.message // "created"' /tmp/o.json)
25+ echo "RESULT $label http=$code msg=$msg"
26+ id=$(jq -r '.id // empty' /tmp/o.json)
27+ tag=$(jq -r '.tag_name // empty' /tmp/o.json)
28+ if [ -n "$id" ]; then
29+ curl -sS -o /dev/null -X DELETE -H "Authorization: Bearer $TOK" \
30+ https://api.github.com/repos/${{ github.repository }}/releases/$id
31+ curl -sS -o /dev/null -X DELETE -H "Authorization: Bearer $TOK" \
32+ https://api.github.com/repos/${{ github.repository }}/git/refs/tags/$tag
33+ fi
34+ }
35+ F=25403c779883dc808219e5cad581d33aea691220
36+ try baseline-fullsha-notag-nobody '{"tag_name":"zz-v1","target_commitish":"'$F'","draft":false,"name":"n"}'
37+ try plus-body '{"tag_name":"zz-v2","target_commitish":"'$F'","draft":false,"name":"n","body":"notes"}'
38+ try plus-prerelease '{"tag_name":"zz-v3","target_commitish":"'$F'","draft":false,"prerelease":false,"name":"n"}'
39+ try short-sha '{"tag_name":"zz-v4","target_commitish":"25403c7","draft":false,"name":"n"}'
40+ try vdot-tagname '{"tag_name":"v1.3.0-diagX","target_commitish":"'$F'","draft":false,"name":"n"}'
41+ try exact-releaseplease '{"name":"v1.3.0","tag_name":"v1.3.0-diagY","body":"notes","draft":false,"prerelease":false,"target_commitish":"'$F'"}'
0 commit comments