Add an option to log output to file
Context
I'm using Cypress Cloud and what I want is that for each test run, a link to the Cypress Cloud run should be included somewhere in the PR.
We could do this by setting up a Github Action that comments the link in the PR - but how to get the link?
We can grep it from std out - the bit that says: Recorded Run: https://cloud.cypress.io/projects/xyz/runs/16, but how to get access to this?
I could log it to file:
- name: Execute Cypress
uses: cypress-io/github-action@v6
with:
command: npx cypress run | tee cypress-output.log
wait-on: http://localhost:8080
record: true
The problem with this is that it that the additional commands (--record) will be tacked on to tee not npx.
What would be nice if you can add an option like:
output_log: 'cypress-output.log'
That will also record std out as a file.
@dwjohnston
The action does not include any functionality to write to a PR. This would be out of scope for the action itself.
Have you considered using the Cypress Cloud Source Control Integration for GitHub? Since the code for this function is not part of the action, it is not demonstrated in this repo.
You can see it in action in the Cypress Documentation repo. Just take a look at any of the open pull requests there https://github.com/cypress-io/cypress-documentation/pull
The combination of options command and record are not supposed to work the way you describe, with --record being added on to tee. If you are seeing that in action version >=6.9.0 that would be a bug, as record should be ignored if command is used. See Custom test command.
The action does return the resultsUrl and it is available in GitHub Action jobs. See Outputs
- Your original suggestion was also added to https://github.com/cypress-io/github-action/issues/1058. Just noting here for cross-reference.