Skip to content

Commit

Permalink
Try to fix CI git error
Browse files Browse the repository at this point in the history
When attempting to run the pre-commit hooks in the CI, we get this
error:

An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?

actions/checkout#766 suggests the issue could
be because 'actions/checkout' clones the repository as a different user
than is used in our custom docker container. Git then doesn't trust the
repository and errors when called upon.
  • Loading branch information
hsaunders1904 committed Oct 10, 2023
1 parent 6455388 commit b3199ae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -17,6 +17,10 @@ jobs:
- uses: actions/checkout@v3
- name: Quality Checks
run: |
# As we're running in our own container, we're not the same user as is
# used by 'actions/checkout', so git operations fail.
# https://github.com/actions/checkout/issues/766
git config --global --add safe.directory "$GITHUB_WORKSPACE"
pip install pre-commit
pre-commit install
pre-commit run --all
Expand Down

0 comments on commit b3199ae

Please sign in to comment.