This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-website.git
The following commit(s) were added to refs/heads/main by this push:
new 9d058a91 fix(#1650): skip PR builds when only draft blog posts changed
(#1654)
9d058a91 is described below
commit 9d058a9169c229d08bdc340203379992d6b5b853
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Jun 14 17:57:39 2026 +0200
fix(#1650): skip PR builds when only draft blog posts changed (#1654)
Adds a detect-drafts job that checks if all changed files belong to
draft blog posts. If so, the full build/checks/preview pipeline is
skipped entirely.
Co-authored-by: Claude Opus 4.6 <[email protected]>
---
.github/workflows/pr.yaml | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml
index 90c9841b..35ee6af2 100644
--- a/.github/workflows/pr.yaml
+++ b/.github/workflows/pr.yaml
@@ -28,7 +28,49 @@ env:
HUGO_OPTIONS: '--buildFuture'
jobs:
+ detect-drafts:
+ runs-on: ubuntu-latest
+ outputs:
+ drafts-only: ${{ steps.check.outputs.drafts-only }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v5
+ - name: Check if PR only changes draft blog posts
+ id: check
+ run: |
+ CHANGED=$(gh pr diff ${{ github.event.pull_request.number }}
--name-only)
+ DRAFTS_ONLY=true
+ for file in $CHANGED; do
+ case "$file" in
+ content/blog/*/index.md)
+ if ! grep -q '^draft: true' "$file" 2>/dev/null; then
+ DRAFTS_ONLY=false
+ break
+ fi
+ ;;
+ content/blog/*)
+ # assets (images, SVGs) alongside a draft post are fine
+ dir=$(dirname "$file")
+ index="$dir/index.md"
+ if [ ! -f "$index" ] || ! grep -q '^draft: true' "$index"
2>/dev/null; then
+ DRAFTS_ONLY=false
+ break
+ fi
+ ;;
+ *)
+ DRAFTS_ONLY=false
+ break
+ ;;
+ esac
+ done
+ echo "drafts-only=$DRAFTS_ONLY" >> "$GITHUB_OUTPUT"
+ echo "Drafts only: $DRAFTS_ONLY"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
checks:
+ needs: detect-drafts
+ if: needs.detect-drafts.outputs.drafts-only != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout