♻️ refactor(ci): 将 GIT_CONFIG 环境变量改为内联 -c 认证

- 删除三个 workflow env 段的 GIT_CONFIG_COUNT/KEY/VALUE 变量
- 在需要认证的 git 命令上内联 -c credential.helper/interactive
- prepare fetch、stats 两处 push、release push 各自内联
- 保留 ACCESS_TOKEN,helper 运行时取用
This commit is contained in:
csh
2026-07-20 16:39:08 +08:00
parent 2dcf9f7da4
commit ac8a781656
3 changed files with 19 additions and 25 deletions
+5 -8
View File
@@ -10,13 +10,6 @@ concurrency:
env:
ACCESS_TOKEN: ${{ secrets.WORKFLOW }}
GIT_CONFIG_COUNT: "3"
GIT_CONFIG_KEY_0: "credential.helper"
GIT_CONFIG_VALUE_0: ""
GIT_CONFIG_KEY_1: "credential.helper"
GIT_CONFIG_VALUE_1: '!f() { test "$1" = get || exit 0; printf "%s\n" username=oauth2; printf "%s\n" "password=${ACCESS_TOKEN}"; }; f'
GIT_CONFIG_KEY_2: "credential.interactive"
GIT_CONFIG_VALUE_2: "never"
WORKSPACE_ROOT: "/data/workspace"
jobs:
@@ -155,7 +148,11 @@ jobs:
git --git-dir="$REPOSITORY_DIR" remote add origin "$REMOTE_URL"
fi
git --git-dir="$REPOSITORY_DIR" fetch \
git \
-c credential.helper= \
-c 'credential.helper=!f() { test "$1" = get || exit 0; printf "%s\n" username=oauth2; printf "%s\n" "password=${ACCESS_TOKEN}"; }; f' \
-c credential.interactive=never \
--git-dir="$REPOSITORY_DIR" fetch \
--prune --prune-tags --tags --force origin \
'+refs/heads/*:refs/remotes/origin/*'