cypress-io / cypress-io/github-action

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

Open
#1,272 3 comments 5 reactions 0 assignees View on GitHub
Cypress Cloud type: enhancement
Dominant language
JavaScript
Stars
1.5k
Forks
353
Avg merge
1d 22h
Merged PRs (30d)
27

Description

## 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](https://github.com/cypress-io/github-action/blob/master/README.md#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](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#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

- https://github.com/cypress-io/github-action/issues/1208

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.