Using with on: [deployment_status]
See original GitHub issueOur app is continuously deployed using Vercel. Every commit of every pull request is being deployed, so I want our Cypress tests to run against this deployment. For that reason, our test workflow is not triggered by push
or pull_request
, but by deployment_status
. But we still want to create a commit status on the pull request at then end. Our workflow file is currently looking like this:
name: End-to-end tests
on: [deployment_status]
jobs:
cypress-run:
runs-on: ubuntu-latest
if: ${{ github.event.deployment_status.state == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: debug
uses: hmarr/debug-action@master
env:
TEST_URL: ${{ github.event.deployment_status.target_url }}
- name: Cypress run
id: cypress
uses: cypress-io/github-action@v1
# Continue the build in case of an error, as we need to set the
# commit status in the next step, both in case of success and failure
continue-on-error: true
with:
spec: cypress/integration/happy.spec.js
record: true
env: base_url=${{ github.event.deployment_status.target_url }}
ci-build-id: ${{ github.sha }}
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Action does not set commit/pull reques status automatically, because it
# is not triggered by the `push` event. So we have to set the commit
# status manually.
- name: Create commit status
uses: octokit/request-action@v2.x
id: create_status
with:
route: POST /repos/:repository/statuses/:sha
repository: ${{ github.repository }}
sha: ${{ github.sha }}
context: test
description: Cypress run
state: ${{ steps.cypress.outcome}}
target_url: https://dashboard.cypress.io/projects/4nc4rv/runs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
And setting the status works as expected:

But I would like to set the target_url
to the actual run URL, e.g. https://dashboard.cypress.io/projects/4nc4rv/runs/11/specs. But I cannot find a way to know that URL, because I don’t know the run number 11
in the create_status
step.
GitHub Actions support setting outputs for that purpose:
https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter. If cypress-io/github-action
knows the run URL, could you set it to an output parameter?
Related question: Branch
is currently undefined
in our runs: https://dashboard.cypress.io/projects/4nc4rv/runs/11/specs, I guess the reason is that the build is not triggered by push
or pull_request
. Is there a way to set the branch name manually from my side?
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (8 by maintainers)
The following approach is lot better -> https://twitter.com/mikenikles/status/1272138850333327360?s=20 Works with
push/pull
eventI mean - yes, it is passed correctly. But I think allowing the step to fail, and yet running a step after that is better than
continue_on_error
.