Can't access Dependabot alerts API via GitHub Action default token #60612
Replies: 3 comments
-
I've set up a minimal reproduction public repository in https://github.com/laughedelic/dependabot-alerts-gha-access:
|
Beta Was this translation helpful? Give feedback.
-
My UnderstandingThe default According to the docs, in order to list events for Dependabot alerts for a repository:
Since Actions is a GitHub App (just a special one owned by GitHub), and Non-PAT WorkaroundA potential non-PAT approach is described here:
TroubleshootingIf you go this route, or just want to verify what permissions might be going wrong in the current scenario, you can follow this section of the troubleshooting doc and examine the value of the |
Beta Was this translation helpful? Give feedback.
-
I am running into the same problem when trying to access
This is either not working as intended or the GitHub documentation is wrong. |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Bug
Body
Context
I'm trying to access the
/repos/{owner}/{repo}/dependabot/alerts
API endpoint from GitHub Actions in a private (internal) repositorySteps to reproduce
Here is a minimal workflow to reproduce it:
What happens
This fails with the message:
Expectation
This call to the API should work because the Actions token has enough permissions. According to the linked documentation:
I've tried setting
security-events: write
permission in the workflow, but that didn't help.Also, according to the announcement:
I don't know if this applies to GitHub Actions, but I also tried adding explicit
contents: write
permissions, which didn't help.Even with the broadest
permissions: write-all
, it doesn't work and fails with the same error.What else I have tried
I tried running
gh auth status
to check that the token is passed to the CLI correctly:I tried using GraphQL API (adding to the last step):
It didn't fail, but returned an empty result:
I tried using a PAT with broad access to the repository. It works as expected.
This is not a solution, because providing such PAT as secret at the org level is a security concern and requires consumers of the reusable workflow to access this secret explicitly.
Question
Since the documentation doesn't mention anything special about GitHub Actions and explicitly says that a token with the right permissions should have access, I assume that this is a bug or an unintentional limitation. Am I missing something? Is it a known bug? Is there any kind of configuration that would allow the intended usage ?
Beta Was this translation helpful? Give feedback.
All reactions