danger/kotlin

Could not find pull request information for private repo

eygraber opened this issue · 3 comments

I'm using the docker image with GitHub Actions, and I'm getting a failure, but all the logs say is:

Executing $(which danger) ci --process danger-kotlin --passURLForDSL --failOnErrors --no-publish-check - pid 1
Request failed [403]: https://api.github.com/repos/<me>/<repo>/pulls/<pr number>
Response: {
  "message": "Resource not accessible by integration",
  "documentation_url": "https://docs.github.com/rest/reference/pulls#get-a-pull-request"
}
Error:  
          Could not find pull request information,
          if you are using a private repo then perhaps
          Danger does not have permission to access that repo.
        
Uncaught Kotlin exception: kotlin.Exception: Command $(which danger) ci --process danger-kotlin --passURLForDSL --failOnErrors --no-publish-check exited with code 256
    at 0   danger-kotlin                       0x418785           kfun:systems.danger.cmd.Cmd.exec#internal + 1221 
    at 1   danger-kotlin                       0x419fd8           kfun:systems.danger.cmd.dangerjs.DangerJS#process(systems.danger.cmd.Command;kotlin.String;kotlin.collections.List<kotlin.String>){} + [13](https://github.com/<me>/<repo>/actions/runs/<run>/jobs/<job>#step:4:14)36 
    at 2   danger-kotlin                       0x4170c6           kfun:#main(kotlin.Array<kotlin.String>){} + 1734 
    at 3   danger-kotlin                       0x4231a3           Init_and_run_start + 1811 
    at 4   danger-kotlin                       0x4232da           main + 10 
    at 5   libc.so.6                           0x7fadb04e5d8f     0x0 + [14](https://github.com/<me>/<repo>/actions/runs/<run>/jobs/<job>#step:4:15)0383963995535 
    at 6   libc.so.6                           0x7fadb04e5e3f     __libc_start_main + 127 
    at 7   danger-kotlin                       0x405080           0x0 + 4[21](https://github.com/<me>/<repo>/actions/runs/<run>/jobs/<job>#step:4:22)4912

Here is how I'm using it in my workflow:

      - name: Danger
        uses: docker://ghcr.io/danger/danger-kotlin:1.2.0
        with:
          args: --failOnErrors --no-publish-check
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Have you checked if your bot account have access to the repo? Is the repo public or private? If private you may want to invite the bot account as collaborator and you should be good to go

I think this was due to GitHub Actions issues.

Looks like this is happening for a public repo now if a PR was opened by someone who isn't a collaborator - https://github.com/eygraber/gradle-conventions/actions/runs/5328997751/jobs/9655007811