Reputation: 42464
I have 2 repos: user/ext-private and user/ext-public. I want to push some files to public repo but its failing with following error:
[master 869955c] update it
1 file changed, 1 insertion(+), 1 deletion(-)
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
remote: Permission to user/ext-public.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/user/ext-public/': The requested URL returned error: 403
Error: Process completed with exit code 128.
Here is my action:
name: Master Branch
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
cache: 'yarn'
- run: yarn
- name: Checkout Public repo
uses: actions/checkout@v2
with:
repository: user/ext-public
path: ext-public
ref: 'master'
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Update file
run: |
git config -l
echo "Hello you!" >> README.md
git config --global user.name 'GithubUser'
git config --global user.email '[email protected]'
git add .
git commit -m "update it"
git status
git push -u origin HEAD
working-directory: ext-public
See the error log here https://github.com/coure2011/ext_code/runs/5548688844?check_suite_focus=true
Upvotes: 1
Views: 1448
Reputation: 23160
The problem is that you're using the GITHUB_TOKEN (which has a specific permission scope) instead of a PAT (Personal Access Token).
You can't push to another repo using the GITHUB_TOKEN, you'll need a PAT to do so.
There are also many actions from the marketplace to perform the push operation for you, after adding the PAT as a secret.
Upvotes: 2