How do I run Github Actions in the `deployment_status` event but only for the QAS Branch?

Asked

Viewed 26 times

-3

I need github actions to run only on the QAS branch and with deployment_event. At the moment I’m implementing in this way

name: Cypress

on: [deployment_status]

jobs:
  e2e:
    if: github.event.deployment_status.state == 'success'
    runs-on: ubuntu-latest

    steps:
      - name: Print URL
        run: echo Testing URL ${{ github.event.deployment_status.target_url }}

      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Node.js
        uses: actions/setup-node@v2-beta
        with:
          node-version: 14

      - name: Install modules
        run: yarn

      - name: Run Cypress
        uses: cypress-io/github-action@v2
        with:
          record: true
          parallel: true
        env:
          CYPRESS_BASE_URL: ${{ github.event.deployment_status.target_url }}
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

I tried that way, but it didn’t work. Here he takes into consideration the deployment_status branch independent:

name: Cypress

on:
  deployment_status:
    pull_request:
      branches:
        - qas
    push:
      branches:
        - qas

jobs:
  e2e:
    ...
  • What is the error message? For me the script looks ok.

  • It doesn’t send any messages, it just runs across all branches. I’m testing the develop branch and it still runs. The idea would be to run only on QAS.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.