From 6db77b75889cc74969af1a99c4fb17d2237e7a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 16 Sep 2024 17:44:08 +0300 Subject: [PATCH 1/9] Rename build-and-push-image job to docker --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index a824dcc1b5..09170b5e92 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -19,7 +19,7 @@ env: TEST_IMAGE: plextraktsync:ci-test jobs: - build-and-push-image: + docker: runs-on: ubuntu-latest permissions: contents: read From 19d6be066226cb3d98d5ec0d020e2fce25f569f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 16 Sep 2024 17:38:22 +0300 Subject: [PATCH 2/9] Add automerge job workflow Taken from eventum repo: - https://github.com/eventum/eventum/blob/62dd272fe61cb9d2cdc2a6fb3c597d86418b0580/.github/workflows/ci.yml --- .github/workflows/automerge.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/automerge.yml diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 0000000000..977d2766da --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,23 @@ +on: + workflow_call: + secrets: + github-token: + required: true + +jobs: + # https://github.com/fastify/github-action-merge-dependabot + automerge: + name: Dependabot auto-merge + runs-on: ubuntu-20.04 + + permissions: + pull-requests: write + contents: write + + steps: + - uses: fastify/github-action-merge-dependabot@v3.0.0 + if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }} + with: + github-token: ${{ secrets.github-token }} + +# vim:ft=yaml:et:ts=2:sw=2 From c8b40ac638c943d1f2954fdd55cb7bfdba5b1432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 16 Sep 2024 17:42:53 +0300 Subject: [PATCH 3/9] Configure needs for automerge --- .github/workflows/automerge.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 977d2766da..7a79542f07 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -1,14 +1,14 @@ on: - workflow_call: - secrets: - github-token: - required: true + pull_request: jobs: # https://github.com/fastify/github-action-merge-dependabot automerge: name: Dependabot auto-merge runs-on: ubuntu-20.04 + needs: + - docker + - test permissions: pull-requests: write From 2ca36da864c8ce99c7d268cb1e30c0ffa174e19a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 16 Sep 2024 17:46:00 +0300 Subject: [PATCH 4/9] Auto-merge only minor version updates --- .github/workflows/automerge.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 7a79542f07..4bb39388ad 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -18,6 +18,7 @@ jobs: - uses: fastify/github-action-merge-dependabot@v3.0.0 if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }} with: + target: minor github-token: ${{ secrets.github-token }} # vim:ft=yaml:et:ts=2:sw=2 From 9635d01faa3b4a5d811118794731844a731848eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 16 Sep 2024 17:48:24 +0300 Subject: [PATCH 5/9] Remove name for test job This way all jobs use the snake case --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7fb85ef6d4..a4a8c5f5eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,6 @@ env: jobs: test: runs-on: ubuntu-latest - name: Test steps: - name: Check out source repository uses: actions/checkout@v4 From c2dc2cc85b65be68da329c39061c0ef2a12140b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 16 Sep 2024 17:54:43 +0300 Subject: [PATCH 6/9] Switch docker and test jobs to use workflow dispatch Needed to have automerge on same pipeline --- .github/workflows/automerge.yml | 8 ++++---- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ .github/workflows/docker-image.yml | 12 +++++------- .github/workflows/test.yml | 2 +- 4 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 4bb39388ad..436e257cc7 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -1,14 +1,14 @@ on: - pull_request: + workflow_call: + secrets: + github-token: + required: true jobs: # https://github.com/fastify/github-action-merge-dependabot automerge: name: Dependabot auto-merge runs-on: ubuntu-20.04 - needs: - - docker - - test permissions: pull-requests: write diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..9d381229e7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +on: + push: + branches: + - main + tags: + - "*.*.*" + pull_request: + +jobs: + docker: + uses: ./.github/workflows/docker-image.yml + secrets: + github-token: ${{ secrets.GITHUB_TOKEN }} + + test: + uses: ./.github/workflows/test.yml + + automerge: + uses: ./.github/workflows/automerge.yml + needs: + - docker + - test + secrets: + github-token: ${{ secrets.GITHUB_TOKEN }} + +# vim:ft=yaml:et:ts=2:sw=2 diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 09170b5e92..2a931d1d97 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -6,12 +6,10 @@ name: Publish Docker image on: - push: - branches: - - main - tags: - - "*.*.*" - pull_request: + workflow_call: + secrets: + github-token: + required: true env: REGISTRY: ghcr.io @@ -51,7 +49,7 @@ jobs: with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ secrets.github-token }} - name: Extract metadata (tags, labels) for Docker id: meta diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a4a8c5f5eb..a10f937fa6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Test on: - - pull_request + workflow_call: env: DEFAULT_PYTHON: 3.8 From 106a03b92de3deeeea6836fcab82d713e4abeedb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 16 Sep 2024 18:01:36 +0300 Subject: [PATCH 7/9] Add name for ci job --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d381229e7..59c82fdec6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,5 @@ +name: "CI" + on: push: branches: From 3507fadc5b8f6d5a26aeed2946da709f37b6d4cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 16 Sep 2024 18:04:08 +0300 Subject: [PATCH 8/9] Move dependabot if to job level --- .github/workflows/automerge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 436e257cc7..e7ede14fa8 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -9,6 +9,7 @@ jobs: automerge: name: Dependabot auto-merge runs-on: ubuntu-20.04 + if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }} permissions: pull-requests: write @@ -16,7 +17,6 @@ jobs: steps: - uses: fastify/github-action-merge-dependabot@v3.0.0 - if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }} with: target: minor github-token: ${{ secrets.github-token }} From 89a4c8187c2484e1ebcc7325c35f83d88100fb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 16 Sep 2024 18:08:43 +0300 Subject: [PATCH 9/9] Run test job only on pull request --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59c82fdec6..42b9b2ac19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: test: uses: ./.github/workflows/test.yml + if: ${{ github.event_name == 'pull_request' }} automerge: uses: ./.github/workflows/automerge.yml