From a084024bf7b56309db2d62a0f8cf6e68d046231d Mon Sep 17 00:00:00 2001 From: Dima Shevtsov Date: Wed, 8 Apr 2026 16:11:01 -0500 Subject: [PATCH 1/4] fix: prevent unnecessary commits when no changes are detected in site metadata --- .github/workflows/build-site-metadata.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-site-metadata.yml b/.github/workflows/build-site-metadata.yml index 323bc7a..2502916 100644 --- a/.github/workflows/build-site-metadata.yml +++ b/.github/workflows/build-site-metadata.yml @@ -22,6 +22,10 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add src/pages/adp-site-metadata.json - git diff --cached --quiet || git commit -m "Generate site metadata" + if git diff --cached --quiet; then + echo "No changes to commit, skipping commit and push" + exit 0 + fi + git commit -m "Generate site metadata" git pull --rebase git push From 47536524e9167d15c7d8e7a9e17a6aef7fbc6634 Mon Sep 17 00:00:00 2001 From: Dima Shevtsov Date: Wed, 8 Apr 2026 16:30:07 -0500 Subject: [PATCH 2/4] refactor: enhance change detection for site metadata commits --- .github/workflows/build-site-metadata.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-site-metadata.yml b/.github/workflows/build-site-metadata.yml index 2502916..eb664f2 100644 --- a/.github/workflows/build-site-metadata.yml +++ b/.github/workflows/build-site-metadata.yml @@ -17,15 +17,22 @@ jobs: - name: Build Site Metadata run: npx --yes github:AdobeDocs/adp-devsite-utils buildSiteMetadata -v + - name: Check for changes + id: check_changes + run: | + if git diff --quiet HEAD -- src/pages/adp-site-metadata.json; then + echo "No changes to commit, skipping commit and push" + echo "changed=false" >> $GITHUB_OUTPUT + else + echo "changed=true" >> $GITHUB_OUTPUT + fi + - name: Commit and push if changed + if: steps.check_changes.outputs.changed == 'true' run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add src/pages/adp-site-metadata.json - if git diff --cached --quiet; then - echo "No changes to commit, skipping commit and push" - exit 0 - fi git commit -m "Generate site metadata" git pull --rebase git push From af529d25d6a7f1385ee2499a28efb5f0eae21d9c Mon Sep 17 00:00:00 2001 From: Dima Shevtsov Date: Wed, 8 Apr 2026 16:48:44 -0500 Subject: [PATCH 3/4] fix: improve handling of forked PRs in site metadata workflow --- .github/workflows/build-site-metadata.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-site-metadata.yml b/.github/workflows/build-site-metadata.yml index eb664f2..83f6f52 100644 --- a/.github/workflows/build-site-metadata.yml +++ b/.github/workflows/build-site-metadata.yml @@ -12,7 +12,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ github.head_ref }} + ref: ${{ github.event.pull_request.head.repo.fork && github.sha || github.head_ref }} - name: Build Site Metadata run: npx --yes github:AdobeDocs/adp-devsite-utils buildSiteMetadata -v @@ -27,8 +27,13 @@ jobs: echo "changed=true" >> $GITHUB_OUTPUT fi + - name: Recommend building metadata locally + if: github.event.pull_request.head.repo.fork == true && steps.check_changes.outputs.changed == 'true' + run: | + echo "::warning::This PR is from a fork. Please run 'npm run buildSiteMetadata' locally and commit the updated src/pages/adp-site-metadata.json file." + - name: Commit and push if changed - if: steps.check_changes.outputs.changed == 'true' + if: steps.check_changes.outputs.changed == 'true' && github.event.pull_request.head.repo.full_name == github.repository run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" From f2456f8e535f976ba5adc9490f7d9413dceff81a Mon Sep 17 00:00:00 2001 From: Dima Shevtsov Date: Wed, 8 Apr 2026 17:13:24 -0500 Subject: [PATCH 4/4] fix: update error handling for forked PRs in site metadata workflow --- .github/workflows/build-site-metadata.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-site-metadata.yml b/.github/workflows/build-site-metadata.yml index 83f6f52..fa8c0f1 100644 --- a/.github/workflows/build-site-metadata.yml +++ b/.github/workflows/build-site-metadata.yml @@ -30,7 +30,8 @@ jobs: - name: Recommend building metadata locally if: github.event.pull_request.head.repo.fork == true && steps.check_changes.outputs.changed == 'true' run: | - echo "::warning::This PR is from a fork. Please run 'npm run buildSiteMetadata' locally and commit the updated src/pages/adp-site-metadata.json file." + echo "::error::This PR is from a fork. Please run 'npm run buildSiteMetadata' locally and commit the updated src/pages/adp-site-metadata.json file." + exit 1 - name: Commit and push if changed if: steps.check_changes.outputs.changed == 'true' && github.event.pull_request.head.repo.full_name == github.repository