feat: wait-iteration to control the timeout for the destination pull request

on a busy repository or with a long workflow, it may take more than
the one hour default to complete
This commit is contained in:
Earl Warren 2025-09-11 18:14:06 +02:00
parent 0ff02f5d54
commit c2c22e2994
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
4 changed files with 17 additions and 1 deletions

View file

@ -87,8 +87,9 @@ not exist, it is created.
| destination-branch | the base branch of the destination repository for the cascading PR | `true` | | | destination-branch | the base branch of the destination repository for the cascading PR | `true` | |
| destination-token | a token with write permission on destination-repo | `true` | | | destination-token | a token with write permission on destination-repo | `true` | |
| update | path to the script to update the content of the cascading PR | `true` | | | update | path to the script to update the content of the cascading PR | `true` | |
| wait-iteration | number of seconds to wait before verifying for the status of the destination pull request (timeout after 100 iterations) | `true` | 36 |
| prefix | prefix of the branch from which the cascading PR is created on {destination-repo} or {destination-fork-repo} (default to {origin-repo}) | `false` | | | prefix | prefix of the branch from which the cascading PR is created on {destination-repo} or {destination-fork-repo} (default to {origin-repo}) | `false` | |
| close | if true the cascading PR will be closed and the branch deleted when the PR is merged | `false` | false | | close | if true the cascading PR will be closed and the branch deleted when (i) the {origin-pr} is merged or (ii) when the cascading PR status is success if {origin-ref} is set | `false` | false |
| verbose | if true print verbose information | `false` | false | | verbose | if true print verbose information | `false` | false |
| debug | if true print debug information | `false` | false | | debug | if true print debug information | `false` | false |
<!-- action-docs-inputs --> <!-- action-docs-inputs -->

View file

@ -101,6 +101,10 @@ inputs:
update: update:
description: 'path to the script to update the content of the cascading PR' description: 'path to the script to update the content of the cascading PR'
required: true required: true
wait-iteration:
description: 'number of seconds to wait before verifying for the status of the destination pull request (timeout after 100 iterations)'
default: 36
required: true
prefix: prefix:
description: 'prefix of the branch from which the cascading PR is created on {destination-repo} or {destination-fork-repo} (default to {origin-repo})' description: 'prefix of the branch from which the cascading PR is created on {destination-repo} or {destination-fork-repo} (default to {origin-repo})'
close: close:
@ -143,6 +147,7 @@ runs:
--destination-token "@$destination_token" \ --destination-token "@$destination_token" \
--destination-branch "${{ inputs.destination-branch }}" \ --destination-branch "${{ inputs.destination-branch }}" \
--update "${{ inputs.update }}" \ --update "${{ inputs.update }}" \
--wait-iteration "${{ inputs.wait-iteration }}" \
--prefix "${{ inputs.prefix }}" \ --prefix "${{ inputs.prefix }}" \
--close "${{ inputs.close }}" \ --close "${{ inputs.close }}" \
run run

View file

@ -27,6 +27,10 @@ function dependencies() {
fi fi
} }
function set_loop_delay() {
LOOP_DELAY="$1"
}
function retry() { function retry() {
rm -f $TMPDIR/retry.{out,attempt,err} rm -f $TMPDIR/retry.{out,attempt,err}
local success=false local success=false

View file

@ -401,6 +401,7 @@ function finalize_options() {
else else
options[destination_is_fork]=false options[destination_is_fork]=false
fi fi
set_loop_delay ${options[wait_iteration]}
: ${options[close]:=false} : ${options[close]:=false}
} }
@ -543,6 +544,11 @@ function main() {
options[update]=$1 options[update]=$1
shift shift
;; ;;
--wait-iteration)
shift
options[wait_iteration]=$1
shift
;;
--prefix) --prefix)
shift shift
options[prefix]=$1 options[prefix]=$1