question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sometimes GH Action doesn't see CYPRESS_RECORD_KEY variable

See original GitHub issue

We have a private GitHub repository setup with tests configured to run when a push happens. The action runs both when people create a pull request (e.g. push to a new branch) and when they merge to master. The action is configured with cypress-io/github-action@v2.

Recently we started getting test failures (the workflow is red) because the action can’t record the test results. The test still run fine. The cause is CYPRESS_RECORD_KEY is not set.

Normally I see this in the log:

  env:
    CYPRESS_RECORD_KEY: ***
    GITHUB_TOKEN: ***

But when the failure occurs I see this:

  env:
    CYPRESS_RECORD_KEY: 
    GITHUB_TOKEN: ***

... many lines of test results left out ...

You passed the --record flag but did not provide us your Record Key.

This doesn’t occurs all the time. It looks like the failure occurs on new PRs, while the merges continue to work. It’s the same repository and yml file, so I don’t understand why one would pick up the variable and the other wouldn’t. The changes being tested aren’t around the GH Action workflow.

I am not 100% sure, but this seemed to start with Cypress 9.1.0.

When we first upgraded to 9.1, there was a disconnect between Cypress and GitHub that caused the same issue - failing to record test results. I had to re-add one of our repositories to the Cypress “Installed GitHub Application” for the GH organization. This was strange as we have 2 repos that run cypress and only one of them was missing. This worked, but then I noticed that not all test runs were getting recorded.

BTW, we upgraded to 9.1.1 today and the issue still occurs.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
mellis481commented, Aug 12, 2022

@skjnldsv It’s a Dependabot-thing, not specific to the cypress-io/github-action action. It would affect any Github Actions job/step that relies on an Actions secret when that workflow is triggered by Dependabot.

1reaction
mellis481commented, Aug 12, 2022

Hello! It’s still happening for me I restarted the job and suddenly, it passed magically 🤷

This is because workflows triggered by Dependabot PRs will run with read-only permissions and Dependabot does not currently have access to Actions secrets. This is a result of the change that @bdelavega-maralytix linked. When a workflow is manually triggered (like when you re-ran your job), it will run with the permissions of the user triggering the run.

In my case, my Dependabot-triggered workflow no longer had access to an Actions secret which I was using in my cypress-io/github-action. The solution for me was simple: duplicate the secret as a Dependabot secret which Dependabot-triggered workflows have access to.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

cypress-io/github-action does not accept all environment ...
My problem is, when using cypress-io/github-action, I need to pass some environment variables for my react app to work with Firebase emulator, ...
Read more >
@cypress/github-action - npm
Important. We are getting reports that Cypress has suddenly started crashing when running on ubuntu-latest OS. Seems, GH Actions have ...
Read more >
Setting up super fast Cypress tests on GitHub Actions - PostHog
Cypress has an amazing built in inspector on their test-runner that allows you to identify elements that you would like to add tests...
Read more >
Runtime Variables in GitHub Actions - Microsoft Open Source
One key feature that GitHub Actions has not yet implemented is the ... The run command here checks to see if the COMMIT_VAR...
Read more >
GitHub Actions - Cypress Documentation
You can overwrite the commit message sent to Cypress Cloud by setting an environment variable. See Issue #124 for more details. name: Cypress...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found