Fix staleness flakes from race condition.

If a change is committed while we're regenerating stale files, we should just bail and let the next job handle the refresh.

PiperOrigin-RevId: 510453613
pull/11981/head
Mike Kruskal 2 years ago committed by Copybara-Service
parent b7e0f842e9
commit 15d2505070
  1. 1
      .github/workflows/staleness_check.yml
  2. 3
      .github/workflows/staleness_refresh.yml
  3. 5
      ci/push_auto_update.sh

@ -4,6 +4,7 @@ on:
schedule:
# Run daily at 10 AM UTC (2 AM PDT)
- cron: 0 10 * * *
workflow_dispatch:
permissions: {}
jobs:

@ -8,6 +8,7 @@ on:
# The 21.x branch predates support for auto-generation, so we make sure
# to exclude it.
- '!21.x'
workflow_dispatch:
permissions: {}
jobs:
@ -31,4 +32,4 @@ jobs:
- name: Configure name and email address in Git
run: cd ${{ github.workspace }} && git config user.name "Protobuf Team Bot" && git config user.email "protobuf-team-bot@google.com"
- name: Commit and push update
run: cd ${{ github.workspace }} && ./push_auto_update.sh
run: cd ${{ github.workspace }} && ./ci/push_auto_update.sh

@ -8,7 +8,7 @@
set -ex
# Cd to the repo root.
cd $(dirname -- "$0")
cd $(dirname -- "$0")/..
previous_commit_title=$(git log -1 --pretty='%s')
@ -39,7 +39,6 @@ else
commit_message="Auto-generate files"
fi
git pull --rebase
git add -A
git diff --staged --quiet || git commit -am "$commit_message"
git push
git push || echo "Conflicting commit hit, retrying in next job..."
Loading…
Cancel
Save