Files
FWS-Kitty/.gitea/workflows/diag.yml
T

24 lines
973 B
YAML

name: diag
on: workflow_dispatch
jobs:
diag:
runs-on: arch-host
steps:
- name: Decode the repo token and store it back
env:
STORED: ${{ secrets.REPO_TOKEN }}
API_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
set -euo pipefail
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 -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"