Resource not accessible by integration when using Github App token #69154
Replies: 3 comments 3 replies
-
The error message "Resource not accessible by integration" typically occurs when the GitHub App token does not have the necessary permissions to access the requested resource. In your case, you are trying to create a repository_dispatch event using a GitHub App token for an organization. The error suggests that the token does not have the required permissions to access the repository or perform the requested action. To resolve this issue, you need to ensure that the GitHub App has the appropriate permissions and access to the repository. Here are a few steps you can follow: Verify GitHub App permissions: Additionally, the error message you received suggests that the resource you are trying to access is not found. Make sure to double-check the repository name and API endpoint in your curl command. The https://api.github.com/repos/unipoll/gollum-test/dispatches endpoint you provided should be valid if the repository exists, but it's worth confirming the repository name and organization. |
Beta Was this translation helpful? Give feedback.
-
Okay, I figured it out. I tried manually generating a JWT token and then using it to generate app installation token, and managed to trigger a repository. (Guess this is a good way to check the app permissions) As always, I missed a small detail which caused all the trouble. The actions/create-github-app-token by default only generates a token for the current repository. To generate a token for all repositories it's important to specify owner, i.e. steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PEM }}
# Set the owner, so the token can be used in all repositories
owner: ${{ github.repository_owner }} @glauccoslima, thank you for the help, your reply might be useful for other people ! |
Beta Was this translation helpful? Give feedback.
-
@mike-pisman |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Bug
Body
Hi,
I am trying to create a
repository_dispatch
event using GitHub App token for organization. The idea is to run a workflow which will trigger a workflow in another repository. Both repos are public and located in the same organization. The GitHub app has access to all public repositories. Worth menthioning, that I use a self hosted action runner controller(arc-runner-k8s
), which is authenticated with the same app credentials. According to this article, I have set app permissions to allow repository dispatch requests. In repository permissions: contents: read and write, actions: read and write , metadata: read only.When running the workflow I get the error
Resource not accessible by integration
. The workflow works with PAT token, but not with token generated using the app credentialsPermission screenshot
App settings page
Workflow file
Beta Was this translation helpful? Give feedback.
All reactions