diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index fac4bb133b1..3fbe1e2f460 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -9,12 +9,26 @@ on: workflow_dispatch: # allows you to trigger manually jobs: - detect-ci-trigger: - name: detect ci trigger + skip-duplicate-jobs: runs-on: ubuntu-latest if: | github.repository == 'pydata/xarray' && (github.event_name == 'push' || github.event_name == 'pull_request') + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v3.4.1 + with: + # For workflows which are triggered concurrently with the same + # contents, attempt to execute them exactly once. + concurrent_skipping: 'same_content_newer' + paths_ignore: '["**/doc/**"]' + detect-ci-trigger: + name: detect ci trigger + runs-on: ubuntu-latest + needs: skip-duplicate-jobs + if: ${{ needs.skip-duplicate-jobs.outputs.should_skip != 'true' }} outputs: triggered: ${{ steps.detect-trigger.outputs.trigger-found }} steps: @@ -115,7 +129,8 @@ jobs: doctest: name: Doctests runs-on: "ubuntu-latest" - if: github.repository == 'pydata/xarray' + needs: skip-duplicate-jobs + if: ${{ needs.skip-duplicate-jobs.outputs.should_skip != 'true' }} defaults: run: shell: bash -l {0} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 447507ad25f..28e36c47e26 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,12 +9,27 @@ on: workflow_dispatch: # allows you to trigger manually jobs: - detect-ci-trigger: - name: detect ci trigger + skip-duplicate-jobs: runs-on: ubuntu-latest if: | github.repository == 'pydata/xarray' && (github.event_name == 'push' || github.event_name == 'pull_request') + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v3.4.1 + with: + # For workflows which are triggered concurrently with the same + # contents, attempt to execute them exactly once. + concurrent_skipping: 'same_content_newer' + paths_ignore: '["**/doc/**"]' + + detect-ci-trigger: + name: detect ci trigger + needs: skip-duplicate-jobs + if: ${{ needs.skip-duplicate-jobs.outputs.should_skip != 'true' }} + runs-on: ubuntu-latest outputs: triggered: ${{ steps.detect-trigger.outputs.trigger-found }} steps: @@ -110,6 +125,8 @@ jobs: event_file: name: "Event File" + needs: skip-duplicate-jobs + if: ${{ needs.skip-duplicate-jobs.outputs.should_skip != 'true' }} runs-on: ubuntu-latest steps: - name: Upload diff --git a/.github/workflows/publish-test-results.yaml b/.github/workflows/publish-test-results.yaml index a2e02c28f5a..ea429d360c5 100644 --- a/.github/workflows/publish-test-results.yaml +++ b/.github/workflows/publish-test-results.yaml @@ -9,10 +9,30 @@ on: - completed jobs: + + skip-duplicate-jobs: + runs-on: ubuntu-latest + if: | + github.repository == 'pydata/xarray' + && (github.event_name == 'push' || github.event_name == 'pull_request') + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v3.4.1 + with: + # For workflows which are triggered concurrently with the same + # contents, attempt to execute them exactly once. + concurrent_skipping: 'same_content_newer' + paths_ignore: '["**/doc/**"]' + publish-test-results: name: Publish test results runs-on: ubuntu-latest - if: github.event.workflow_run.conclusion != 'skipped' + needs: skip-duplicate-jobs + if: | + needs.skip-duplicate-jobs.outputs.should_skip != 'true' + && github.event.workflow_run.conclusion != 'skipped' steps: - name: Download and extract artifacts