mirror of
https://code.forgejo.org/actions/cascading-pr
synced 2025-03-15 06:46:59 +01:00
add a comment to the origin PR with a link to the destination PR
Fixes: https://code.forgejo.org/actions/cascading-pr/issues/5
This commit is contained in:
parent
78e88b2910
commit
3fe3bfa714
1 changed files with 15 additions and 0 deletions
|
@ -41,6 +41,20 @@ function delete_branch() {
|
|||
log_info "branch ${options[${direction}_head]} deleted"
|
||||
}
|
||||
|
||||
function pr_origin_comment_body() {
|
||||
echo "cascading-pr created at ${options[destination_url]}/${options[destination_repo]}/pulls/$(pr_number destination)"
|
||||
}
|
||||
|
||||
function comment_origin_pr() {
|
||||
cat > $TMPDIR/data <<EOF
|
||||
{
|
||||
"body":"$(pr_origin_comment_body)"
|
||||
}
|
||||
EOF
|
||||
repo_curl ${options[origin_repo]} api_json --data @$TMPDIR/data ${options[origin_api]}/issues/${options[origin_pr]}/comments
|
||||
log_info "comment added to $(pr_url origin)"
|
||||
}
|
||||
|
||||
function upsert_destination_branch() {
|
||||
if $(exists_branch destination) ; then
|
||||
log_info "branch ${options[destination_head]} already exists"
|
||||
|
@ -227,6 +241,7 @@ function run() {
|
|||
upsert_destination_branch
|
||||
upsert_destination_pr
|
||||
repo_login ${options[origin_repo]}
|
||||
comment_origin_pr
|
||||
update
|
||||
wait_destination_ci $(cat $TMPDIR/destination.sha)
|
||||
;;
|
||||
|
|
Loading…
Add table
Reference in a new issue