mirror of
https://code.forgejo.org/actions/cascading-pr.git
synced 2025-04-21 08:28:44 +00:00
always login origin and destination
it may cost an extra login in some cases. But it also simplifies the codepaths where it would otherwise be necessary to figure out exactly in which case a login is required to read a private repository.
This commit is contained in:
parent
edc1d376dd
commit
39c71c3f40
1 changed files with 3 additions and 5 deletions
|
@ -248,16 +248,17 @@ function finalize_options() {
|
||||||
function run() {
|
function run() {
|
||||||
local state=$(pr_state origin)
|
local state=$(pr_state origin)
|
||||||
|
|
||||||
|
repo_login origin
|
||||||
|
repo_login destination
|
||||||
|
|
||||||
case "$state" in
|
case "$state" in
|
||||||
open)
|
open)
|
||||||
log_info "PR is open, update or create the cascade branch and PR"
|
log_info "PR is open, update or create the cascade branch and PR"
|
||||||
repo_login destination
|
|
||||||
upsert_destination_branch
|
upsert_destination_branch
|
||||||
update
|
update
|
||||||
local sha=$(sha_pushed destination)
|
local sha=$(sha_pushed destination)
|
||||||
if test "$sha" ; then
|
if test "$sha" ; then
|
||||||
upsert_destination_pr
|
upsert_destination_pr
|
||||||
repo_login origin
|
|
||||||
comment_origin_pr
|
comment_origin_pr
|
||||||
wait_destination_ci "$sha"
|
wait_destination_ci "$sha"
|
||||||
fi
|
fi
|
||||||
|
@ -266,18 +267,15 @@ function run() {
|
||||||
if "$(pr_merged origin)"; then
|
if "$(pr_merged origin)"; then
|
||||||
if "${options[close_merge]}" ; then
|
if "${options[close_merge]}" ; then
|
||||||
log_info "PR is merged, close the cascade PR and remove the branch"
|
log_info "PR is merged, close the cascade PR and remove the branch"
|
||||||
repo_login destination
|
|
||||||
close_pr
|
close_pr
|
||||||
else
|
else
|
||||||
log_info "PR was merged, update the cascade PR"
|
log_info "PR was merged, update the cascade PR"
|
||||||
repo_login destination
|
|
||||||
pr_get origin
|
pr_get origin
|
||||||
pr_get destination
|
pr_get destination
|
||||||
update
|
update
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log_info "PR is closed, close the cascade PR and remove the branch"
|
log_info "PR is closed, close the cascade PR and remove the branch"
|
||||||
repo_login destination
|
|
||||||
close_pr
|
close_pr
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Reference in a new issue