From 8d8842ba5266c6f69a4cbf88927d2b338070aab6 Mon Sep 17 00:00:00 2001 From: David Gardner <96306125+dagardner-nv@users.noreply.github.com> Date: Tue, 19 Dec 2023 17:13:37 -0800 Subject: [PATCH] Optionally skip ci based on a label in the pr (#1444) * Adds a `get-pr-info` job at the head of the pipeline which examines the labels on the PR. * If the PR contains the `skip-ci` label, the rest of the jobs in the CI pipeline are skipped. * This avoids the requirement to include `[no ci]` in commit comments. * After the label is removed CI will execute on the next push. Closes #1183 ## By Submitting this PR I confirm: - I am familiar with the [Contributing Guidelines](https://github.com/nv-morpheus/Morpheus/blob/main/docs/source/developer_guide/contributing.md). - When the PR is ready for review, new or existing tests cover these changes. - When the PR is ready for review, the documentation is up to date with these changes. Authors: - David Gardner (https://github.com/dagardner-nv) Approvers: - Michael Demoret (https://github.com/mdemoret-nv) URL: https://github.com/nv-morpheus/Morpheus/pull/1444 --- .github/workflows/pull_request.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 52f513d6f5..b0a799047b 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -42,8 +42,28 @@ permissions: statuses: none jobs: + prepare: + # Executes the get-pr-info action to determine if the PR has the skip-ci label, if the action fails we assume the + # PR does not have the label + name: Prepare + runs-on: ubuntu-latest + container: + image: rapidsai/ci-conda:latest + steps: + - name: Get PR Info + id: get-pr-info + uses: rapidsai/shared-action-workflows/get-pr-info@branch-23.08 + if: ${{ startsWith(github.ref_name, 'pull-request/') }} + outputs: + has_skip_ci_label: ${{ steps.get-pr-info.outcome == 'success' && contains(fromJSON(steps.get-pr-info.outputs.pr-info).labels.*.name, 'skip-ci') || false }} + ci_pipe: + name: CI Pipeline + needs: [prepare] uses: ./.github/workflows/ci_pipe.yml + + # Only run the CI pipeline if the PR does not have the skip-ci label + if: ${{ ! fromJSON(needs.prepare.outputs.has_skip_ci_label) }} with: run_check: ${{ startsWith(github.ref_name, 'pull-request/') }} container: nvcr.io/ea-nvidia-morpheus/morpheus:morpheus-ci-build-230913