From e8dd3654d5f362649ba24ca2954878122460cf65 Mon Sep 17 00:00:00 2001 From: Roy Golan Date: Sun, 30 Jan 2022 09:54:33 +0200 Subject: [PATCH] Allow skipping CI for draft PR or WIP label Save resources and needless CI runs by skipping the trigger-gitlab job if a PR is 'draft' (can be set in the pull request page at any time) or by setting a label "WIP". Asside from saving resources, WIP PRs that don't trigger CI are a good message to a contributers to keep testing it locally and to only get the project resources after serious testing been made on their side. --- .github/workflows/trigger-gitlab.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/trigger-gitlab.yml b/.github/workflows/trigger-gitlab.yml index 2bc3924e5..e75462e14 100644 --- a/.github/workflows/trigger-gitlab.yml +++ b/.github/workflows/trigger-gitlab.yml @@ -40,6 +40,7 @@ jobs: runs-on: ubuntu-latest env: SCHUTZBOT_SSH_KEY: ${{ secrets.SCHUTZBOT_SSH_KEY }} + SKIP_CI: ${{ github.event.pull_request.draft == true || contains(github.event.pull_request.labels.*.name, 'WIP') }} steps: - name: Clone repository uses: actions/checkout@v2.4.0 @@ -60,4 +61,5 @@ jobs: git checkout -b PR-${{ github.event.pull_request.number }} fi - git push -f ci + [[ "${SKIP_CI}" == true ]] && PUSH_OPTION="-o ci.skip" || PUSH_OPTION="" + git push -f ci "${PUSH_OPTION}"