chore: normalise the repo secret
This commit is contained in:
2 files changed
+150
-413
No files matched your search
+18
-10
@@ -4,18 +4,26 @@ jobs:
|
||||
diag:
|
||||
runs-on: arch-host
|
||||
steps:
|
||||
- name: Inspect the release secret
|
||||
- name: Normalise the repo token
|
||||
env:
|
||||
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
|
||||
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
raw="$(printf '%s' "$REPO_TOKEN" | base64 -d)"
|
||||
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" \
|
||||
-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
|
||||
t="${RELEASE_TOKEN:-}"
|
||||
printf 'len=%s\n' "${#t}"
|
||||
printf 'sha=%s\n' "$(printf '%s' "$t" | sha256sum | cut -d' ' -f1)"
|
||||
printf 'server=%s\n' "$GITHUB_SERVER_URL"
|
||||
printf 'repo=%s\n' "$GITHUB_REPOSITORY"
|
||||
printf 'api=%s\n' "$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY"
|
||||
r="${REPO_TOKEN:-}"
|
||||
printf 'repo_len=%s\n' "${#r}"
|
||||
printf 'repo_sha=%s\n' "$(printf '%s' "$r" | sha256sum | cut -d' ' -f1)"
|
||||
printf 'release_len=%s\n' "${#RELEASE_TOKEN}"
|
||||
printf 'repo_len=%s\n' "${#REPO_TOKEN}"
|
||||
Reference in new issue
Block a user