mirror of
https://code.forgejo.org/actions/cascading-pr
synced 2025-03-14 22:36:58 +01:00
wait until the repository is updated when pushing
as it indicates the push event was processed Fixes: https://code.forgejo.org/actions/cascading-pr/issues/13
This commit is contained in:
parent
9b5272e49c
commit
4a063913d4
1 changed files with 9 additions and 0 deletions
|
@ -33,6 +33,13 @@ function default_branch() {
|
|||
jq --raw-output .default_branch < $TMPDIR/$direction.json
|
||||
}
|
||||
|
||||
function updated_at() {
|
||||
local direction=$1
|
||||
|
||||
repo_curl ${options[${direction}_repo]} api_json ${options[${direction}_api]} > $TMPDIR/$direction.json
|
||||
jq --raw-output .updated_at < $TMPDIR/$direction.json
|
||||
}
|
||||
|
||||
function exists_branch() {
|
||||
local direction=$1
|
||||
|
||||
|
@ -218,8 +225,10 @@ function push() {
|
|||
cd $TMPDIR/$direction
|
||||
git add .
|
||||
if git commit -m 'cascading-pr update'; then
|
||||
local updated_at=$(updated_at $direction)
|
||||
git push --force ${remote} prbranch:$branch
|
||||
git rev-parse HEAD > ../$direction.sha
|
||||
retry test "$updated_at" != "$(updated_at $direction)"
|
||||
log_info "pushed"
|
||||
else
|
||||
log_info "nothing to push"
|
||||
|
|
Loading…
Add table
Reference in a new issue