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
# Run this flow only on pull request, and only when the pull request has been approved, 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
# 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.
on:
workflow_dispatch:
pull_request_review:
types: [submitted]
pull_request:
types: [labeled]
# Enrich gradle.properties for CI/CD
env:
@@ -16,7 +15,7 @@ jobs:
maestro-cloud:
name: Maestro test suite
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:
fail-fast: false
# Allow one per PR.
@@ -24,6 +23,11 @@ jobs:
group: ${{ format('maestro-{0}', github.ref) }}
cancel-in-progress: true
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
with:
# Ensure we are building the branch and not the branch after being merged on develop