Skip to content

Commit

Permalink
fix: set workspace directory as safe in the entrypoint
Browse files Browse the repository at this point in the history
`actions/checkout` already fixed the issue on their side in
[v3.0.1](https://github.com/actions/checkout/releases/tag/v3.0.1).
But since this is a container action, it can be run with another uid than the one
from `actions/checkout` and therefore we need to add the `safe.directory` config again.

Another way of fixing this would be to make this action run with the same uid as the github runner,
 but as mentioned [here](actions/checkout#760 (comment))
we're not sure whether the `1000` uid of the runner is reliable.

The different `uid` issue seems more like a Github Actions ecosystem problem,
maybe they'll take care of it later.
  • Loading branch information
wagoid committed May 7, 2022
1 parent 534ab20 commit ce9a8cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -14,7 +14,7 @@ jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v2
Expand Down
4 changes: 4 additions & 0 deletions entrypoint.sh
Expand Up @@ -8,4 +8,8 @@ else
export NODE_PATH=$NODE_PATH:/node_modules
fi

# Since actions/checkout can be setup with a different user ID, we need to set the workspace as safe inside this action
# Info about the vunlerability: https://github.blog/2022-04-12-git-security-vulnerability-announced/
git config --global --add safe.directory "$GITHUB_WORKSPACE"

node /run.js

0 comments on commit ce9a8cb

Please sign in to comment.