github-action icon indicating copy to clipboard operation
github-action copied to clipboard

Document `GITHUB_TOKEN` settings - Cypress Cloud recording

Open MikeMcC399 opened this issue 1 year ago • 3 comments

What would you like?

Document the necessary permission settings for GITHUB_TOKEN.

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 may prevent this working.

Other

Related issues

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

MikeMcC399 avatar Oct 03 '24 06:10 MikeMcC399

@tbiethman

  • Can you provide any assistance on this? It's a result of https://github.com/cypress-io/github-action/pull/1009 and I'm not sure that I understand the whole story yet, so I'm trying to reverse engineer it.
  • I don't know exactly what circumstances permissions are needed. In a test with all permissions disabled (permissions: {}) recording was successful. From reports of other users I know that this is not always the case.

MikeMcC399 avatar Oct 04 '24 10:10 MikeMcC399

This is a topic for the Cypress Cloud team.

MikeMcC399 avatar Oct 21 '24 08:10 MikeMcC399

Additional permissions should be documented:

permissions:
  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

I published the detailed fixes in (https://github.com/cypress-io/github-action/issues/1272#issuecomment-2595090790). I applied that on my system to run the Cypress Job on GitHub Actions. Please, consider it when writing the documentation.

VolodymyrSmahliuk avatar Jan 16 '25 11:01 VolodymyrSmahliuk