actions / create-github-app-token

GitHub Action for creating a GitHub App Installation Access Token
https://github.com/marketplace/actions/create-github-app-token
MIT License
321 stars 46 forks source link

Unable to checkout repo with this action workflow #115

Closed iamatib closed 4 months ago

iamatib commented 4 months ago

I am trying to checkout repo i github enterprise with this workflow, but i am getting the error as Retrieving the default branch name Not Found while i looked some other third party workflows, it worked. eg: https://github.com/peter-murray/workflow-application-token-action

could you please help us here Regards, Atib

gr2m commented 4 months ago

Can you please setup a public repository that reproduces the problem? We can't help you with the information you provided. We use this action ourselves in conjunction with actions/checkout, so it definitely works.

iamatib commented 4 months ago

Hello @gr2m Thanks For you reply. https://github.com/iamatib/checkout-demo/actions

I have setup here, could you please have a look. The github app has "read" permission to all repo's.

I am trying checkout a private repo from the this repo https://github.com/iamatib/checkout-demo

could you please have a look.

Thanks in Advance.

Regards, Atib

gr2m commented 4 months ago

You are trying to checkout iamatib/checkout-test from iamatib/checkout-demo, but the token that gets created only has access to the current repository unless you set owner and/or repositories. In your case, try this

  on: [workflow_dispatch]

  jobs:
    hello-world:
      runs-on: ubuntu-latest
      steps:
        - uses: actions/create-github-app-token@v1
          id: app-token
          with:
            app-id: ${{ vars.APP_ID }}
            private-key: ${{ secrets.PRIVATE_KEY }}
+           repositories: 'checkout-test`
        - name: Checkout Repository
          uses: actions/checkout@v3
          with:
            token: ${{ steps.app-token.outputs.token  }}
            repository: iamatib/checkout-test
iamatib commented 4 months ago

Hello @gr2m

Thank You, I thought when we give permissions for repo's in Github App, it should already be authenticated to run api's. Yeah, now i got it why it was not working.

Will close the Issue.

Regards, Atib

iamatib commented 4 months ago

Hi @gr2m

could we also rotate this private key in timely manner? is the rotation possible ?

Thanks in Advance. Regards, Atib

gr2m commented 4 months ago

is the rotation possible ?

I don't think it's possible to programmatically change a GitHub App's private keys unfortunately. Repository secrets can be rotated though.

iamatib commented 4 months ago

Thank You again..!