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

Push action invalid revision #18

Closed
vidavidorra opened this issue Nov 27, 2019 · 3 comments · Fixed by #19
Closed

Push action invalid revision #18

vidavidorra opened this issue Nov 27, 2019 · 3 comments · Fixed by #19

Comments

@vidavidorra
Copy link
Contributor

I'm using v1.3.0 and this error was from the second commit, in which no valid revision could be found.
See the log here. Looks to me like the ^1 after the fist hash is not valid in the case of there only being 2 commits. I haven't looked ad the code but why would you need to get the previous commit from the last known commit before the push?

The first commit worked correctly, but it detected an invalid commit message due to that commit being generated by GitHub and not valid style.

@wagoid
Copy link
Owner

wagoid commented Nov 27, 2019

Hi @vidavidorra, thank you for submitting this issue! This is done due to how git revision ranges work. When doing a git log for SHA1..SHA2 the commit messages of SHA1 will not be included. I didn't find a way to do this in one command without ^1 and ended up going with this quickest approach. I was aware it would break in this case but thought it would be too much of an edge case (i.e. only first push of a repo) so I didn't worry about it 🙈

Do you know of a solution in git log for this? Otherwise I will solve it by running two git commands 🚀

@vidavidorra
Copy link
Contributor Author

Are you using the from and to fields from commitlint to pass on the commit range it needs to run on? If so I think it should be okay to pass the from field as the last known commit hash before the push (github.event.before) and the to field with the current hash. Only on the first commit of the repo, I'm not sure what the github.event.before would be in that case, but that commit might not work and need some other way to pass the commit or commit message to commitlint.

@wagoid
Copy link
Owner

wagoid commented Nov 30, 2019

Yes, that's what I currently use as the from field for push events. For pull_request it's different, I get the first commit of the PR in that case.
The thing with github.event.before is that when I tested I got a behavior of github giving me the "oldest commit of the push", not "the commit before the push". I just re-checked this and before was showing correct information, so I guess at the time I misinterpreted the info.
Will remove ^1 from push events and keep the usage of ^1 only for PR events.

wagoid added a commit that referenced this issue Nov 30, 2019
"before" field already shows the commit before the push event was sent, so we can use it as "from" field of the revision.

Fixes #18
wagoid added a commit that referenced this issue Nov 30, 2019
"before" field of a push event's payload already shows the commit before the push event was sent, so we can use it as "from" field of the revision.

Fixes #18
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

Successfully merging a pull request may close this issue.

1 participant