cypress-io / github-action

GitHub Action for running Cypress end-to-end & component tests
https://on.cypress.io/guides/continuous-integration/github-actions
MIT License
1.36k stars 339 forks source link

Fail gracefully if `GITHUB_TOKEN` is set with non-working permissions #1272

Open MikeMcC399 opened 2 weeks ago

MikeMcC399 commented 2 weeks ago

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:

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.

Other

Related issues

MikeMcC399 commented 1 day ago

This is a topic for the Cypress Cloud team.