chore: diagnose the repo secret update
This commit is contained in:
1 file changed
+9
-15
@@ -4,26 +4,20 @@ jobs:
|
||||
diag:
|
||||
runs-on: arch-host
|
||||
steps:
|
||||
- name: Normalise the repo token
|
||||
- name: Decode the repo token and store it back
|
||||
env:
|
||||
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
|
||||
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
STORED: ${{ secrets.REPO_TOKEN }}
|
||||
API_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
raw="$(printf '%s' "$REPO_TOKEN" | base64 -d)"
|
||||
printf 'api_len=%s\n' "${#API_TOKEN}"
|
||||
printf 'stored_len=%s\n' "${#STORED}"
|
||||
raw="$(printf '%s' "$STORED" | base64 -d 2>/dev/null || true)"
|
||||
printf 'decoded_len=%s\n' "${#raw}"
|
||||
RAW="$raw" python3 -c 'import json,os; print(json.dumps({"data": os.environ["RAW"]}))' > "$RUNNER_TEMP/secret.json"
|
||||
curl -sS --fail-with-body -o /dev/null -w 'set REPO_TOKEN -> %{http_code}\n' -X PUT \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
curl -sS -w '\ncode=%{http_code}\n' -X PUT \
|
||||
-H "Authorization: token $API_TOKEN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-binary @"$RUNNER_TEMP/secret.json" \
|
||||
"$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/actions/secrets/REPO_TOKEN"
|
||||
rm -f "$RUNNER_TEMP/secret.json"
|
||||
|
||||
- name: Inspect both secrets
|
||||
env:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
printf 'release_len=%s\n' "${#RELEASE_TOKEN}"
|
||||
printf 'repo_len=%s\n' "${#REPO_TOKEN}"
|
||||
Reference in new issue
Block a user