ad-m / github-push-action

GitHub actions to push back to repository eg. updated code
MIT License
1.21k stars 230 forks source link

How to correctly set token #41

Closed yammyxing closed 4 years ago

yammyxing commented 4 years ago

I'd like to push to my another repo

My action looks like this below:

...
- name: Commit files
      working-directory: ./dist
      run: |
        git config --local user.email "action@github.com"
        git config --local user.name "GitHub Action"
        git commit -m "update blog" -a
    - name: Push changes as deploy
      uses: ad-m/github-push-action@master
      with:
        github_token: ${{ secrets.PUSH_SECRET_FOR_ACTION }}
        force: true
        repository: "me.github.io"

And my repo's secret looks like this which value is from Personal Access Token: image

But finally Got this: image

I've also read this related issue about How to set GITHUB_TOKEN

But I still failed. Is there sth I've been misunderstanding ? Hope to get an answer, thanks.

ad-m commented 4 years ago

Let's try following:

    - name: Push changes as deploy
      uses: ad-m/github-push-action@master
      with:
        github_token: ${{ secrets.push_secret_for_action }}
        force: true
        repository: "me.github.io"
yammyxing commented 4 years ago

image Did like what you said, still got this like above.

Is there sth wrong? Confused

sorpdev commented 4 years ago

Did you add the secret in the repo in which you have the workflow? (github.com/.../.../settings/secrets)

yammyxing commented 4 years ago

Did you add the secret in the repo in which you have the workflow? (github.com/.../.../settings/secrets)

thx. It works