-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail gracefully if GITHUB_TOKEN
is set with non-working permissions
#1272
Comments
This is a topic for the Cypress Cloud team. |
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: permissions:
id-token: write # This is required for requesting the JWT (OIDC with AWS)
contents: read # This is required for actions/checkout We get the Unable to fetch related PR data for commit: 'xxx': RequestError [HttpError]: Resource not accessible by integration
at /home/runner/work/_actions/cypress-io/github-action/v6/dist/index.js:41021:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async detectPrNumber (/home/runner/work/_actions/cypress-io/github-action/v6/dist/index.js:98218:22)
at async runTests (/home/runner/work/_actions/cypress-io/github-action/v6/dist/index.js:98489:3) {
status: 403, headers: {
vary: 'Accept-Encoding, Accept, X-Requested-With',
'x-accepted-github-permissions': 'pull_requests=read',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
} According to the GitHub headers (which are extremely informative) the fix was adding the permissions:
id-token: write # This is required for requesting the JWT (OIDC with AWS)
contents: read # This is required for actions/checkout
pull-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 ( permissions:
id-token: write # This is required for requesting the JWT (OIDC with AWS)
contents: read # This is required for actions/checkout
pull-requests: read # This is required for Cypress run
actions: 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! |
|
What would you like?
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: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.
Other
Related issues
The text was updated successfully, but these errors were encountered: