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

sarvekshayr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 0de9322992c HDDS-15922. Fix ozone-site config doc workflow reusing 
stale PR branch (#10826)
0de9322992c is described below

commit 0de9322992c5fb436f7b497089aa75534e6a0555
Author: sravani <[email protected]>
AuthorDate: Tue Jul 28 16:17:20 2026 +0530

    HDDS-15922. Fix ozone-site config doc workflow reusing stale PR branch 
(#10826)
---
 .github/workflows/update-ozone-site-config-doc.yml | 46 +++++++++-------------
 1 file changed, 19 insertions(+), 27 deletions(-)

diff --git a/.github/workflows/update-ozone-site-config-doc.yml 
b/.github/workflows/update-ozone-site-config-doc.yml
index b45823a73f7..f90c2729c76 100644
--- a/.github/workflows/update-ozone-site-config-doc.yml
+++ b/.github/workflows/update-ozone-site-config-doc.yml
@@ -53,21 +53,28 @@ jobs:
       
       - name: Checkout ozone-site repository
         if: steps.check-site-repo.outputs.exists == 'true'
+        env:
+          GH_TOKEN: ${{ secrets.OZONE_WEBSITE_BUILD }}
         run: |
           git config --global url."https://asf-ci-deploy:${{ 
secrets.OZONE_WEBSITE_BUILD }}@github.com/".insteadOf "https://github.com/";
           git config --global user.name 'github-actions[bot]'
           git config --global user.email 
'github-actions[bot]@users.noreply.github.com'
           
           git clone --depth=1 --branch=master 
https://github.com/$REPO_OWNER/ozone-site.git ozone-site
-          
-          # Check if $BRANCH_NAME branch exists remotely
           cd ozone-site
-          if git ls-remote --heads origin $BRANCH_NAME | grep -q $BRANCH_NAME; 
then
-            echo "PR branch exists, checking it out for comparison"
-            git fetch --depth=1 origin $BRANCH_NAME
-            git checkout -B $BRANCH_NAME FETCH_HEAD
+
+          EXISTING_PR=$(gh pr list --repo "$REPO_OWNER/ozone-site" \
+            --head "$BRANCH_NAME" --base master --json number --jq 
'.[0].number' || echo "")
+          echo "EXISTING_PR=$EXISTING_PR" >> $GITHUB_ENV
+
+          if [ -n "$EXISTING_PR" ]; then
+            echo "Open PR #$EXISTING_PR exists, checking out branch for 
comparison"
+            git fetch --depth=1 origin "$BRANCH_NAME"
+            git checkout -B "$BRANCH_NAME" FETCH_HEAD
           else
-            echo "PR branch does not exist, staying on master for comparison"
+            echo "No open PR, creating branch from master"
+            git fetch --depth=1 origin "$BRANCH_NAME" || true
+            git checkout -B "$BRANCH_NAME" master
           fi
 
       - name: Check if documentation changed
@@ -130,27 +137,16 @@ jobs:
         if: steps.check-changes.outputs.changed == 'true'
         run: |
           cd ozone-site
-          
-          echo "Current branch: $(git branch --show-current)"
-          echo "Current commit: $(git rev-parse HEAD)"
-          
-          # Create/reset branch at current commit
-          git checkout -B "$BRANCH_NAME"
-          echo "Created/reset branch $BRANCH_NAME at current commit"
-          
-          git add "$TARGET_FILE"
-          
-          # Build commit message with JIRA ID if available
+
           COMMIT_MSG="[Auto] Update configuration documentation from ozone 
$SHA"
           if [ -n "$JIRA_ID" ]; then
             COMMIT_MSG="$JIRA_ID. $COMMIT_MSG"
           fi
-          
+
+          git add "$TARGET_FILE"
           git commit -m "$COMMIT_MSG"
-          
-          echo "Pushing $BRANCH_NAME to origin"
-          git push -f origin "$BRANCH_NAME"
-      
+          git push --force-with-lease origin "$BRANCH_NAME"
+
       - name: Create or update Pull Request in ozone-site
         if: steps.check-changes.outputs.changed == 'true' && github.repository 
== 'apache/ozone'
         env:
@@ -166,10 +162,6 @@ jobs:
           ../ozone-repo/dev-support/ci/pr_body_config_doc.sh \
             "$REPO" "$WORKFLOW" "$RUN_ID" "$REF_NAME" "$SHA" "$JIRA_ID" > 
pr_body.txt
           
-          # Check if PR already exists
-          EXISTING_PR=$(gh pr list --repo "$REPO_OWNER/ozone-site" \
-            --head "$BRANCH_NAME" --base master --json number --jq 
'.[0].number' || echo "")
-          
           if [ -n "$EXISTING_PR" ]; then
             echo "Updating existing PR #$EXISTING_PR with a comment"
             gh pr comment "$EXISTING_PR" --repo "$REPO_OWNER/ozone-site" 
--body-file pr_body.txt


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to