Skip to content

Commit 1ec80dc

Browse files
Fix publish action for actions/checkout@v6 worktree credentials (#133)
actions/checkout@v6 moved credentials from .git/config to a separate file using includeIf for security (actions/checkout#2286). This breaks quarto publish gh-pages which uses git worktrees, since the includeIf condition doesn't match worktree paths. The fix propagates the credential configuration to worktrees by adding a second includeIf rule that matches .git/worktrees/* paths. This is backward compatible - it only runs if v6-style credentials exist. Also updates test.yaml to use checkout@v6 and documents v6 compatibility in publish/README.md.
1 parent 66f8a39 commit 1ec80dc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

publish/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ runs:
7272
run: |
7373
git config --global user.email "${{ inputs.GITHUB_EMAIL }}"
7474
git config --global user.name "${{ inputs.GITHUB_USERNAME }}"
75+
# Propagate git credentials to worktrees (required for actions/checkout@v6)
76+
# See: https://github.com/quarto-dev/quarto-actions/issues/133
77+
if git config get includeIf.gitdir:"$(git rev-parse --path-format=absolute --git-dir)".path &>/dev/null; then
78+
GIT_DIR=$(git rev-parse --path-format=absolute --git-dir)
79+
CRED_PATH=$(git config get --path includeIf.gitdir:"${GIT_DIR}".path)
80+
git config set --path includeIf.gitdir:"${GIT_DIR}/worktrees/*".path "${CRED_PATH}"
81+
fi
7582
TARGET="${{ inputs.to }}"
7683
if [ "$TARGET" == "" ]; then
7784
TARGET="${{ inputs.target }}"

0 commit comments

Comments
 (0)