Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to run on GitHub Actions #1158

Closed
kimromi opened this issue Apr 13, 2022 · 10 comments
Closed

Fails to run on GitHub Actions #1158

kimromi opened this issue Apr 13, 2022 · 10 comments

Comments

@kimromi
Copy link

kimromi commented Apr 13, 2022

I get the following error in repositories that use Dockerfile with GitHub Actions.

reviewdog: PullRequest needs 'git' command: failed to run 'git rev-parse --show-prefix': exit status 128

I have investigated and it seems to be related here.

fatal: unsafe repository ('/github/workspace' is owned by someone else)
To add an exception for this directory, call:

	git config --global --add safe.directory /github/workspace

How do we fix it?

@kimromi
Copy link
Author

kimromi commented Apr 13, 2022

As a temporary fix, we changed the permissions of the directory where the target repository is checkeout in the workflow of GitHub Actions.

      - run: |
          sudo chown -R root:root $GITHUB_WORKSPACE

The user and directory permissions for executing git commands in the Docker container will match and errors will no longer occur.

@easimon
Copy link

easimon commented Apr 13, 2022

For those, who (like me) are confused how a change in git 2.35.2 can break e.g. reviewdog/markdownlint, which effectively uses git 2.32.1 (since its using alpine 3.14): This new behaviour has been backported to all git versions >= 2.30.x, as stated in the Release Notes for 2.35.2

This release merges up the fixes that appear in v2.30.3,
v2.31.2, v2.32.1, v2.33.2 and v2.34.2 to address the security
issue CVE-2022-24765; see the release notes for these versions
for details.

haya14busa added a commit to reviewdog/action-template that referenced this issue Apr 13, 2022
haya14busa added a commit to reviewdog/action-actionlint that referenced this issue Apr 13, 2022
haya14busa added a commit to reviewdog/action-actionlint that referenced this issue Apr 13, 2022
haya14busa added a commit to reviewdog/action-vint that referenced this issue Apr 13, 2022
haya14busa added a commit to reviewdog/action-nimlint that referenced this issue Apr 13, 2022
@grische
Copy link

grische commented Apr 14, 2022

@ovalenzuela19 you can open a PR like this: sailingpalmtree/reviewdog-flakehell-action@07a9b80

on any reviewdog action you still encounter the issue with.

@YashNagayach95
Copy link

@review-dog Any update on this issue? Still facing the same issue.
Screenshot 2022-04-15 at 1 49 41 PM

@shogo82148
Copy link
Contributor

Here is a workaround for this problem.
Please try it.

reviewdog/action-misspell#44

+git config --global --add safe.directory "$GITHUB_WORKSPACE" || exit 1

@YashNagayach95
Copy link

Here is a workaround for this problem. Please try it.

reviewdog/action-misspell#44

+git config --global --add safe.directory "$GITHUB_WORKSPACE" || exit 1

what exactly we can write in yml file of detekt config?

@diegocunhawarren
Copy link

  • run: |
    sudo chown -R root:root $GITHUB_WORKSPACE

As he said here, you have to create a step before reviewdog step and add this

Example:

- name: "Give detekt permissions"
        run: |
          sudo chown -R root:root $GITHUB_WORKSPACE

- name: "Run detekt"
        uses: alaegin/Detekt-Action@v1.18.1
        with:
          reviewdog_level: warning
          github_token: ${{ secrets.github_token }}
          detekt_config: config/detekt/detekt.yml
          reviewdog_filter: file
          detekt_excludes: "**/build/**,**/.idea/**,**/test/**,**/androidTest/**"
          reviewdog_reporter: github-pr-review

@shogo82148
Copy link
Contributor

Or up-vote to this pull request alaegin/Detekt-Action#38
and please contact to the author of the action.

@haya14busa
Copy link
Member

Does this issue happen with self-hosted runners as well...?
actions/checkout#766

haya14busa added a commit that referenced this issue Apr 19, 2022
git binary command dependency sometimes leads to a problem like #1158.
We should remove the dependencies as much as possible.

We can completely remove the git command dependency for GitHub reporters
with this commit.
nalajcie added a commit to nalajcie/action-codespell that referenced this issue Apr 25, 2022
balint-bg added a commit to sailingpalmtree/reviewdog-flakehell-action that referenced this issue Jul 11, 2022
This should fix the issues when we see:
> reviewdog: failed to run 'git rev-parse --show-prefix': exit status 128

Reviewdog bug: reviewdog/reviewdog#1158
Reviewdoc Release Notes for v.0.14.1: https://github.com/reviewdog/reviewdog/releases/tag/v0.14.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants