Skip to content

Push to restricted master branch #26460

Answered by Yanjingzhu
pgruetter asked this question in Actions
Discussion options

You must be logged in to vote

Hi @pgruetter , 

Organization administrators, repository administrators, and users with the Maintain role can always push to a protected branch. 

If you are repository administrators , you could use your personal access token to push changes.  You could store it in secrets. Please remember adding persist-credentials: false to checkout@v2.  

There is my workflow yml example for push with PAT: 

jobs:
  job1:
    name: push
    runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
  with:
    persist-credentials: false
- name: Create local changes
  run: |
   touch $(hexdump -n 16 -v -e '/1 "%02X"' -e '/16 "\n"' /dev/urandom).yml
   git add --all
  working-directory: data/comments/3DACF5…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants