You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fail gracefully if GITHUB_TOKEN is set with non-working permissions #1272
If GITHUB_TOKEN is passed to the action when recording to Cypress Cloud and permissions are restricted, the workflow may fail with an error such as:
Unable to fetch related PR data for commit: '46a72ff9cd29aeaa59f536eee6c008e3ffbcf56d': RequestError [HttpError]: Resource not accessible by integration
Make the error message more user friendly, including suggestions on how to remedy.
Possibly also allow the workflow to continue with reduced functionality.
Why is this needed?
As documented in the README Automatic PR number and URL detection, if the GITHUB_TOKEN is set when recording to Cypress Cloud, PR information is extracted.
Restrictive permissions for the GITHUB_TOKEN can however have been set in the enterprise, organization, repository or workflow which prevent this working.
Users are sometimes confronted with this error and do not know what to do.
According to the GitHub headers (which are extremely informative) the fix was adding the pull-requests: read permission:
permissions:
id-token: write # This is required for requesting the JWT (OIDC with AWS)contents: read # This is required for actions/checkoutpull-requests: read # This is required for Cypress run
After that, the same ERROR, but no context in the logs anymore
After some investigation by updating the permissions, I found the required one (actions: write):
permissions:
id-token: write # This is required for requesting the JWT (OIDC with AWS)contents: read # This is required for actions/checkoutpull-requests: read # This is required for Cypress runactions: write # This is required for Cypress run
Now I have the job result
I hope it will help to anyone 🎉
PS: let's like the #1273 Issue to provide documentation update!
Reacted by Anna, Volodymyr Starodubov and Ivan Kolodrivskyi
Activity
MikeMcC399 commentedon Oct 21, 2024
This is a topic for the Cypress Cloud team.
VolodymyrSmahliuk commentedon Jan 16, 2025
I'm not sure where to publish my findings, but this issue seems to be related.
When working with Cypress Test in Parallel mode, we faced the permissions issue. I'm going to list the error and appropriate permissions to fix
(FYI, we have the next GitHub Repository Workflow permissions)
The basic GitHub Actions permissions were:
We get the
Resource not accessible by integrationERROR with additional context:According to the GitHub headers (which are extremely informative) the fix was adding the
pull-requests: readpermission:After that, the same ERROR, but no context in the logs anymore
After some investigation by updating the permissions, I found the required one (
actions: write):Now I have the job result
I hope it will help to anyone 🎉
PS: let's like the #1273 Issue to provide documentation update!
MikeMcC399 commentedon Jan 16, 2025
@VolodymyrSmahliuk
GITHUB_TOKENsettings - Cypress Cloud recording #1273?