From ed9663bebda6cb35debcf2d431a7991d1a769c0e Mon Sep 17 00:00:00 2001 From: alafanechere Date: Fri, 23 Feb 2024 09:02:04 +0100 Subject: [PATCH] connectors-ci: early exit when no connector changes --- .github/workflows/connectors_tests.yml | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/connectors_tests.yml b/.github/workflows/connectors_tests.yml index 5742084201766..8cd907140caba 100644 --- a/.github/workflows/connectors_tests.yml +++ b/.github/workflows/connectors_tests.yml @@ -22,7 +22,45 @@ on: - opened - synchronize jobs: + changes: + runs-on: ubuntu-latest + outputs: + connectors: ${{ steps.changes.outputs.connectors }} + permissions: + statuses: write + steps: + - name: Checkout Airbyte + if: github.event_name != 'pull_request' + uses: actions/checkout@v3 + - id: changes + uses: dorny/paths-filter@v2 + with: + # Note: expressions within a filter are OR'ed + filters: | + connectors: + - '*' + - 'airbyte-ci/**/*' + - 'airbyte-integrations/connectors/**/*' + - 'airbyte-cdk/**/*' + - 'buildSrc/**/*' + # The Connector CI Tests is a status check emitted by airbyte-ci + # We make it pass once we have determined that there are no changes to the connectors + - name: "Skip Connectors CI tests" + if: steps.changes.outputs.connectors != 'true' && github.event_name == 'pull_request' + run: | + curl --request POST \ + --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \ + --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + --header 'content-type: application/json' \ + --data '{ + "state": "success", + "context": "Connectors CI tests", + "target_url": "${{ github.event.workflow_run.html_url }}" + }' \ + connectors_ci: + needs: changes + if: needs.changes.outputs.connectors == 'true' name: Connectors CI runs-on: connector-test-large timeout-minutes: 1440 # 24 hours