Skip to content

Commit ac5f2a4

Browse files
authored
Merge pull request #277 from SubtitleEdit/feature/workflow-push-retry
Retry release-bump push with --rebase on concurrent contention
2 parents 002ef94 + 3de1ee7 commit ac5f2a4

5 files changed

Lines changed: 70 additions & 5 deletions

File tree

.github/workflows/american-to-british.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,20 @@ jobs:
6565
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
6666
git add se5/AmericanToBritish/plugin.json
6767
git commit -m "Bump AmericanToBritish to $version [skip ci]"
68-
git push
68+
69+
# Retry-with-rebase: if a concurrent release dispatched for a different
70+
# plugin won the push first, pull --rebase and try again.
71+
attempts=0
72+
while ! git push 2>/tmp/push.err; do
73+
attempts=$((attempts + 1))
74+
if [ "$attempts" -ge 5 ]; then
75+
echo "Failed to push after $attempts attempts:" >&2
76+
cat /tmp/push.err >&2
77+
exit 1
78+
fi
79+
echo "Push rejected (attempt $attempts), pulling --rebase and retrying..."
80+
git pull --rebase --no-edit
81+
done
6982
ref=$(git rev-parse HEAD)
7083
7184
IFS=. read -r major minor patch <<< "$version"

.github/workflows/british-to-american.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,20 @@ jobs:
6565
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
6666
git add se5/BritishToAmerican/plugin.json
6767
git commit -m "Bump BritishToAmerican to $version [skip ci]"
68-
git push
68+
69+
# Retry-with-rebase: if a concurrent release dispatched for a different
70+
# plugin won the push first, pull --rebase and try again.
71+
attempts=0
72+
while ! git push 2>/tmp/push.err; do
73+
attempts=$((attempts + 1))
74+
if [ "$attempts" -ge 5 ]; then
75+
echo "Failed to push after $attempts attempts:" >&2
76+
cat /tmp/push.err >&2
77+
exit 1
78+
fi
79+
echo "Push rejected (attempt $attempts), pulling --rebase and retrying..."
80+
git pull --rebase --no-edit
81+
done
6982
ref=$(git rev-parse HEAD)
7083
7184
IFS=. read -r major minor patch <<< "$version"

.github/workflows/haxor.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,20 @@ jobs:
6363
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
6464
git add se5/Haxor/plugin.json
6565
git commit -m "Bump Haxor to $version [skip ci]"
66-
git push
66+
67+
# Retry-with-rebase: if a concurrent release dispatched for a different
68+
# plugin won the push first, pull --rebase and try again.
69+
attempts=0
70+
while ! git push 2>/tmp/push.err; do
71+
attempts=$((attempts + 1))
72+
if [ "$attempts" -ge 5 ]; then
73+
echo "Failed to push after $attempts attempts:" >&2
74+
cat /tmp/push.err >&2
75+
exit 1
76+
fi
77+
echo "Push rejected (attempt $attempts), pulling --rebase and retrying..."
78+
git pull --rebase --no-edit
79+
done
6780
ref=$(git rev-parse HEAD)
6881
6982
IFS=. read -r major minor patch <<< "$version"

.github/workflows/typewriter.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,20 @@ jobs:
6363
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
6464
git add se5/TypewriterEffect/plugin.json
6565
git commit -m "Bump TypewriterEffect to $version [skip ci]"
66-
git push
66+
67+
# Retry-with-rebase: if a concurrent release dispatched for a different
68+
# plugin won the push first, pull --rebase and try again.
69+
attempts=0
70+
while ! git push 2>/tmp/push.err; do
71+
attempts=$((attempts + 1))
72+
if [ "$attempts" -ge 5 ]; then
73+
echo "Failed to push after $attempts attempts:" >&2
74+
cat /tmp/push.err >&2
75+
exit 1
76+
fi
77+
echo "Push rejected (attempt $attempts), pulling --rebase and retrying..."
78+
git pull --rebase --no-edit
79+
done
6780
ref=$(git rev-parse HEAD)
6881
6982
IFS=. read -r major minor patch <<< "$version"

.github/workflows/word-censor.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,20 @@ jobs:
6565
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
6666
git add se5/WordCensor/plugin.json
6767
git commit -m "Bump WordCensor to $version [skip ci]"
68-
git push
68+
69+
# Retry-with-rebase: if a concurrent release dispatched for a different
70+
# plugin won the push first, pull --rebase and try again.
71+
attempts=0
72+
while ! git push 2>/tmp/push.err; do
73+
attempts=$((attempts + 1))
74+
if [ "$attempts" -ge 5 ]; then
75+
echo "Failed to push after $attempts attempts:" >&2
76+
cat /tmp/push.err >&2
77+
exit 1
78+
fi
79+
echo "Push rejected (attempt $attempts), pulling --rebase and retrying..."
80+
git pull --rebase --no-edit
81+
done
6982
ref=$(git rev-parse HEAD)
7083
7184
IFS=. read -r major minor patch <<< "$version"

0 commit comments

Comments
 (0)