fix(ci): support GITEA_TOKEN secret with fallback
This commit is contained in:
parent
0efacd053b
commit
c1216323c4
1 changed files with 8 additions and 1 deletions
9
.github/workflows/sync-to-gitea.yml
vendored
9
.github/workflows/sync-to-gitea.yml
vendored
|
|
@ -18,15 +18,22 @@ jobs:
|
|||
|
||||
- name: Sync to Gitea
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_SECRET }}
|
||||
GITEA_TOKEN_PRIMARY: ${{ secrets.GITEA_TOKEN }}
|
||||
GITEA_TOKEN_FALLBACK: ${{ secrets.GITEA_SECRET }}
|
||||
REPO: ${{ github.event.repository.name }}
|
||||
BRANCH: ${{ github.ref_name }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
GITEA_TOKEN="${GITEA_TOKEN_PRIMARY:-${GITEA_TOKEN_FALLBACK:-}}"
|
||||
if [ -z "${GITEA_TOKEN}" ]; then
|
||||
echo "Missing GITEA token secret. Set GITEA_TOKEN (preferred) or GITEA_SECRET."
|
||||
exit 1
|
||||
fi
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
GITEA_URL="https://Admin:${GITEA_TOKEN}@ci.nxtgauge.com/Admin/${REPO}.git"
|
||||
echo "Sync target: Admin/${REPO}.git on branch ${BRANCH}"
|
||||
|
||||
git remote remove gitea 2>/dev/null || true
|
||||
git remote add gitea "${GITEA_URL}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue