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 issue #44

Open
sabuto opened this issue Jan 29, 2020 · 11 comments
Open

Push issue #44

sabuto opened this issue Jan 29, 2020 · 11 comments

Comments

@sabuto
Copy link

sabuto commented Jan 29, 2020

Ok, I may be being really dumb here but

image

I get permission denied

my workflow file:

name: CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
      name: Main Checkout

    - uses: actions/checkout@v2
      name: Secondary Checkout
      with:
        repository: sabuto/bot-test2
        path: bot-test2

    - name: move file to other repo
      run: \cp -Rv .github/sabubot.yml bot-test2/.github/sabubot.yml

    - name: commit to local
      run: |
        cd bot-test2
        git config --local user.email "robe_dunne@hotmail.com"
        git config --local user.name "sabuto"
        git add .
        git commit -m "Add changes"

    - name: Push changes
      uses: ad-m/github-push-action@master
      with:
        github_token: ${{ secrets.GITHUB_PSA }}
        repository: sabuto/bot-test2

I have the psa key setup in the repo that is triggering the workflow
image

which is a personal access token with all rights.

@robot-o
Copy link

robot-o commented Feb 1, 2020

i'm having the same issue

@magodo
Copy link

magodo commented Feb 4, 2020

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

@sabuto
Copy link
Author

sabuto commented Feb 4, 2020

@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?

@ad-m
Copy link
Owner

ad-m commented Feb 4, 2020

@sabuto , add force: true, but you should understand what that message mean in Git due risk of data loss.

@magodo
Copy link

magodo commented Feb 4, 2020

Are you sure you set the fetch-depth to 0? I have this issue because of that.

@sabuto
Copy link
Author

sabuto commented Feb 4, 2020

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.

dougch added a commit to dougch/github-push-action that referenced this issue Feb 14, 2020
These two lines are critical to the function of the Action, please add to the readme so the fix in ad-m#44 doesn't get lost.
@organizejs
Copy link

organizejs commented Feb 22, 2020

@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'

@ad-m
Copy link
Owner

ad-m commented Feb 23, 2020

@organizejs , missing with. Let's try:

    - uses: actions/checkout@master
      with:
         persist-credentials: false
         fetch-depth: 0

smaillet added a commit to UbiquityDotNET/Llvm.NET that referenced this issue Feb 24, 2020
@StefMa
Copy link

StefMa commented Feb 26, 2020

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 }}

tsvi added a commit to py-libhdate/py-libhdate that referenced this issue Mar 1, 2020
* fix: when updating changlelog push back to pull request

As noted here ad-m/github-push-action#38, by default
the push is done to the master branch. As master is locked down, the push should
be done to the pull requests branch

* fix: Try by specifying ref on checkout as found in github comment

ref: ad-m/github-push-action#44 (comment)

* fix: add request to persist credentials when checking out

* Use fetch-depth set to 0

* Move back to use bumpversion

* Don't run pre commit on auto generated files

* WIP: recreate auto deployment
ZPYin added a commit to ZPYin/COVID-19_Visualizer that referenced this issue Mar 19, 2020
fix the error thrown by GitHub Push actions.
See reference here: ad-m/github-push-action#44
wpscholar added a commit to wpscholar/satis that referenced this issue Apr 15, 2020
dougch added a commit to dougch/github-push-action that referenced this issue May 26, 2020
These two lines are critical to the function of the Action, please add to the readme so the fix in ad-m#44 doesn't get lost.
ad-m pushed a commit that referenced this issue May 26, 2020
These two lines are critical to the function of the Action, please add to the readme so the fix in #44 doesn't get lost.
matthewfeickert added a commit to scikit-hep/pyhf that referenced this issue May 31, 2020
#884)

* Update github-push-action to v0.6.0
* Use 'persist-credentials: false' to allow github-push-action to push to master with a personal access token
   - ad-m/github-push-action#44
   - ad-m/github-push-action#46
@kenorb
Copy link

kenorb commented Jul 13, 2020

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.

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

No branches or pull requests

7 participants