jeffreytse / jekyll-deploy-action

🪂 A Github Action to deploy the Jekyll site conveniently for GitHub Pages.
MIT License
344 stars 47 forks source link

`with.repository` parameter is unable to access external repository: "The requested URL returned error: 403" #68

Closed cwboden closed 1 year ago

cwboden commented 1 year ago

Use Case

I am attempting to use jekyll-deploy-actions for the following use case:

Workflow Definition

Here is the definition of my GitHub workflow (from the private repository), which is configured according to the README:

name: Deploy Github Pages

on:
    push:
        branches:
            - main
        paths:
            - .github/workflows/build-jekyll.yml
            - Website/**

jobs:
    build-and-deploy:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v2

            - uses: jeffreytse/jekyll-deploy-action@master
              with:
                  branch: main
                  provider: github
                  repository: cwboden/website
                  token: ${{ secrets.GITHUB_TOKEN }}

When this Workflow runs, it completes the build / bundling process successfully, but fails when attempting to push to my public repo:

remote: Permission to cwboden/website.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/cwboden/website.git/': The requested URL returned error: 403

I initially thought this was a problem with the secrets.GITHUB_TOKEN, so I also added a PAT to the repository under the secret GH_TOKEN (as outlined in the README): image

However, I end up with the same error :cry: I'm curious if the with.repository parameter is only supported by SSH authentication?

Other Troubleshooting Attempts

I also tried a few other things, such as replacing the with.token parameter with $GH_TOKEN (though then the build step cannot complete), using a Legacy GitHub PAT rather than the granular ones, and by removing the authorization headers, according to this Stack Overflow post.

None of these have helped, though I can update this section as I continue troubleshooting the problem. My next step will be to take a look at how GH_TOKEN is used within the plugin source code. Perhaps I'm missing something there.

jeffreytse commented 1 year ago

Hi @cwboden

Thanks for the issue, for your case, you should follow below steps:

Thanks & Regards

cwboden commented 1 year ago

Thanks for the prompt response! Looks like this one was user error -- I must have misconfigured my PAT token so that it didn't have the correct permissions. I walked through your steps above and everything is working now. Appreciate the help!