feat(merge): You can now choose to suash PRs
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
5c7a232ffb
commit
0f39869363
|
@ -16,6 +16,7 @@ It is also able to merge the pull request after creation (see Settings).
|
|||
* `SOURCE`: Source branch (aka head)
|
||||
* `TARGET`: Target branch (aka base)
|
||||
* `MERGE`: Merge the PR after creation - defaults to false
|
||||
* `SQUASH`: Suash the merge - defaults to false
|
||||
* `DELETE_SOURCE`: Delete source branch after merge - defaults to false
|
||||
|
||||
## Examples
|
||||
|
@ -37,5 +38,6 @@ steps:
|
|||
SOURCE: dev
|
||||
TARGET: main
|
||||
MERGE: true
|
||||
SQUASH: false
|
||||
DELETE_SOURCE: false
|
||||
```
|
10
plugin.sh
10
plugin.sh
|
@ -40,6 +40,14 @@ if [ "${PLUGIN_MERGE:-false}" = true ]; then
|
|||
echo "Falling back to not deleting source";
|
||||
PLUGIN_DELETE_SOURCE=false;
|
||||
fi
|
||||
|
||||
if [ "${PLUGIN_SQUASH:-null}" = null ]; then
|
||||
echo "Merging PR";
|
||||
ACTION="merge";
|
||||
else
|
||||
echo "Squashing PR";
|
||||
ACTION="squash";
|
||||
fi
|
||||
|
||||
ID=$(echo $RES | jq '.number')
|
||||
curl --request POST \
|
||||
|
@ -48,7 +56,7 @@ if [ "${PLUGIN_MERGE:-false}" = true ]; then
|
|||
--header "Authorization: token $PLUGIN_APIKEY" \
|
||||
-f \
|
||||
--data "{
|
||||
\"do\": \"merge\",
|
||||
\"do\": \"$ACTION\",
|
||||
\"delete_branch_after_merge\": $PLUGIN_DELETE_SOURCE
|
||||
}"
|
||||
echo "PR merged";
|
||||
|
|
Loading…
Reference in New Issue