This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch fix/1650-skip-pr-builds-for-drafts in repository https://gitbox.apache.org/repos/asf/camel-website.git
commit 9b9f1366ad818e48e086925d82f1062f6f8fcd41 Author: Claus Ibsen <[email protected]> AuthorDate: Sun Jun 14 12:29:02 2026 +0200 fix(#1650): skip PR builds when only draft blog posts changed 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
