peaceiris / actions-gh-pages

GitHub Actions for GitHub Pages 🚀 Deploy static files and publish your site easily. Static-Site-Generators-friendly.
https://github.com/marketplace/actions/github-pages-action
MIT License
4.53k stars 361 forks source link

support: can an application token be used to deploy? #1054

Closed btrautmann closed 5 months ago

btrautmann commented 5 months ago

Checklist

Describe your question

The README clearly outlines the ability to use GITHUB_TOKEN, a deploy key, or SSH key for deploying. I'm wondering if I could use a short-lived application token (installed/configured for the repo) to deploy? I've tried a few different approaches but none seem to work and I can't find any questions asking the same.

Relevant links

Our repository is private so can't be linked to.

Relevant log output

One of two errors happens depending on configuration:

  1. Action failed with "The process '/usr/bin/git' failed with exit code 1"
  2. Action failed with "The generated GITHUB_TOKEN (github_token) does not support to push to an external repository. Use deploy_key or personal_token."

Additional context.

We're using the following to get the app token:

      - name: Get application token
        id: get_token
        uses: getsentry/action-github-app-token@97c9e23528286821f97fba885c1b1123284b29cc #v2.0.0
        with:
          app_id: ${{ secrets.APP_ID }}
          private_key: ${{ secrets.PRIVATE_KEY }}
peaceiris commented 5 months ago

Did you follow the next instruction?

https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-deploy-to-external-repository-external_repository

Note that GITHUB_TOKEN has no permission to access to external repositories. Please create a personal access token and set it to personal_token like personal_token: ${{ secrets.PERSONAL_TOKEN }}.

We need to pass our personal access token or GitHub App token to personal_token.

btrautmann commented 5 months ago

Did you follow the next instruction?

https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-deploy-to-external-repository-external_repository

Note that GITHUB_TOKEN has no permission to access to external repositories. Please create a personal access token and set it to personal_token like personal_token: ${{ secrets.PERSONAL_TOKEN }}.

We need to pass our personal access token or GitHub App token to personal_token.

I did try passing it to personal_token but it didn't work. I'll try again and loop back here with an update. Thanks for responding!

btrautmann commented 5 months ago

Ah, an internal tool is actually blocking the push, so it's on our end. It seems personal_token works as expected. Thanks!

github-actions[bot] commented 5 months ago

This issue has been LOCKED because of it being resolved!

The issue has been fixed and is therefore considered resolved. If you still encounter this or it has changed, open a new issue instead of responding to solved ones.

Log | Bot Usage