Skip to content

Commit de49e33

Browse files
committed
ci: bearer vs token scheme AB
1 parent 6a66f8a commit de49e33

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

.github/workflows/diag-expr.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,25 @@ jobs:
1111
check:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Tag a main commit vs a branch commit
14+
- name: Bearer vs token scheme, same instant, same payload
1515
env:
1616
TOK: ${{ secrets.RELEASE_PLEASE_TOKEN }}
1717
run: |
1818
set -u
19-
try() {
19+
go() {
2020
code=$(curl -sS -o /tmp/o.json -w '%{http_code}' -X POST \
21-
-H "Authorization: Bearer $TOK" -H "Accept: application/vnd.github+json" \
21+
-H "Authorization: $1 $TOK" -H "Accept: application/vnd.github+json" \
2222
https://api.github.com/repos/${{ github.repository }}/releases \
23-
-d "{\"tag_name\":\"$1\",\"target_commitish\":\"$2\",\"draft\":false,\"name\":\"n\"}")
24-
echo "RESULT $3 http=$code msg=$(jq -r '.message // "created"' /tmp/o.json)"
23+
-d '{"tag_name":"'$2'","target_commitish":"31865133091093ffbfb3bc7bc6286e7d5a5ff708","draft":false,"name":"n","body":"b","prerelease":false}')
24+
echo "RESULT scheme=$1 http=$code msg=$(jq -r '.message // "created"' /tmp/o.json)"
2525
id=$(jq -r '.id // empty' /tmp/o.json)
2626
if [ -n "$id" ]; then
2727
curl -sS -o /dev/null -X DELETE -H "Authorization: Bearer $TOK" https://api.github.com/repos/${{ github.repository }}/releases/$id
28-
curl -sS -o /dev/null -X DELETE -H "Authorization: Bearer $TOK" https://api.github.com/repos/${{ github.repository }}/git/refs/tags/$1
28+
curl -sS -o /dev/null -X DELETE -H "Authorization: Bearer $TOK" https://api.github.com/repos/${{ github.repository }}/git/refs/tags/$2
2929
fi
3030
}
31-
try zz-onmain "31865133091093ffbfb3bc7bc6286e7d5a5ff708" "target=MAIN-commit"
32-
try zz-onbranch "${{ github.sha }}" "target=DIAG-branch-commit"
33-
try zz-bymain "main" "target=main-branch-name"
31+
for i in 1 2; do
32+
go Bearer "zz-bearer-$i"
33+
go token "zz-token-$i"
34+
done
3435
exit 0

0 commit comments

Comments
 (0)