This is an automated email from the ASF dual-hosted git repository.

shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow-site-archive.git


The following commit(s) were added to refs/heads/main by this push:
     new 2dd61bb4417 Push the S3 sync on top of commits that land during the 
run (#51)
2dd61bb4417 is described below

commit 2dd61bb4417be58530ffebc6db339a413ef4f182
Author: Niko Oliveira <[email protected]>
AuthorDate: Sun Nov 22 13:26:12 2026 -0800

    Push the S3 sync on top of commits that land during the run (#51)
    
    The sync runs for one to two hours, then force-pushes a commit made on
    top of the commit it checked out. When anything lands on the branch in
    the meantime, the main ruleset rejects the push with GH013 and the
    whole run is lost, as happened on 2026-11-01 and 2026-11-09. On
    staging, which has no ruleset, the same force push silently drops the
    other commits. A run with nothing to commit also force-pushed the old
    checkout, rewinding the branch.
---
 .github/workflows/s3-to-github.yml | 36 ++++++++++++++++++++++++++++++++----
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/s3-to-github.yml 
b/.github/workflows/s3-to-github.yml
index 7a859e52528..97c6d10d979 100644
--- a/.github/workflows/s3-to-github.yml
+++ b/.github/workflows/s3-to-github.yml
@@ -249,29 +249,57 @@ jobs:
       - name: Committing live changes
         env:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          BRANCH: main
         run: |
           echo "Running git config"
           git config user.name "GitHub Actions"
           git config user.email "[email protected]"
           echo "Running git add"
           git add --verbose .
+          if git diff --cached --quiet; then
+            echo -e "\e[32mNo changes to commit\e[0m"
+            exit 0
+          fi
           echo "Running git commit"
-          git commit -m "Sync S3 to GitHub" || echo -e "\e[32mNo changes to 
commit\e[0m"
-          git push --force "https://x-access-token:${GH_TOKEN}@github.com/${{ 
github.repository }}.git" HEAD:main
+          git commit -m "Sync S3 to GitHub"
+          # The branch can move during the hours-long sync, so replay the 
commit onto its tip.
+          for attempt in 1 2 3; do
+            git fetch --depth=1 origin "${BRANCH}"
+            git rebase --onto FETCH_HEAD HEAD~1
+            if git push "https://x-access-token:${GH_TOKEN}@github.com/${{ 
github.repository }}.git" "HEAD:${BRANCH}"; then
+              exit 0
+            fi
+            echo "Push to ${BRANCH} rejected (attempt ${attempt}/3)"
+          done
+          exit 1
         working-directory: /mnt/cloned-airflow-site-archive
         if: inputs.commit-changes == true && github.ref == 'refs/heads/main' 
&& inputs.source == 'live'
 
       - name: Committing staging changes
         env:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          BRANCH: staging
         run: |
           echo "Running git config"
           git config user.name "GitHub Actions"
           git config user.email "[email protected]"
           echo "Running git add"
           git add --verbose .
+          if git diff --cached --quiet; then
+            echo -e "\e[32mNo changes to commit\e[0m"
+            exit 0
+          fi
           echo "Running git commit"
-          git commit -m "Sync S3 to GitHub" || echo -e "\e[32mNo changes to 
commit\e[0m"
-          git push --force "https://x-access-token:${GH_TOKEN}@github.com/${{ 
github.repository }}.git" HEAD:staging
+          git commit -m "Sync S3 to GitHub"
+          # The branch can move during the hours-long sync, so replay the 
commit onto its tip.
+          for attempt in 1 2 3; do
+            git fetch --depth=1 origin "${BRANCH}"
+            git rebase --onto FETCH_HEAD HEAD~1
+            if git push "https://x-access-token:${GH_TOKEN}@github.com/${{ 
github.repository }}.git" "HEAD:${BRANCH}"; then
+              exit 0
+            fi
+            echo "Push to ${BRANCH} rejected (attempt ${attempt}/3)"
+          done
+          exit 1
         working-directory: /mnt/cloned-airflow-site-archive
         if: inputs.commit-changes == true && github.ref == 
'refs/heads/staging' && inputs.source == 'staging'

Reply via email to