Skip to content

Commit 308d20e

Browse files
committed
fix: ensure main branch checkout before git-auto-commit in container
- Add explicit git safe.directory configuration for container environment - Ensure main branch is checked out before git-auto-commit-action runs - Addresses detached HEAD warning when running in Docker containers
1 parent afa88e7 commit 308d20e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

.github/workflows/swift-format.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ jobs:
4141
- name: Format
4242
run: swift-format format --ignore-unparsable-files --recursive --in-place Sources Tests
4343

44+
- name: Configure git for container
45+
run: |
46+
git config --global --add safe.directory $GITHUB_WORKSPACE
47+
git checkout main
48+
4449
- uses: stefanzweifel/git-auto-commit-action@v7
4550
with:
4651
commit_message: Run swift-format

0 commit comments

Comments
 (0)