Skip to content

support: Is GitHub app-based token allowed to publish to external repository? #1135

@HarshadDGhorpade-eaton

Description

@HarshadDGhorpade-eaton

Checklist

  • I am using the latest version of this action.
  • I have read the latest README and followed the instructions.
  • I have read the latest GitHub Actions official documentation and learned the basic spec and concepts.

Describe your question

I came across a situation while using this action where while publishing results to external repository I was getting below error:

/usr/bin/git push origin gh-pages
remote: Write access to repository not granted.
fatal: unable to access 'https://github.com/username/repository.git/': The requested URL returned error: 403
Error: Action failed with "The process '/usr/bin/git' failed with exit code 128"

I have gone through action's README for this known issue, still I spent quite some time figuring out what I was doing wrong.
eventually I found out that the token I was using to checkout repository (which will be published with this action) was gh app generated token and I was using my PAT in action to publish to gh pages, so I had to change the checkout action to use my PAT instead and then actions was able to publish.

so while publishing to external repository, checkout and publish both needs to use PAT only it seems, not sure if this is again a known thing but this should be mentioned in that known issue section.

my question is that whether such gh app based token can be used for this action? because we're prohibited from using PATs anymore in our CI workflows.

Relevant links

Public repository: private repo
YAML config:
YAML workflow:

    - name: Checkout gh-pages repo
      uses: actions/checkout@v4
      with:
        repository: org/repo
        token: ${{ steps.get_app_based_token.outputs.token }}
        #token: ${{ secrets.PAT }} 
        ref: gh-pages
        path: gh-pages

    - name: Deploy reports to remote repo in Github Pages
      uses: peaceiris/actions-gh-pages@v4
      with:
        publish_dir: allure-history 
        external_repository: org/repo
        publish_branch: gh-pages
        #personal_token: ${{ secrets.PAT }}
        github_token: ${{ steps.get_app_based_token.outputs.token }}

Relevant log output

No response

Additional context.

No response

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions