From 4104f8385e3d30baa39311530b0ecb2c8fb24a60 Mon Sep 17 00:00:00 2001 From: Falk Puschner Date: Wed, 15 Nov 2023 11:03:58 +0100 Subject: [PATCH 1/4] :art: Force automerge as admin (#199) * :art: Force automerge as admin * :lipstick: Make linter happy * :truck: Rename admin variable to force * :art: Change default type for force * :memo: Add force documentation * :memo: Add hint for prrotection rules * :memo: Only run if the PR is created * :arrow_down: More explanation for force merge --- .github/workflows/template_automerge_dependabot.yml | 12 +++++++++++- README.md | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/template_automerge_dependabot.yml b/.github/workflows/template_automerge_dependabot.yml index e2c1d3e7..e3e79f6d 100644 --- a/.github/workflows/template_automerge_dependabot.yml +++ b/.github/workflows/template_automerge_dependabot.yml @@ -3,6 +3,11 @@ name: Dependabot Auto-Merge on: workflow_call: + inputs: + force: + default: false + required: false + type: boolean secrets: app_id: required: true @@ -35,7 +40,12 @@ jobs: if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' run: | gh pr review --approve "$PR_URL" - gh pr merge --auto --merge "$PR_URL" + + if [ ${{ inputs.force }} == 'true' ]; then + gh pr merge "$PR_URL" --merge --admin + else + gh pr merge --auto --merge "$PR_URL" + fi env: PR_URL: ${{ github.event.pull_request.html_url }} GITHUB_TOKEN: ${{ steps.get_token.outputs.token }} diff --git a/README.md b/README.md index 77e0a440..1b80538a 100644 --- a/README.md +++ b/README.md @@ -29,15 +29,24 @@ In this section you can find examples of how to use template workflows. For more The action can be used to auto-merge a dependabot PR with minor and patch updates. The action is called by creating a PR. It is necessary that the repository is enabled for auto-merge. +Afterward the PR will be merged with the help of the merge queue if all required conditions of the repository are fulfilled. + +⚠️ You can also force a merge of a PR. This means that the PR will immediately be merged. +If you want to enable the force merge, make sure that the app can bypass any protection rules. ```yml name: Enable Dependabot Auto-Merge -on: pull_request +on: + pull_request: + types: [opened] jobs: dependabot: uses: Staffbase/gha-workflows/.github/workflows/template_automerge_dependabot.yml@v3.2.0 + with: + # optional: ⚠️ only enable the force merge if you want to do the merge just now + force: true secrets: # identifier of the GitHub App for authentication app_id: ${{ }} From 21e4203e448155d8aa363f09f4e5e28fce240fc3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 11:08:02 +0100 Subject: [PATCH 2/4] :memo: update readme versions (#201) Co-authored-by: flaxel --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 1b80538a..288c43ea 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ on: jobs: : - uses: Staffbase/gha-workflows/.github/workflows/template_*.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_*.yml@v3.3.0 with: ... ``` @@ -43,7 +43,7 @@ on: jobs: dependabot: - uses: Staffbase/gha-workflows/.github/workflows/template_automerge_dependabot.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_automerge_dependabot.yml@v3.3.0 with: # optional: ⚠️ only enable the force merge if you want to do the merge just now force: true @@ -72,7 +72,7 @@ on: jobs: autodev: - uses: Staffbase/gha-workflows/.github/workflows/template_autodev.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_autodev.yml@v3.3.0 with: # optional: base branch from which the history originates, default: main base: master @@ -113,7 +113,7 @@ on: [ push ] jobs: gitops: - uses: Staffbase/gha-workflows/.github/workflows/template_gitops.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_gitops.yml@v3.3.0 with: # optional: list of build-time variables docker-build-args: | @@ -169,7 +169,7 @@ on: jobs: jira_annotate: - uses: Staffbase/gha-workflows/.github/workflows/template_jira_tagging.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_jira_tagging.yml@v3.3.0 with: # optional: name of the service to add as label, default: name of the repository name: 'component name' @@ -201,7 +201,7 @@ on: jobs: ld_code_references: - uses: Staffbase/gha-workflows/.github/workflows/template_launchdarkly_code_references.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_launchdarkly_code_references.yml@v3.3.0 with: # optional: key of the LD project, default: default project-key: 'my-project' @@ -229,7 +229,7 @@ on: jobs: update_release_draft: - uses: Staffbase/gha-workflows/.github/workflows/template_release_drafter.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_release_drafter.yml@v3.3.0 with: # optional: name of the release name: Version X.Y.Z @@ -260,7 +260,7 @@ on: jobs: new_version: - uses: Staffbase/gha-workflows/.github/workflows/template_release_version.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_release_version.yml@v3.3.0 ``` You could use the action in combination with the reusable release drafter. @@ -287,7 +287,7 @@ on: [pull_request] jobs: trufflehog: - uses: Staffbase/gha-workflows/.github/workflows/template_secret_scan.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_secret_scan.yml@v3.3.0 ``` @@ -305,7 +305,7 @@ on: jobs: stale: - uses: Staffbase/gha-workflows/.github/workflows/template_stale.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_stale.yml@v3.3.0 with: # optional: comment on the stale pull request while closed, default: This stale PR was closed because there was no activity. close-pr-message: your message @@ -341,7 +341,7 @@ on: jobs: techdocs: - uses: Staffbase/gha-workflows/.github/workflows/template_techdocs.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_techdocs.yml@v3.3.0 with: # optional: kind of the Backstage entity, default: Component # ref: https://backstage.io/docs/features/software-catalog/descriptor-format#contents @@ -372,7 +372,7 @@ on: jobs: trigger-testio-test: - uses: Staffbase/gha-workflows/.github/workflows/template_testio_trigger_test.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_testio_trigger_test.yml@v3.3.0 with: # optional: the slug you received from TestIO, defaults to 'staffbase' testio-slug: your TestIO slug @@ -404,7 +404,7 @@ on: jobs: yamllint: - uses: Staffbase/gha-workflows/.github/workflows/template_yaml.yml@v3.2.0 + uses: Staffbase/gha-workflows/.github/workflows/template_yaml.yml@v3.3.0 with: # optional: name of the running action, default: yamllint / yamllint action-name: your name From 82f0ddd5f6ec37a460efd624b5d0e02f545703aa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 11:32:20 +0100 Subject: [PATCH 3/4] :memo: update readme versions (#202) Co-authored-by: monotek --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 288c43ea..8b1ae9c5 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ on: jobs: : - uses: Staffbase/gha-workflows/.github/workflows/template_*.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_*.yml@v3.3.1 with: ... ``` @@ -43,7 +43,7 @@ on: jobs: dependabot: - uses: Staffbase/gha-workflows/.github/workflows/template_automerge_dependabot.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_automerge_dependabot.yml@v3.3.1 with: # optional: ⚠️ only enable the force merge if you want to do the merge just now force: true @@ -72,7 +72,7 @@ on: jobs: autodev: - uses: Staffbase/gha-workflows/.github/workflows/template_autodev.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_autodev.yml@v3.3.1 with: # optional: base branch from which the history originates, default: main base: master @@ -113,7 +113,7 @@ on: [ push ] jobs: gitops: - uses: Staffbase/gha-workflows/.github/workflows/template_gitops.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_gitops.yml@v3.3.1 with: # optional: list of build-time variables docker-build-args: | @@ -169,7 +169,7 @@ on: jobs: jira_annotate: - uses: Staffbase/gha-workflows/.github/workflows/template_jira_tagging.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_jira_tagging.yml@v3.3.1 with: # optional: name of the service to add as label, default: name of the repository name: 'component name' @@ -201,7 +201,7 @@ on: jobs: ld_code_references: - uses: Staffbase/gha-workflows/.github/workflows/template_launchdarkly_code_references.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_launchdarkly_code_references.yml@v3.3.1 with: # optional: key of the LD project, default: default project-key: 'my-project' @@ -229,7 +229,7 @@ on: jobs: update_release_draft: - uses: Staffbase/gha-workflows/.github/workflows/template_release_drafter.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_release_drafter.yml@v3.3.1 with: # optional: name of the release name: Version X.Y.Z @@ -260,7 +260,7 @@ on: jobs: new_version: - uses: Staffbase/gha-workflows/.github/workflows/template_release_version.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_release_version.yml@v3.3.1 ``` You could use the action in combination with the reusable release drafter. @@ -287,7 +287,7 @@ on: [pull_request] jobs: trufflehog: - uses: Staffbase/gha-workflows/.github/workflows/template_secret_scan.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_secret_scan.yml@v3.3.1 ``` @@ -305,7 +305,7 @@ on: jobs: stale: - uses: Staffbase/gha-workflows/.github/workflows/template_stale.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_stale.yml@v3.3.1 with: # optional: comment on the stale pull request while closed, default: This stale PR was closed because there was no activity. close-pr-message: your message @@ -341,7 +341,7 @@ on: jobs: techdocs: - uses: Staffbase/gha-workflows/.github/workflows/template_techdocs.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_techdocs.yml@v3.3.1 with: # optional: kind of the Backstage entity, default: Component # ref: https://backstage.io/docs/features/software-catalog/descriptor-format#contents @@ -372,7 +372,7 @@ on: jobs: trigger-testio-test: - uses: Staffbase/gha-workflows/.github/workflows/template_testio_trigger_test.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_testio_trigger_test.yml@v3.3.1 with: # optional: the slug you received from TestIO, defaults to 'staffbase' testio-slug: your TestIO slug @@ -404,7 +404,7 @@ on: jobs: yamllint: - uses: Staffbase/gha-workflows/.github/workflows/template_yaml.yml@v3.3.0 + uses: Staffbase/gha-workflows/.github/workflows/template_yaml.yml@v3.3.1 with: # optional: name of the running action, default: yamllint / yamllint action-name: your name From 5db3144919949b472f9e74a0102b48ada9e3f3c6 Mon Sep 17 00:00:00 2001 From: Falk Puschner Date: Wed, 15 Nov 2023 13:21:38 +0100 Subject: [PATCH 4/4] :art: Using squash method --- .github/workflows/template_automerge_dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/template_automerge_dependabot.yml b/.github/workflows/template_automerge_dependabot.yml index e3e79f6d..37a360ec 100644 --- a/.github/workflows/template_automerge_dependabot.yml +++ b/.github/workflows/template_automerge_dependabot.yml @@ -42,7 +42,7 @@ jobs: gh pr review --approve "$PR_URL" if [ ${{ inputs.force }} == 'true' ]; then - gh pr merge "$PR_URL" --merge --admin + gh pr merge "$PR_URL" --squash --admin else gh pr merge --auto --merge "$PR_URL" fi