diff --git a/.gitea/workflows/changelog_and_release.yml b/.gitea/workflows/changelog_and_release.yml index 55c5572..348ce87 100644 --- a/.gitea/workflows/changelog_and_release.yml +++ b/.gitea/workflows/changelog_and_release.yml @@ -30,13 +30,6 @@ env: # - GIT_TOKEN: 用于 git push # - API_TOKEN: 用于 API 调用 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" @@ -906,7 +899,10 @@ jobs: git commit -m "${{ env.COMMIT_MSG }}" echo "📤 推送到远程 ${{ env.MAIN_BRANCH }} 分支..." - if git -C "${{ env.REPO_DIR }}" push origin "${{ env.MAIN_BRANCH }}"; then + if 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 \ + -C "${{ env.REPO_DIR }}" push origin "${{ env.MAIN_BRANCH }}"; then echo "✅ 推送成功" else echo "❌ 推送失败" diff --git a/.gitea/workflows/prepare.yml b/.gitea/workflows/prepare.yml index b5b1d92..c15134e 100644 --- a/.gitea/workflows/prepare.yml +++ b/.gitea/workflows/prepare.yml @@ -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/*' diff --git a/.gitea/workflows/update_stats_badge.yml b/.gitea/workflows/update_stats_badge.yml index c05b388..051cb9e 100644 --- a/.gitea/workflows/update_stats_badge.yml +++ b/.gitea/workflows/update_stats_badge.yml @@ -17,13 +17,6 @@ env: # ===== Token 配置 ===== # 请在 Settings -> Secrets 中配置 WORKFLOW secret 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" @@ -287,7 +280,11 @@ jobs: git commit -m ":bar_chart: chore(stats): 初始化统计分支" # 推送到远程 - git -C "${{ env.REPO_DIR }}" push origin "${{ env.BADGE_BRANCH }}" + git -C "${{ env.REPO_DIR }}" \ + -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 \ + push origin "${{ env.BADGE_BRANCH }}" echo "✅ 统计分支创建完成" echo "======================================" @@ -522,7 +519,11 @@ jobs: echo "📤 推送到远程 ${{ env.BADGE_BRANCH }} 分支..." # 推送到远程(使用 TOKEN) - if git -C "${{ env.REPO_DIR }}" push origin "${{ env.BADGE_BRANCH }}"; then + if git -C "${{ env.REPO_DIR }}" \ + -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 \ + push origin "${{ env.BADGE_BRANCH }}"; then echo "✅ 推送成功" echo "changed=true" >> $GITHUB_OUTPUT else