Skip to content

Commit

Permalink
Merge pull request #286 from Staffbase/CLP-0000_automerge_update_types
Browse files Browse the repository at this point in the history
CLP-0000: Add an input type to specify update types for dependabot automerge workflow
  • Loading branch information
ingvaar authored Oct 15, 2024
2 parents a50e80f + 3855460 commit 3e20ac6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/template_automerge_dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ on:
default: "squash"
required: false
type: string
update-types:
description: "Types of version update to allow (possible values are: minor, major, patch)"
default: "patch,minor"
required: false
type: string
include-pre-release:
description: "Include pre-release updates"
default: false
required: false
type: boolean
secrets:
app_id:
required: true
Expand Down Expand Up @@ -42,9 +52,24 @@ jobs:

- name: Enable auto-merge for Dependabot PRs
if: >-
(steps.metadata.outputs.update-type == 'version-update:semver-patch' ||
steps.metadata.outputs.update-type == 'version-update:semver-minor') &&
!startsWith(steps.metadata.outputs.previous-version, '0.')
(
inputs.include-pre-release ||
!startsWith(steps.metadata.outputs.previous-version, '0.')
) &&
(
(
contains(inputs.update-types, 'major') &&
steps.metadata.outputs.update-type == 'version-update:semver-major'
) ||
(
contains(inputs.update-types, 'minor') &&
steps.metadata.outputs.update-type == 'version-update:semver-minor'
) ||
(
contains(inputs.update-types, 'patch') &&
steps.metadata.outputs.update-type == 'version-update:semver-patch'
)
)
run: |
gh pr review --approve "$PR_URL"
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ jobs:
force: true
# optional: choose strategy when merging (default: squash)
strategy: rebase, merge
# optional: choose which types of update you want to allow (default: minor,patch)
update-types: major,minor,patch
# optional: choose if you want to allow versions with semver 0.X.X (default: false)
include-pre-release: true
secrets:
# identifier of the GitHub App for authentication
app_id: ${{ <your-app-id> }}
Expand Down

0 comments on commit 3e20ac6

Please sign in to comment.