From e4ef059d1930ab45b1b938f0b702a019cca2de60 Mon Sep 17 00:00:00 2001 From: Yoni Bettan Date: Fri, 7 Jan 2022 09:48:52 +0200 Subject: [PATCH] ci: requiring the 'ok-to-test' label for running some workflows As of now, the 'e2e-k3s' workflow will require the 'ok-to-test' label in order to get triggered. In addition to that, on each change to the PR on the relevant files, Github will remove the label from it and it will be required again. Signed-off-by: Yoni Bettan --- .github/workflows/{e2e.yaml => e2e-k3s.yaml} | 6 +++++- .github/workflows/remove-label.yaml | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) rename .github/workflows/{e2e.yaml => e2e-k3s.yaml} (95%) create mode 100644 .github/workflows/remove-label.yaml diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e-k3s.yaml similarity index 95% rename from .github/workflows/e2e.yaml rename to .github/workflows/e2e-k3s.yaml index e39de533ce..5719f169bd 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e-k3s.yaml @@ -1,7 +1,8 @@ -name: e2e-k8s +name: e2e-k3s on: pull_request: + types: [labeled] paths: - 'pkg/query-service/**' - 'frontend/**' @@ -10,6 +11,7 @@ jobs: image-build-and-push-query-service: runs-on: ubuntu-latest + if: ${{ github.event.label.name == 'ok-to-test' }} steps: - name: Checkout code uses: actions/checkout@v2 @@ -31,6 +33,7 @@ jobs: image-build-and-push-frontend: runs-on: ubuntu-latest + if: ${{ github.event.label.name == 'ok-to-test' }} steps: - name: Checkout code uses: actions/checkout@v2 @@ -61,6 +64,7 @@ jobs: deploy-on-k3s-cluster: runs-on: ubuntu-latest + if: ${{ github.event.label.name == 'ok-to-test' }} needs: - image-build-and-push-query-service - image-build-and-push-frontend diff --git a/.github/workflows/remove-label.yaml b/.github/workflows/remove-label.yaml new file mode 100644 index 0000000000..427cf9017d --- /dev/null +++ b/.github/workflows/remove-label.yaml @@ -0,0 +1,20 @@ +name: remove-label + +on: + pull_request: + types: [synchronize] + paths: + - 'pkg/query-service/**' + - 'frontend/**' + +jobs: + remove: + runs-on: ubuntu-latest + steps: + - name: Remove label + uses: buildsville/add-remove-label@v1 + with: + label: ok-to-test + type: remove + token: ${{ secrets.REPO_ACCESS_TOKEN }} +