fix: use basic auth for forgejo sync
This commit is contained in:
parent
767f78c73f
commit
de0694f8e0
1 changed files with 7 additions and 6 deletions
13
.github/workflows/sync-to-forgejo.yml
vendored
13
.github/workflows/sync-to-forgejo.yml
vendored
|
|
@ -18,8 +18,9 @@ jobs:
|
||||||
|
|
||||||
- name: Sync to Forgejo
|
- name: Sync to Forgejo
|
||||||
env:
|
env:
|
||||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_SECRET || secrets.GITEA_SECRET }}
|
FORGEJO_SECRET: ${{ secrets.FORGEJO_SECRET || secrets.GITEA_SECRET }}
|
||||||
FORGEJO_OWNER: ${{ secrets.FORGEJO_OWNER || secrets.FORGEJO_USERNAME || secrets.GITEA_USERNAME || 'ashwin' }}
|
FORGEJO_OWNER: ${{ secrets.FORGEJO_OWNER || 'ashwin' }}
|
||||||
|
FORGEJO_USERNAME: ${{ secrets.FORGEJO_USERNAME || secrets.GITEA_USERNAME || 'ashwin' }}
|
||||||
REPO: ${{ github.event.repository.name }}
|
REPO: ${{ github.event.repository.name }}
|
||||||
BRANCH: ${{ github.ref_name }}
|
BRANCH: ${{ github.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -28,12 +29,12 @@ jobs:
|
||||||
export GIT_TRACE=1
|
export GIT_TRACE=1
|
||||||
export GIT_CURL_VERBOSE=1
|
export GIT_CURL_VERBOSE=1
|
||||||
|
|
||||||
USER="${FORGEJO_OWNER}"
|
USER="${FORGEJO_USERNAME}"
|
||||||
TARGET="https://ci.nxtgauge.com/${FORGEJO_OWNER}/${REPO}.git"
|
TARGET="https://ci.nxtgauge.com/${FORGEJO_OWNER}/${REPO}.git"
|
||||||
AUTH="$(printf '%s' "${USER}:${FORGEJO_TOKEN}" | base64 -w0)"
|
AUTH="$(printf '%s' "${USER}:${FORGEJO_SECRET}" | base64 -w0)"
|
||||||
|
|
||||||
test -n "${FORGEJO_TOKEN:-}" || (echo "FORGEJO_TOKEN empty" && exit 1)
|
test -n "${FORGEJO_SECRET:-}" || (echo "FORGEJO_SECRET empty" && exit 1)
|
||||||
curl -fsS -H "Authorization: token ${FORGEJO_TOKEN}" https://ci.nxtgauge.com/api/v1/user >/dev/null
|
curl -fsS -H "Authorization: Basic ${AUTH}" https://ci.nxtgauge.com/api/v1/user >/dev/null
|
||||||
curl -fsS -H "Authorization: Basic ${AUTH}" "${TARGET}/info/refs?service=git-receive-pack" >/dev/null
|
curl -fsS -H "Authorization: Basic ${AUTH}" "${TARGET}/info/refs?service=git-receive-pack" >/dev/null
|
||||||
|
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue