Github Actions + Cypress + Branch deploys

I am trying to setup a Github Actions workflow that will run Cypress tests on PR’s and pushes to master and develop branches. I was able to set everything up to work as expected for PR’s using the deploy preview URL. However, when pushing to a branch, Netlify creates a branch deploy that uses a Netlify GUID and I am not sure how to anticipate this inside of the Github Actions workflow.

I know that I can access the branch deploy using the branch name but then I wouldn’t be able to ensure that I am testing the latest build.

One way I can think of working around this issue is to turn off the Github builds option on Netlify and use a Github Action to deploy the branch instead – then I can make the deploy job a dependency before running the tests but I wanted to see if anybody had another solution.

Here is my workflow code that is working nicely for PR’s:

      - uses: cypress-io/github-action@v2
          CYPRESS_baseUrl: 'https://deploy-preview-${{ github.event.number }}--${{ }}'
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          working-directory: ${{ matrix.working_directory }}
          wait-on: 'https://deploy-preview-${{ github.event.number }}--${{ }}'
          wait-on-timeout: 300

Hiya @BenM ,

When the deploy completes, you can find the ID (for instance using our API, Netlify API documentation) and then fire off the action based on the URL you build from it, no?

I don’t use GitHub actions so am not sure how flexible they are, but I would assume you wait on the deploy to finish before testing anyway, so then you have the URL, since we’ll return it after the deploy finishes.