From 950aac1cce215b4cac4c86eec8a8ab5964bacbe7 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 24 Jul 2024 18:33:29 -0300 Subject: [PATCH] ci: update CI workflow to include new job 'set-ci-condition' (#2933) chore(ci.yml): refactor CI workflow to include a new job 'set-ci-condition' to determine if CI should run based on conditions such as pull request labels and event type Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com> --- .github/workflows/ci.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d771807d0..256df594f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,9 +25,16 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + jobs: + set-ci-condition: + name: Should Run CI + runs-on: ubuntu-latest + outputs: + should-run-ci: ${{ (contains( github.event.pull_request.labels.*.name, 'lgtm') && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') }} path-filter: - if: ${{ (contains( github.event.pull_request.labels.*.name, 'lgtm') && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') }} + needs: set-ci-condition + if: ${{ needs.set-ci-condition.outputs.should-run-ci }} name: Filter Paths runs-on: ubuntu-latest @@ -78,13 +85,13 @@ jobs: # https://github.com/langchain-ai/langchain/blob/master/.github/workflows/check_diffs.yml ci_success: name: "CI Success" - needs: [test-backend, test-frontend, lint-backend, test-docs-build] + needs: [test-backend, test-frontend, lint-backend, test-docs-build, set-ci-condition ] if: always() runs-on: ubuntu-latest env: JOBS_JSON: ${{ toJSON(needs) }} RESULTS_JSON: ${{ toJSON(needs.*.result) }} - EXIT_CODE: ${{!contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && '0' || '1'}} + EXIT_CODE: ${{!contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && needs.set-ci-condition.outputs.should-run-ci == 'true' && '0' || '1'}} steps: - name: "CI Success" run: |