1
0
Fork 0
mirror of https://code.forgejo.org/actions/cascading-pr synced 2025-03-14 22:36:58 +01:00

Merge pull request 'wait until the repository is updated when pushing' (#14) from earl-warren/cascading-pr:wip-race into main

Reviewed-on: https://code.forgejo.org/actions/cascading-pr/pulls/14
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
This commit is contained in:
earl-warren 2023-12-23 18:20:18 +00:00
commit 9bf77b90a4

View file

@ -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"