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

fix: run on SHA range for normal push (not only PR) #12

Closed
vidavidorra opened this issue Nov 14, 2019 · 1 comment · Fixed by #15
Closed

fix: run on SHA range for normal push (not only PR) #12

vidavidorra opened this issue Nov 14, 2019 · 1 comment · Fixed by #15

Comments

@vidavidorra
Copy link
Contributor

Currently it seems than when I create e.g three commits locally and push only after the 3rd commit this will only check the last commit.

I don't think the firstParent would be suitable for this since that would check all of the history as far as I understand. Is that right?

I'm not sure whether the information for the commit range that was just pushed is available. As far as the environment variables I don't see anything that has to do with the range. I think something that could work would be the before field of the event (push), which should be available at GITHUB_EVENT_PATH.

I'd be happy to help but don't really know how to develop GitHub actions and most importantly how I could test this so would need to get some getting started on that before I could help.

@wagoid
Copy link
Owner

wagoid commented Nov 23, 2019

Hi @vidavidorra, thank you for the issue! I completely forgot about this scenario 💥

I don't think the firstParent would be suitable for this since that would check all of the history as far as I understand. Is that right?

Actually firstParent does something different: it only checks for commits in the current branch. So for instance, if someone pushes a merge commit, we won't do checks in the commits that came from the merge (e.g. commits from master when you're just syncing with master). So it looks like firstParent option will still work when checking the range 🎉

You're right, we can use the GITHBU_EVENT_PATH to get the before information from the event. Since we use @octokit/github, we can just get the event information in github.context.payload. I did some initial tests and it worked. There's just one edge case that I noticed while testing: before field can point to a commit that doesn't exist when the push is forced, so when the forced field from event is true I will need to get just the latest commit as it was done before.

Regarding testing, currently I just test the changes in another repo and keep pushing changes to test. I will create a setup with better tests but still didn't have time to do that yet.

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