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

Force pushes use the incorrect base commit SHA #4

Open
sean-krail opened this issue Apr 8, 2020 · 5 comments
Open

Force pushes use the incorrect base commit SHA #4

sean-krail opened this issue Apr 8, 2020 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@sean-krail
Copy link
Contributor

sean-krail commented Apr 8, 2020

When force pushing a branch, the identified base commit is the old commit, rather than the shared parent commit.

For example in the commit graph below, A is the parent commit, B is the old commit, and C is the new, force-pushed commit after reverting B. When the force-push is performed, this action is using B as the base commit when it should be using A.

A
| \
B  C
@sean-krail sean-krail added the bug Something isn't working label Apr 8, 2020
@sean-krail sean-krail added the help wanted Extra attention is needed label May 22, 2020
@Felixoid
Copy link

Felixoid commented Jun 14, 2020

Hello, Sean.

I don't use your action but found it during my own experiment with my own simple reimplementation.

You could use github.base_ref object, together with github.head_ref they show both PR branches. You could take a look on https://github.com/Felixoid/actions-experiments/runs/770562022?check_suite_focus=true, step Set up Python

Here is a PoC https://github.com/Felixoid/actions-experiments/blob/3b27f9d08189af993b735444df9d7b277383bd65/.github/workflows/tests.yml

@sean-krail
Copy link
Contributor Author

Hi @Felixoid, it seems that github.base_ref and github.head_ref are only set on pull_request events and not push events. Also, I'd like to avoid refs (dynamic) entirely and only use commit SHAs (static).

@DanRunfola
Copy link

Dutifully reporting this issue, as the error message told me to!
https://github.com/wmgeolab/gbRelease/runs/1157617181?check_suite_focus=true

Base commit: a9b4c09cbe8c8d42ed18b1f7ab1f9599853df82c Head commit: 6c3b733f1417748503aa609ec4a11e0d6a025ca1 Error: The head commit for this pull_request event is not ahead of the base commit. Please submit an issue on this action's GitHub repo.

Oddly (?) the action appears to have worked just fine, detecting the files it needed despite the error. Of course because it throws an error it kills the job, as expected, but before death I happen to be printing the output and it looks right.

@spaceemotion
Copy link

We're experiencing the same issue even without force pushes. We had to revert using this package.

@JessiBrix
Copy link

JessiBrix commented Jan 26, 2021

I have the same issue now - without force pushes. If I use this on a push on master, it works without problems. If I have a pull request to master, this error shows up and the job is killed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants