feat(merge): You can now choose to suash PRs
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
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)
|
* `SOURCE`: Source branch (aka head)
|
||||||
* `TARGET`: Target branch (aka base)
|
* `TARGET`: Target branch (aka base)
|
||||||
* `MERGE`: Merge the PR after creation - defaults to false
|
* `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
|
* `DELETE_SOURCE`: Delete source branch after merge - defaults to false
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
@ -37,5 +38,6 @@ steps:
|
|||||||
SOURCE: dev
|
SOURCE: dev
|
||||||
TARGET: main
|
TARGET: main
|
||||||
MERGE: true
|
MERGE: true
|
||||||
|
SQUASH: false
|
||||||
DELETE_SOURCE: 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";
|
echo "Falling back to not deleting source";
|
||||||
PLUGIN_DELETE_SOURCE=false;
|
PLUGIN_DELETE_SOURCE=false;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${PLUGIN_SQUASH:-null}" = null ]; then
|
||||||
|
echo "Merging PR";
|
||||||
|
ACTION="merge";
|
||||||
|
else
|
||||||
|
echo "Squashing PR";
|
||||||
|
ACTION="squash";
|
||||||
|
fi
|
||||||
|
|
||||||
ID=$(echo $RES | jq '.number')
|
ID=$(echo $RES | jq '.number')
|
||||||
curl --request POST \
|
curl --request POST \
|
||||||
@ -48,7 +56,7 @@ if [ "${PLUGIN_MERGE:-false}" = true ]; then
|
|||||||
--header "Authorization: token $PLUGIN_APIKEY" \
|
--header "Authorization: token $PLUGIN_APIKEY" \
|
||||||
-f \
|
-f \
|
||||||
--data "{
|
--data "{
|
||||||
\"do\": \"merge\",
|
\"do\": \"$ACTION\",
|
||||||
\"delete_branch_after_merge\": $PLUGIN_DELETE_SOURCE
|
\"delete_branch_after_merge\": $PLUGIN_DELETE_SOURCE
|
||||||
}"
|
}"
|
||||||
echo "PR merged";
|
echo "PR merged";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user