github-action
                                
                                 github-action copied to clipboard
                                
                                    github-action copied to clipboard
                            
                            
                            
                        `dashboardUrl` not set in step outputs?
I just enabled recording on Cypress dashboard for my project, but am having trouble printing the dashboardUrl.
It prints at the end of a run (in the Cypress step itself), but when I try to print it in another step it's blank
Cypress step:
  (Run Finished)
       Spec                                              Tests  Passing  Failing  Pending  Skipped  
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✔  smoke.test.ts                            00:14        3        3        -        -        - │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
    ✔  All specs passed!                        00:14        3        3        -        -        -  
───────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                       
  Recorded Run: https://dashboard.cypress.io/projects/xxx/runs/7           
Print step:
Cypress finished with: success
See results at
My configuration
name: Deploy
on:
  pull_request:
    types: [assigned, opened, synchronize, reopened]
jobs:
  build-deploy:
    ...
  smoke-test:
    needs: build-deploy
    runs-on: ubuntu-latest
    name: Smoke test
    timeout-minutes: 5
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Cypress run
        uses: cypress-io/github-action@v2
        id: cypress
        continue-on-error: true
        with:
          command-prefix: yarn dlx # need this bc using yarn pnp w/o node_modules
          install-command: yarn install --immutable --immutable-cache
          build: yarn build-custom
          headless: true
          config: baseUrl=https://env.com/
          spec: cypress/integration/smoke.test.ts
          record: true
        env:
          CYPRESS_PROJECT_ID: xxx
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - name: Print Dashboard URL
        run: |
          echo Cypress finished with: ${{ steps.cypress.outcome }}
          echo See results at ${{ steps.cypress.outputs.dashboardUrl }}
Update: I also tried echo ${{ toJSON(steps.cypress.outputs) }} in my step and it just prints an empty object {}
Update 2: added missing configuration for command-prefix and custom install
Hmm +1 I have the same issue when a command-prefix parameter passed
      - name: Cypress run
        id: cypress
        uses: cypress-io/github-action@v2
        continue-on-error: true
        with:
          env: fileConfig=development
          install: false
          working-directory: e2e
          record: true
          wait-on: yarn e2e:wait
          command-prefix: dotenv-flow -p ../ --
        env:
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Hmm +1 I have the same issue when a command-prefix parameter passed
Same! Realized i was missing my command-prefix in configuration example so i added it.
Same here ➕ 👍 it seems it worked in the past see https://github.com/cypress-io/github-action/pull/166
@jazanne @lmeynberg what is your use-case for this?
Based on the code from #166, I believe it's working as expected - at the end of a run via onTestsFinished (line).
i expect this step to print a link to the dashboard
- name: Print Dashboard URL
        run: |
          echo Cypress finished with: ${{ steps.cypress.outcome }}
          echo See results at ${{ steps.cypress.outputs.dashboardUrl }}
right now it looks like this See results at 
@jazanne that's considered a separate step so the output isn't going to be available there. Have you seen the dashboard link that comes with the Workflow summary (PR #566)?
@admah not sure i understand, typically outputs are available in following steps of the same job
btw, i copied this original snippet from docs, where it seems to indicate that this should be allowed
https://github.com/cypress-io/github-action#outputs
@jazanne this may be a bug. We'll have to look into it a bit more.
Hi @admah, is there a chance to start previous/next versions of action or it's totally surprisingly new from GH itself?
@dzzk yes. Here are the instructions for specifying the version: https://github.com/cypress-io/github-action#explicit-version
Bump! 😄
Was it fixed somehow in some newer versions? @admah
@far11ven
Was it fixed somehow in some newer versions?
It seems to be working fine in cypress-io/github-action@v5. Check out job 7838187516 which shows:

This is a log of running the example workflow .github/workflows/example-recording.yml.
BTW: @admah unassigned himself from this issue. He is no longer a member of cypress-io.
Are you having problems with this?
Also it would be good to hear if @jazanne still considers this to be an issue with the current @v5 version.
@far11ven
You can also try this out for yourself if you have a fork of this repository. Follow the instructions in
@MikeMcC399 Thanks for the quick response, I'm using v5.5.0
`
Cypress Test Result Details
  - name: Print Cypress Cloud URL
    run: |
      echo Cypress finished with: ${{ steps.run_step.outcome }}
      echo Outputs: ${{ steps.run_step.outputs }}
      echo Outputs_JSON: ${{  toJSON(steps.run_step.outputs) }}
      echo See results at ${{ steps.run_step.outputs.dashboardUrl }}
`


@far11ven
Are you setting the record  parameter of cypress-io/github-action to true or are you recording by hand?
Could you expand the arrow in the log to the left of "Run cypress-io/[email protected]"?
In the example, it looks like this:

At the end of the step log "Cypress tests" it logs
"Recorded Run: https://cloud.cypress.io/projects/3tb7jn/runs/2287"
Please check the step where you are calling cypress-io/[email protected] to make sure that you are also seeing "Recorded Run:" logged for your project.
If it is not logged then the step "Print Cypress Cloud URL" will not be able to pick anything up because nothing has been saved.
Thanks for hinting to the solution @MikeMcC399 , which was not obvious at glance when reading brief documentation of this action.
Previous version failed because we were supplying our custom command input which was the culprit of not registering the dashboardUrl and leading to a blank output:
- name: Cypress run
  uses: cypress-io/github-action@v5
  continue-on-error: true
  with:
    command: npm run cy:run:ci -- --parallel --record --env CI=true,url=${{ inputs.url }},market=${{ inputs.market }},appMode=${{ inputs.appMode }},viewport=${{ inputs.viewport }}
  env:
    CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_CLOUD_RECORD_KEY }}
The new version that worked for me and my team:
- name: Cypress run
  uses: cypress-io/github-action@v5
  continue-on-error: true
  with:
    parallel: true
    record: true
    env: ${{ env.CY_ENV }}
  env:
    CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_CLOUD_RECORD_KEY }}
What is NOT OBVIOUS in the docs (at least to me and 2 other devs trying to setup the workflow) is that the action by default executes cypress run command. So we were ought to believe we should pass the custom script from package.json as the command. Allthough it worked like a charm, but it failed to set dashboardUrl. What I believe the issue behind with a custom command is that when passing --record as flag to your command, is not the same as setting the input via record: true.
Do you think this is a bug or intentional?
@Erenndriel
What is NOT OBVIOUS in the docs (at least to me and 2 other devs trying to setup the workflow) is that the action by default executes cypress run command. So we were ought to believe we should pass the custom script from package.json as the command. Allthough it worked like a charm, but it failed to set dashboardUrl. What I believe the issue behind with a custom command is that when passing --record as flag to your command, is not the same as setting the input via record: true.
Do you think this is a bug or intentional?
Many thanks for your feedback! It's good that the hints here led you to finding a solution!
There are some gaps in the documentation concerning:
If you use the action's parameter command: you by-pass some of the functionality of the action. For instance if you look at the log of running example-custom-command.yml in job 4471091715 you will see that there is no summary produced. You can check other action logs which don't use the command: parameter and you'll find that they each have a summary at the bottom of the log.
I will submit a documentation PR to clarify this as I see it as a documentation bug. It could be an enhancement request to set the dashboardUrl if --record is used in a command line passed through the parameter command:. Since the original issue posted here uses the record: parameter and does not use the command: parameter then any further follow-up should go into a new issue.
Appreciate your reply @MikeMcC399 !
I wholeheartedly agree with you that there are gaps in that regard and that a PR to improve such docs would be a time saver for many others who'd stumble upon this inconsistent behavior.
That being said, the custom command can actually be any other command in package.json , say a custom NodeJS script that runs numerous process, one of them being cypress itself. With that in consideration, how can one consider --record flag is the flag for cypress or for another thing that the developers intended to?
E.g.:
- In my package.jsonassume I havemyScript: "node scripts/generateFromTemplate.js".
- Assume I will run this from my CLI: npm run myScript --record.
- The --recordis parsed from the script and applied something completely different, not related tocypresss---recordflag.
- If we were to grab (grep) the --recordflag from thecommand: npm run myScript --record, we are to assume/believe that the developer intended to set Cypress'--recordflag, which in this **case ** is not.
I don't think that it'd be the right direction to assume that --record is meant for Cypress when passed to command input.
@far11ven
Are you setting the
recordparameter ofcypress-io/github-actiontotrueor are you recording by hand? Could you expand the arrow in the log to the left of "Run cypress-io/[email protected]"?In the example, it looks like this:
At the end of the step log "Cypress tests" it logs
"Recorded Run: https://cloud.cypress.io/projects/3tb7jn/runs/2287"
Please check the step where you are calling
cypress-io/[email protected]to make sure that you are also seeing "Recorded Run:" logged for your project.If it is not logged then the step "Print Cypress Cloud URL" will not be able to pick anything up because nothing has been saved.
@MikeMcC399 see the recorded run log, but no dashboard url:

and following is my workflow step:

But my custom command also has --record param in it, let me verify this once after removing it from command, [UPDATE] which resulted in the same :

@far11ven
If you are using command: , then the record: parameter is not used and there is no dashboardUrl saved.
At the end of the step log "Cypress tests" it logs
"Recorded Run: https://cloud.cypress.io/projects/3tb7jn/runs/2287"
Please check the step where you are calling cypress-io/[email protected] to make sure that you are also seeing "Recorded Run:" logged for your project.
If it is not logged then the step "Print Cypress Cloud URL" will not be able to pick anything up because nothing has been saved.
I apologise about the above troubleshooting steps, which are incorrect! The Recorded Run line is output by Cypress, not by the cypress-io/github-action steps.
If you want to follow exactly what happens in your workflow, then add
    env:
      DEBUG: '@cypress/github-action'
to get logging output. If the action is carrying out the recording and remembering the dashboardUrl, you will see something similar to the following at the end of the debug logs:
@cypress/github-action Cypress tests: 0 failed
@cypress/github-action Dashboard url https://cloud.cypress.io/projects/***/runs/169
@cypress/github-action all done, exiting
@Erenndriel
I don't think that it'd be the right direction to assume that --record is meant for Cypress when passed to command input.
You are right. It would not be possible to catch all cases, so it is not a good candidate at all for an enhancement request. Thanks again for your inputs and insight!
- I have made a suggestion to update the README documentation in PR #846.
- ~~Whilst the pull request is still in review mode you can read the suggestion under the link Outputs.~~
@jazanne
Could you let us know if this is still an issue for you? We found one root cause, but I don't know if it covers your case.
@MikeMcC399 yep the issue i'm seeing seems in line with the new docs you added https://github.com/cypress-io/github-action/pull/846 - url not set using custom command.
thanks for looking into this
@jazanne
It's good to hear that we finally worked out what the problem is! Thanks for closing the loop!
Would you like to close your issue now?
Closing since I understand the issue. Would still love to see this changed/supported in the future.
Would still love to see this changed/supported in the future.
I'm guessing that this would need to be an enhancement to Cypress in order to expose / export the Cypress Cloud URL.