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.

Using with on: [deployment_status]

See original GitHub issue

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

image

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:closed
  • Created 3 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
chinchangcommented, May 13, 2021

The following approach is lot better -> https://twitter.com/mikenikles/status/1272138850333327360?s=20 Works with push/pull event

1reaction
bahmutovcommented, Jun 25, 2020

I 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SCCM Application Deployment Status Using SQL Query ...
In this post, you will learn how to make a working Application Deployment SQL query to find the deployment status from your configuration ......
Read more >
Query to get the Deployment Status of an application - SCCM ...
Hi,. Do we have any query/report to get the detailed status report & machine name, user name of a deployment in sccm 2012...
Read more >
How to query Deployment Details in Deployment Status? Is it ...
In 2021, the query is available using tooling API: SELECT Id, Status, StartDate, CompletedDate FROM DeployRequest.
Read more >
Deployment Status for Custom Objects and ... - Salesforce Help
Use the Deployment Status setting in the object definition to control when users can see and use the object and its associated custom...
Read more >
DeploymentStatus (AWS SDK for Java - 1.12.346)
Returns an array containing the constants of this enum type, in the order they are declared. ... InProgress. public static final DeploymentStatus InProgress ......
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