Skip to content

Errors on force-pushed PRs #21

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

Closed
alerque opened this issue Jan 3, 2020 · 4 comments
Closed

Errors on force-pushed PRs #21

alerque opened this issue Jan 3, 2020 · 4 comments

Comments

@alerque
Copy link

alerque commented Jan 3, 2020

I started setting up this Action for one of my repos and it looked like it worked the first time. I had deliberately entered an invalid commit message just to see if it caught the mistake, and it did.

I then fixed the commit and force-pushed the PR again. At that point the action failed with some messages about not being able to find the commmit:

fatal: ambiguous argument 'a82656b832bb511c587d1c7a29be42ef042017c9^1..a82656b832bb511c587d1c7a29be42ef042017c9': unknown revision or path not in the working tree.

Am I doing something wrong? Is this only because it's a commit with the Action config or will this be a problem with other PRs too?

@alerque
Copy link
Author

alerque commented Jan 3, 2020

Note the action is working on my fork on the push action, it's only failing on the PR I have open on that branch.

@wagoid
Copy link
Owner

wagoid commented Jan 3, 2020

hi @alerque, that's probably due to an update in actions/checkout. I got a similar issue in another project but didn't update readme here yet. In checkout@v2 their clone logic only fetches the latest commit of the branch. Since we check multiple commit messages, we need to fetch more commits. If you add fetch-dept: 0 parameter that will work (since it will fetch all commits):

    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: wagoid/commitlint-github-action@v1

About the second action that you sent, the reason why it worked is because of 2 things: it was ran in a push event and commit was force-pushed. When commit is force-pushed and event is push I only check the latest commit of the push, because the before field from event's payload may not exist in history.

Let me know if the above fix works for you 🚀

@alerque alerque changed the title Errors on fore-pushed PRs Errors on force-pushed PRs Jan 4, 2020
@alerque
Copy link
Author

alerque commented Jan 4, 2020

Thank you for the feedback @wagoid (and for this great little action!). That does seem to have resolved the issue for me. It would probably be useful to mention that in the docs and others are bound to run into this unexpectedly.

Feel free to close this issue because the problem is resolved or keep as a reminder until the documentation catches up.

@wagoid
Copy link
Owner

wagoid commented Jan 5, 2020

Awesome, I'm glad it worked out @alerque! Gonna update readme now 🚀

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

2 participants