Open sabuto opened 4 years ago
i'm having the same issue
For anyone suffering this issue, this might be the actions/checkout@v2
to blame. The default setting for checkout
cannot work with push
. To make them work together, you need to specify following parameters for checkout
:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
@magodo Thanks for this, I am now getting
Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
! [rejected] HEAD -> master (fetch first)
Push to branch master
error: failed to push some refs to '***github.com/sabuto/bot-test2.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
This makes no sense as i have pulled the latest version when i run the workflow, any ideas?
@Sabuto , add force: true
, but you should understand what that message mean in Git due risk of data loss.
Are you sure you set the fetch-depth to 0? I have this issue because of that.
Thanks for this guys! and thanks for the fast responses :) i am happy for this to be closed as it works for me but will let you decide as the other haven't commented.
@magodo
I am unable to set persist-credentials
and fetch-depth
as parameters under checkout.
I'm setting it like so:
- uses: actions/checkout@master
persist-credentials: false
fetch-depth: 0
i get this error:
- Your workflow file was invalid: The pipeline is not valid. .github/workflows/update.yml (Line: 17, Col: 7): Unexpected value 'persist-credentials',.github/workflows/update.yml (Line: 18, Col: 7): Unexpected value 'fetch-depth'
@organizejs , missing with
. Let's try:
- uses: actions/checkout@master
with:
persist-credentials: false
fetch-depth: 0
Thanks guys, that worked for me. But I get (together with my own commit) a second commit which is something like
Merge abc1743 into cde9725
Again, it seems that checkout/v2
does this.
Another solution is to simple declare the branch you want to checkout:
- uses: actions/checkout@master
with:
ref: ${{ github.event.pull_request.head.ref }}
But I get (together with my own commit) a second commit which is something like
Merge abc1743 into cde9725
Again, it seems that
checkout/v2
does this.
I've got the same issue with merge commit. Related: #20.
Ok, I may be being really dumb here but
I get permission denied
my workflow file:
I have the psa key setup in the repo that is triggering the workflow
which is a personal access token with all rights.