JamesIves/github-pages-deploy-action

remote: Permission denied to github-actions[bot]

lixiaofa opened this issue · 1 comments

Describe the bug

The action fails after Starting to commit changes… with the error message:
Error: The deploy step encountered an error: The process '/usr/bin/git' failed with exit code 128 ❌

Reproduction Steps

Happens with this workflow : https://github.com/lixiaofa/fast-plus/actions/runs/6096383739/workflow
This is the part of the workflow definition that concerns the action:
`

  • name: Deploy
    uses: JamesIves/github-pages-deploy-action@v4.3.4
    with:
    token: ${{ secrets.GITHUB_TOKEN }}
    branch: gh-pages
    folder: docs/.vitepress/dist
    git-config-name: lixiaofa
    git-config-email: 15999673889@163.com
    commit-message: website deploy
    `

Logs

This is the related part of the log.
`
Checking configuration and starting deployment… 🚦
Deploying using Deploy Token… 🔑
Configuring git…
/usr/bin/git config --global --add safe.directory /home/runner/work/fast-plus/fast-plus
/usr/bin/git config user.name lixiaofa
/usr/bin/git config user.email 15999673889@163.com
/usr/bin/git config core.ignorecase false
/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
Unable to unset previous git config authentication as it may not exist, continuing…
/usr/bin/git remote rm origin
/usr/bin/git remote add origin ***github.com/lixiaofa/fast-plus.git
Git configured… 🔧
Starting to commit changes…
/usr/bin/git ls-remote --heads ***github.com/lixiaofa/fast-plus.git refs/heads/gh-pages
cb0ccc3ce06e7ff52c42d1cdd28a184f186add1d refs/heads/gh-pages
Creating worktree…
/usr/bin/git fetch --no-recurse-submodules --depth=1 origin gh-pages
From https://github.com/lixiaofa/fast-plus

  • branch gh-pages -> FETCH_HEAD
  • [new branch] gh-pages -> origin/gh-pages
    /usr/bin/git worktree add --no-checkout --detach github-pages-deploy-action-temp-deployment-folder
    Preparing worktree (detached HEAD cb0ccc3)
    /usr/bin/git checkout -B gh-pages origin/gh-pages
    Switched to a new branch 'gh-pages'
    branch 'gh-pages' set up to track 'origin/gh-pages'.
    /usr/bin/chmod -R +rw /home/runner/work/fast-plus/fast-plus/docs/.vitepress/dist
    /usr/bin/rsync -q -av --checksum --progress /home/runner/work/fast-plus/fast-plus/docs/.vitepress/dist/. github-pages-deploy-action-temp-deployment-folder --delete --exclude CNAME --exclude .ssh --exclude .git --exclude .github
    Checking if there are files to commit…
    /usr/bin/git add --all .
    /usr/bin/git checkout -b github-pages-deploy-action/3s9y6w7sv
    Switched to a new branch 'github-pages-deploy-action/3s9y6w7sv'
    /usr/bin/git commit -m website deploy --quiet --no-verify
    Force-pushing changes...
    /usr/bin/git push --force ***github.com/lixiaofa/fast-plus.git github-pages-deploy-action/3s9y6w7sv:gh-pages
    remote: Permission to lixiaofa/fast-plus.git denied to github-actions[bot].
    fatal: unable to access 'https://github.com/lixiaofa/fast-plus.git/': The requested URL returned error: 403
    Running post deployment cleanup jobs… 🗑️
    /usr/bin/git checkout -B github-pages-deploy-action/3s9y6w7sv
    Reset branch 'github-pages-deploy-action/3s9y6w7sv'
    /usr/bin/chmod -R +rw github-pages-deploy-action-temp-deployment-folder
    /usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
    Error: The deploy step encountered an error: The process '/usr/bin/git' failed with exit code 128 ❌
    Notice: Deployment failed! ❌

Warning: The set-output command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
`

Workflow

https://github.com/lixiaofa/fast-plus/actions/runs/6096383739/workflow

Do you have the following in your workflow? There's a section in the readme around giving permission to the runner. You can either add something to the workflow or change a setting in the repository, otherwise you'll potentially run into this.

If you do not supply the action with an access token or an SSH key, you must access your repositories settings and provide Read and Write Permissions to the provided GITHUB_TOKEN, otherwise you'll potentially run into permission issues. Alternatively you can set the following in your workflow file to grant the action the permissions it needs.

permissions:
  contents: write

Can you verify that you've provided the GITHUB_TOKEN read/write permissions in the abcense of that permissions property in your workflow?