mirror of
https://code.forgejo.org/actions/cascading-pr.git
synced 2025-06-28 04:43:44 +00:00
close-merge input
Fixes: https://code.forgejo.org/actions/cascading-pr/issues/7
This commit is contained in:
parent
f8a65b3d9f
commit
5caaedbc52
7 changed files with 80 additions and 9 deletions
|
@ -241,6 +241,7 @@ function finalize_options() {
|
|||
options[destination_base]=${options[destination_branch]}
|
||||
: ${options[prefix]:=${options[origin_repo]}}
|
||||
options[destination_head]=${options[prefix]}-${options[origin_pr]}
|
||||
: ${options[close_merge]:=false}
|
||||
}
|
||||
|
||||
function run() {
|
||||
|
@ -262,11 +263,17 @@ function run() {
|
|||
;;
|
||||
closed)
|
||||
if "$(pr_merged origin)"; then
|
||||
log_info "PR was merged, update the cascade PR"
|
||||
repo_login ${options[destination_repo]}
|
||||
pr_get origin
|
||||
pr_get destination
|
||||
update
|
||||
if "${options[close_merge]}" ; then
|
||||
log_info "PR is merged, close the cascade PR and remove the branch"
|
||||
repo_login ${options[destination_repo]}
|
||||
close_pr
|
||||
else
|
||||
log_info "PR was merged, update the cascade PR"
|
||||
repo_login ${options[destination_repo]}
|
||||
pr_get origin
|
||||
pr_get destination
|
||||
update
|
||||
fi
|
||||
else
|
||||
log_info "PR is closed, close the cascade PR and remove the branch"
|
||||
repo_login ${options[destination_repo]}
|
||||
|
@ -340,6 +347,11 @@ function main() {
|
|||
options[prefix]=$1
|
||||
shift
|
||||
;;
|
||||
--close-merge)
|
||||
shift
|
||||
options[close_merge]=$1
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
finalize_options
|
||||
"${1:-run}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue