From 6f5c3d3c784166bafd58e896a054e71c8f8e6e80 Mon Sep 17 00:00:00 2001 From: nyyu Date: Mon, 15 Jul 2024 07:26:30 +0200 Subject: [PATCH] chore: use git token --- .woodpecker.yml | 4 ++-- build.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index c961055..355ac12 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -24,8 +24,8 @@ steps: - mkdir /build - chown -R build:build . /build - sudo -u build --preserve-env=PGP_KEY,PGP_PWD,PGP_ID sh -c 'mkdir ~/.gnupg && echo -e "default-cache-ttl 3600\nallow-preset-passphrase" > ~/.gnupg/gpg-agent.conf && echo "$PGP_KEY" | gpg --import --no-tty --batch --yes && echo "$PGP_PWD" | /usr/lib/gnupg/gpg-preset-passphrase --preset $PGP_ID' - - sudo -u build --preserve-env=CI_REPO_CLONE_URL,CI_COMMIT_BRANCH,CI_PREV_COMMIT_SHA,GIT_PASSWORD sh -c './build.sh' - secrets: [pgp_id, pgp_key, pgp_pwd, git_password] + - sudo -u build --preserve-env=CI_REPO_CLONE_URL,CI_COMMIT_BRANCH,CI_PREV_COMMIT_SHA,GIT_USER,GIT_TOKEN sh -c './build.sh' + secrets: [pgp_id, pgp_key, pgp_pwd, git_user, git_token] when: branch: master event: [push, cron, tag, manual] diff --git a/build.sh b/build.sh index 46d9d0c..14cc3c7 100755 --- a/build.sh +++ b/build.sh @@ -45,7 +45,7 @@ git config --global user.name "drone" git config --global init.defaultBranch master git remote set-url origin "${CI_REPO_CLONE_URL}" # shellcheck disable=SC2016 -git config credential.helper '!f() { sleep 1; echo "username=drone"; echo "password=${GIT_PASSWORD}"; }; f' +git config credential.helper '!f() { sleep 1; echo "username=${GIT_USER}"; echo "password=${GIT_TOKEN}"; }; f' for d in */; do cd "${d}" || continue