From 602f6c63f34aa3978a74124d6997765b608f6b5f Mon Sep 17 00:00:00 2001 From: shaokeyibb Date: Thu, 18 Jul 2024 22:55:06 +0800 Subject: [PATCH] ci: run only when file change --- .../workflows/deploy-cloudflare-workers.yml | 20 +++++++++++++++-- .../publish-python-markdown-extension.yml | 22 ++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-cloudflare-workers.yml b/.github/workflows/deploy-cloudflare-workers.yml index 515bd613..b77f0830 100644 --- a/.github/workflows/deploy-cloudflare-workers.yml +++ b/.github/workflows/deploy-cloudflare-workers.yml @@ -4,13 +4,29 @@ on: push: tags: - "*" - paths: - - cloudflare-workers/** workflow_dispatch: jobs: + changes: + runs-on: ubuntu-latest + # Required permissions + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + src: ${{ steps.filter.outputs.src }} + steps: + # For pull requests it's not necessary to checkout the code + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + src: + - 'cloudflare-workers/**' deploy: name: Deploy + needs: changes + if: ${{ needs.changes.outputs.src == 'true' }} runs-on: ubuntu-latest defaults: run: diff --git a/.github/workflows/publish-python-markdown-extension.yml b/.github/workflows/publish-python-markdown-extension.yml index c0a46edc..a1067469 100644 --- a/.github/workflows/publish-python-markdown-extension.yml +++ b/.github/workflows/publish-python-markdown-extension.yml @@ -3,14 +3,30 @@ name: Publish python-markdown-extension to Pypi on: push: tags: - - '*' - paths: - - python-markdown-extension/** + - "*" workflow_dispatch: jobs: + changes: + runs-on: ubuntu-latest + # Required permissions + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + src: ${{ steps.filter.outputs.src }} + steps: + # For pull requests it's not necessary to checkout the code + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + src: + - 'python-markdown-extension/**' publish: name: Publish + needs: changes + if: ${{ needs.changes.outputs.src == 'true' }} runs-on: ubuntu-latest defaults: run: