Skip to content

Commit b907f49

Browse files
committed
Fix pre-commit git safe.directory in GitHub Action container
pre-commit requires git access. When running in a container, the workspace directory is owned by a different user, triggering git's safe.directory protection. Add git config to mark the workspace as safe. Ref: OSPRH-32049 Change-Id: I5f9adf820e02c71b6e14e393e4c42cc6fbe22151 Signed-off-by: Itay Matza <imatza@redhat.com>
1 parent db67b2b commit b907f49

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

.github/workflows/ansible-lint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
- name: Checkout
1717
uses: actions/checkout@v4
1818

19+
- name: Mark workspace as safe for git
20+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
21+
1922
- name: Install Ansible collections
2023
run: ansible-galaxy collection install -r requirements.yaml
2124

0 commit comments

Comments
 (0)