Skip to content

Commit

Permalink
feat(automerge): allow selection of merge strategy
Browse files Browse the repository at this point in the history
also update README
  • Loading branch information
ingvaar committed Feb 5, 2024
1 parent 7836db7 commit ef2421f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/template_automerge_dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ on:
default: false
required: false
type: boolean
rebase:
default: false
strategy:
default: "squash"
required: false
type: boolean
type: string
secrets:
app_id:
required: true
Expand Down Expand Up @@ -50,11 +50,18 @@ jobs:
MERGE_COMMAND="gh pr merge \"$PR_URL\""
if [ "${{ inputs.rebase }}" == 'true' ]; then
MERGE_COMMAND+=" --rebase"
else
MERGE_COMMAND+=" --squash"
fi
case "${{ inputs.strategy }}" in
"rebase")
MERGE_COMMAND+=" --rebase"
;;
"merge")
MERGE_COMMAND+=" --merge"
;;
*)
MERGE_COMMAND+=" --squash"
;;
esac
if [ ${{ inputs.force }} == 'true' ]; then
MERGE_COMMAND+=" --admin"
fi
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ jobs:
with:
# optional: ⚠️ only enable the force merge if you want to do the merge just now
force: true
# optional: enable rebase strategy when merging (default: false)
rebase: true
# optional: choose strategy when merging (default: squash)
strategy: rebase
secrets:
# identifier of the GitHub App for authentication
app_id: ${{ <your-app-id> }}
Expand Down

0 comments on commit ef2421f

Please sign in to comment.