From 307f61774e2f498441064961096ecb7acae05417 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Thu, 1 Feb 2024 20:32:43 +0100 Subject: [PATCH 1/6] Specify build concurrency --- .github/workflows/docs.yml | 11 +++++++++-- .github/workflows/main.yml | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 83aafc639..8b72b038a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,9 +1,16 @@ name: Build docs on: - push: - branches: ["master", "docs"] workflow_dispatch: + push: + branches: [ master ] + pull_request: + types: [opened, synchronize] + merge_group: +# Cancel builds if a new commit is pushed, except on master +concurrency: + group: ${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} # Gives the workflow permissions to clone the repo and create a page deployment permissions: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ed26638c4..cf7428a79 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,6 +7,10 @@ on: pull_request: types: [opened, synchronize] merge_group: +# Cancel builds if a new commit is pushed, except on master +concurrency: + group: ${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} jobs: qodana: From bf26e1a29364f1e50f1cc97f324f72bca75d666e Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Thu, 1 Feb 2024 20:41:36 +0100 Subject: [PATCH 2/6] Only upload docs on master --- .github/workflows/docs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8b72b038a..40e677410 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -86,6 +86,7 @@ jobs: uses: actions/configure-pages@v2 - name: Upload artifact uses: actions/upload-pages-artifact@v1 + if: github.ref == 'refs/heads/master' with: path: dir - name: Deploy to GitHub Pages From 43038e1f548f3ea8579d06408d8bc58635b93ac8 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Thu, 1 Feb 2024 20:45:18 +0100 Subject: [PATCH 3/6] Move if statement --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 40e677410..22d88cd24 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -73,6 +73,7 @@ jobs: # Requires the build results needs: build runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' steps: - name: Download artifact uses: actions/download-artifact@v3 @@ -86,7 +87,6 @@ jobs: uses: actions/configure-pages@v2 - name: Upload artifact uses: actions/upload-pages-artifact@v1 - if: github.ref == 'refs/heads/master' with: path: dir - name: Deploy to GitHub Pages From 8f58eb655106a90d894fc56d986d9c656ca312a9 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Tue, 6 Feb 2024 21:34:16 +0100 Subject: [PATCH 4/6] Trigger CI? --- .github/workflows/docs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 22d88cd24..6daf47b1a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,5 +1,6 @@ name: Build docs +# See main.yml on: workflow_dispatch: push: From 8c8a8609d41de7538be7125587d5db8951a30f61 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Tue, 6 Feb 2024 21:43:53 +0100 Subject: [PATCH 5/6] Add workflow to concurrency group --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6daf47b1a..7b045fce0 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,7 +10,7 @@ on: merge_group: # Cancel builds if a new commit is pushed, except on master concurrency: - group: ${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} # Gives the workflow permissions to clone the repo and create a page deployment From 7617d4e5b2722a3d2fc080ee2362cec5b2b48220 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Tue, 6 Feb 2024 21:45:57 +0100 Subject: [PATCH 6/6] Add pull request to concurrency group --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7b045fce0..458f1fd8f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,7 +10,7 @@ on: merge_group: # Cancel builds if a new commit is pushed, except on master concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} # Gives the workflow permissions to clone the repo and create a page deployment