You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which is pretty basic. The goal is to run this on master after a pull request is merged. It does find the lastest commit on master (be3c9f9), as seen here:
From https://github.com/...
* branch be3c9f9d09e54097321f92f452923a91435b63ac -> FETCH_HEAD
/usr/bin/git branch --list --remote origin/master
/usr/bin/git tag --list master
Removed matchers: 'checkout-git'
##[error]A branch or tag with the name 'master' could not be found
##[error]Node run failed with exit code 1
We also tried tying it explicitly to master, like this:
Now, I thought ref: master was the default behaviour. The fact that I had to explicitly use ref: master makes me think this is a bug. I will wait til someone confirms in order to close this.
changed the title [-]checkout@v2: A branch or tag with the name 'master' could not be found[/-][+]Checkout fails on pull request closed event[/+]on Jan 13, 2020
Master is only the default if it's checking out another repository, I think. Otherwise it defaults to whatever triggered the event.
From the README:
# The branch, tag or SHA to checkout. When checking out the repository that# triggered a workflow, this defaults to the reference or SHA for that event.# Otherwise, defaults to `master`.
But the readme also gives this as the recipe for checking out a closed pull request, which seems wrong:
@jwnx, I think your workaround is going to run into race conditions if there's another push to master in the meantime. We just run things on push to master, which I think should achieve the same result? Unless you don't want to run if someone pushes straight to master and only for merged pull requests for some reason?
on:
push:
branches: [master]
I am experiencing the same error in a slightly different context though (apologies if this should be in a different issue). Our automation force pushes to a PR branch before merging and this triggers another run of the workflow, which fails with that same error message because the PR is already closed (e.g. https://github.com/google/iree/runs/395655503). Could the handling for closed pull requests be better overall?
Is there a way to get the action to always check out a valid commit, or abort if the PR has already been closed? (We run the relevant things on pushes to master anyway).
Activity
jwnx commentedon Jan 11, 2020
I was able to solve this by using:
Now, I thought
ref: masterwas the default behaviour. The fact that I had to explicitly useref: mastermakes me think this is a bug. I will wait til someone confirms in order to close this.[-]checkout@v2: A branch or tag with the name 'master' could not be found[/-][+]Checkout fails on pull request closed event[/+]ericsciple commentedon Jan 13, 2020
Updated title
Explicitly checkout master ref
GMNGeoffrey commentedon Jan 17, 2020
Master is only the default if it's checking out another repository, I think. Otherwise it defaults to whatever triggered the event.
From the README:
But the readme also gives this as the recipe for checking out a closed pull request, which seems wrong:
on: pull_request: branches: [master] types: [opened, synchronize, closed] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2@jwnx, I think your workaround is going to run into race conditions if there's another push to master in the meantime. We just run things on push to master, which I think should achieve the same result? Unless you don't want to run if someone pushes straight to master and only for merged pull requests for some reason?
I am experiencing the same error in a slightly different context though (apologies if this should be in a different issue). Our automation force pushes to a PR branch before merging and this triggers another run of the workflow, which fails with that same error message because the PR is already closed (e.g. https://github.com/google/iree/runs/395655503). Could the handling for closed pull requests be better overall?
Is there a way to get the action to always check out a valid commit, or abort if the PR has already been closed? (We run the relevant things on pushes to master anyway).
haya14busa commentedon Jan 19, 2020
+1. I think a correct workaround is to use
github.ref.I hope it will be solved by default though.
GMNGeoffrey commentedon Jan 22, 2020
Thanks for fixing. The spurious status failures have gone away.