Run Maestro flow only then Run-Maestro label is present in a PR (#1852)

* Run Maestro only when the `Run-Maestro` label is present in a PR.
This commit is contained in:
Jorge Martin Espinosa 2023-11-22 15:45:52 +01:00 committed by GitHub
parent 202173c8e3
commit 8b5538ef7e

View file

@ -1,11 +1,10 @@
name: Maestro name: Maestro
# Run this flow only on pull request, and only when the pull request has been approved, to limit our usage of maestro cloud. # Run this flow only on pull request, and only when the pull request has the Run-Maestro label, to limit our usage of maestro cloud.
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-when-a-pull-request-is-approved
on: on:
workflow_dispatch: workflow_dispatch:
pull_request_review: pull_request:
types: [submitted] types: [labeled]
# Enrich gradle.properties for CI/CD # Enrich gradle.properties for CI/CD
env: env:
@ -16,7 +15,7 @@ jobs:
maestro-cloud: maestro-cloud:
name: Maestro test suite name: Maestro test suite
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.review.state == 'approved' || github.event_name == 'workflow_dispatch' if: github.event_name == 'workflow_dispatch' || github.event.label.name == 'Run-Maestro'
strategy: strategy:
fail-fast: false fail-fast: false
# Allow one per PR. # Allow one per PR.
@ -24,6 +23,11 @@ jobs:
group: ${{ format('maestro-{0}', github.ref) }} group: ${{ format('maestro-{0}', github.ref) }}
cancel-in-progress: true cancel-in-progress: true
steps: steps:
- name: Remove Run-Maestro label
if: ${{ github.event.label.name == 'Run-Maestro' }}
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: Run-Maestro
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
# Ensure we are building the branch and not the branch after being merged on develop # Ensure we are building the branch and not the branch after being merged on develop