Skip to content

Commit

Permalink
Fix `fatal: detected dubious ownership in repository at '/__w/eslint-…
Browse files Browse the repository at this point in the history
…config/eslint-config'` error that occurs during some GitHub Actions steps. Since version 2.35.2 `git` has not liked that the git directory is owned by other user than the one performing git operations in the directory. Change the owner of the directory to be the same user as the steps are run as.
  • Loading branch information
joelposti committed Jul 26, 2024
1 parent 296462a commit 5e28e79
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/check-and-test-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ jobs:
path: ~/.npm
key: npm-dependencies-${{ hashFiles('**/package-lock.json') }}
- run: npm ci --cache ~/.npm --prefer-offline --ignore-scripts --no-fund
# Fix `fatal: detected dubious ownership in repository at '/__w/eslint-config/eslint-config'`
# error that occurs during this step. Since version 2.35.2 `git` has not
# liked that the git directory is owned by other user than the one
# performing git operations in the directory. Change the owner of the
# directory to be the same user as these steps are run as.
- run: chown root:root "$GITHUB_WORKSPACE"
- run: scripts/lint.sh paths .

test:
Expand All @@ -33,6 +39,7 @@ jobs:
path: ~/.npm
key: npm-dependencies-${{ hashFiles('**/package-lock.json') }}
- run: npm ci --cache ~/.npm --prefer-offline --ignore-scripts --no-fund
- run: chown root:root "$GITHUB_WORKSPACE"
- run: scripts/test.sh

type-check:
Expand All @@ -48,4 +55,5 @@ jobs:
path: ~/.npm
key: npm-dependencies-${{ hashFiles('**/package-lock.json') }}
- run: npm ci --cache ~/.npm --prefer-offline --ignore-scripts --no-fund
- run: chown root:root "$GITHUB_WORKSPACE"
- run: scripts/type-check.sh
6 changes: 6 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ jobs:
ref: ${{ github.event.inputs.rev }}
# scripts/ci/prepare-release.sh depends on git tags being fetched.
fetch-depth: 0
# Fix `fatal: detected dubious ownership in repository at '/__w/eslint-config/eslint-config'`
# error that occurs during this step. Since version 2.35.2 `git` has not
# liked that the git directory is owned by other user than the one
# performing git operations in the directory. Change the owner of the
# directory to be the same user as these steps are run as.
- run: chown root:root "$GITHUB_WORKSPACE"
- run: scripts/ci/prepare-release.sh '${{ github.event.inputs.version }}' '${{ github.actor }}'
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
path: ~/.npm
key: npm-dependencies-${{ hashFiles('**/package-lock.json') }}
- run: npm ci --cache ~/.npm --prefer-offline --ignore-scripts --no-fund
# Fix `fatal: detected dubious ownership in repository at '/__w/eslint-config/eslint-config'`
# error that occurs during this step. Since version 2.35.2 `git` has not
# liked that the git directory is owned by other user than the one
# performing git operations in the directory. Change the owner of the
# directory to be the same user as these steps are run as.
- run: chown root:root "$GITHUB_WORKSPACE"
- run: scripts/lint.sh paths .

test:
Expand All @@ -51,6 +57,7 @@ jobs:
path: ~/.npm
key: npm-dependencies-${{ hashFiles('**/package-lock.json') }}
- run: npm ci --cache ~/.npm --prefer-offline --ignore-scripts --no-fund
- run: chown root:root "$GITHUB_WORKSPACE"
- run: scripts/test.sh

type-check:
Expand All @@ -68,6 +75,7 @@ jobs:
path: ~/.npm
key: npm-dependencies-${{ hashFiles('**/package-lock.json') }}
- run: npm ci --cache ~/.npm --prefer-offline --ignore-scripts --no-fund
- run: chown root:root "$GITHUB_WORKSPACE"
- run: scripts/type-check.sh

release:
Expand All @@ -84,6 +92,7 @@ jobs:
ref: ${{ github.event.inputs.rev }}
# scripts/ci/release.sh depends on all git branches being fetched.
fetch-depth: 0
- run: chown root:root "$GITHUB_WORKSPACE"
- run: scripts/ci/release.sh '${{ github.event.inputs.rev }}' '${{ github.actor }}'
env:
TOKEN_FOR_PUBLISHING_NPM_PACKAGES: ${{ secrets.TOKEN_FOR_PUBLISHING_NPM_PACKAGES }}

0 comments on commit 5e28e79

Please sign in to comment.