From 549a6662c053331a6ff1ffc9efae948aa1ba1d7c Mon Sep 17 00:00:00 2001 From: Dustin Byrne Date: Tue, 16 Jun 2026 11:01:17 -0400 Subject: [PATCH 1/5] chore: run required checks on docs-only PRs --- .github/workflows/build.yml | 2 -- .github/workflows/gradle-wrapper-validation.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dfd02e3c..68134789 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,8 +4,6 @@ on: branches: - main pull_request: - paths-ignore: - - "**/*.md" permissions: contents: read diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index 4c417da9..cb6594ac 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -4,8 +4,6 @@ on: branches: - main pull_request: - paths-ignore: - - "**/*.md" permissions: contents: read From 074e59d75ae1affd46ac254e8f537966e4b0e038 Mon Sep 17 00:00:00 2001 From: Dustin Byrne Date: Tue, 16 Jun 2026 11:18:53 -0400 Subject: [PATCH 2/5] chore: short-circuit required checks for docs-only PRs --- .github/workflows/build.yml | 43 ++++++++++++++++++- .../workflows/gradle-wrapper-validation.yml | 40 ++++++++++++++++- 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68134789..d69e084f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,27 +7,66 @@ on: permissions: contents: read - + pull-requests: read concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: + detect-markdown-only: + name: Detect markdown-only changes + runs-on: ubuntu-latest + outputs: + markdown_only: ${{ steps.detect.outputs.markdown_only }} + steps: + - name: Detect markdown-only PR + id: detect + env: + GH_TOKEN: ${{ github.token }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPOSITORY: ${{ github.repository }} + EVENT_NAME: ${{ github.event_name }} + run: | + if [ "$EVENT_NAME" != "pull_request" ]; then + echo "markdown_only=false" >> "$GITHUB_OUTPUT" + exit 0 + fi + + gh api --paginate "repos/$REPOSITORY/pulls/$PR_NUMBER/files" --jq '.[].filename' > "$RUNNER_TEMP/changed-files.txt" + + if [ ! -s "$RUNNER_TEMP/changed-files.txt" ]; then + markdown_only=false + elif grep -qvE '\.md$' "$RUNNER_TEMP/changed-files.txt"; then + markdown_only=false + else + markdown_only=true + fi + + echo "markdown_only=$markdown_only" >> "$GITHUB_OUTPUT" + echo "markdown_only=$markdown_only" + build: + needs: detect-markdown-only name: Build Job runs-on: ubuntu-latest steps: + - name: Skip expensive CI for markdown-only PR + if: needs.detect-markdown-only.outputs.markdown_only == 'true' + run: echo "Only Markdown files changed; marking this check successful without running expensive CI." - name: Git checkout + if: needs.detect-markdown-only.outputs.markdown_only != 'true' uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - name: 'Set up Java 17' + if: needs.detect-markdown-only.outputs.markdown_only != 'true' uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 with: java-version: '17' distribution: 'temurin' - name: Cache Gradle packages + if: needs.detect-markdown-only.outputs.markdown_only != 'true' uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: | @@ -38,7 +77,9 @@ jobs: ${{ runner.os }}-gradle- - name: Make compile + if: needs.detect-markdown-only.outputs.markdown_only != 'true' run: make compile - name: Make stop + if: needs.detect-markdown-only.outputs.markdown_only != 'true' run: make stop diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index cb6594ac..c57fe3dc 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -7,10 +7,48 @@ on: permissions: contents: read - + pull-requests: read jobs: + detect-markdown-only: + name: Detect markdown-only changes + runs-on: ubuntu-latest + outputs: + markdown_only: ${{ steps.detect.outputs.markdown_only }} + steps: + - name: Detect markdown-only PR + id: detect + env: + GH_TOKEN: ${{ github.token }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPOSITORY: ${{ github.repository }} + EVENT_NAME: ${{ github.event_name }} + run: | + if [ "$EVENT_NAME" != "pull_request" ]; then + echo "markdown_only=false" >> "$GITHUB_OUTPUT" + exit 0 + fi + + gh api --paginate "repos/$REPOSITORY/pulls/$PR_NUMBER/files" --jq '.[].filename' > "$RUNNER_TEMP/changed-files.txt" + + if [ ! -s "$RUNNER_TEMP/changed-files.txt" ]; then + markdown_only=false + elif grep -qvE '\.md$' "$RUNNER_TEMP/changed-files.txt"; then + markdown_only=false + else + markdown_only=true + fi + + echo "markdown_only=$markdown_only" >> "$GITHUB_OUTPUT" + echo "markdown_only=$markdown_only" + validation: + needs: detect-markdown-only runs-on: ubuntu-latest steps: + - name: Skip expensive CI for markdown-only PR + if: needs.detect-markdown-only.outputs.markdown_only == 'true' + run: echo "Only Markdown files changed; marking this check successful without running expensive CI." - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + if: needs.detect-markdown-only.outputs.markdown_only != 'true' - uses: gradle/actions/wrapper-validation@5e2ebd065dc2488b7a6ad670704656cbbe1e8f60 # v6.1.1 + if: needs.detect-markdown-only.outputs.markdown_only != 'true' From a54c1c310dc07b96a9e22aec3a1757e30b9cad10 Mon Sep 17 00:00:00 2001 From: Dustin Byrne Date: Tue, 16 Jun 2026 13:45:10 -0400 Subject: [PATCH 3/5] chore: reuse shared markdown-only detector --- .github/workflows/build.yml | 34 ++----------------- .../workflows/gradle-wrapper-validation.yml | 34 ++----------------- 2 files changed, 6 insertions(+), 62 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d69e084f..a3693fa9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,43 +7,15 @@ on: permissions: contents: read - pull-requests: read concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: detect-markdown-only: - name: Detect markdown-only changes - runs-on: ubuntu-latest - outputs: - markdown_only: ${{ steps.detect.outputs.markdown_only }} - steps: - - name: Detect markdown-only PR - id: detect - env: - GH_TOKEN: ${{ github.token }} - PR_NUMBER: ${{ github.event.pull_request.number }} - REPOSITORY: ${{ github.repository }} - EVENT_NAME: ${{ github.event_name }} - run: | - if [ "$EVENT_NAME" != "pull_request" ]; then - echo "markdown_only=false" >> "$GITHUB_OUTPUT" - exit 0 - fi - - gh api --paginate "repos/$REPOSITORY/pulls/$PR_NUMBER/files" --jq '.[].filename' > "$RUNNER_TEMP/changed-files.txt" - - if [ ! -s "$RUNNER_TEMP/changed-files.txt" ]; then - markdown_only=false - elif grep -qvE '\.md$' "$RUNNER_TEMP/changed-files.txt"; then - markdown_only=false - else - markdown_only=true - fi - - echo "markdown_only=$markdown_only" >> "$GITHUB_OUTPUT" - echo "markdown_only=$markdown_only" + uses: PostHog/.github/.github/workflows/detect-markdown-only.yml@ec25337d9fae0100622cbfea1bd5bd88284ac10b + permissions: + pull-requests: read build: needs: detect-markdown-only diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index c57fe3dc..34b616d2 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -7,39 +7,11 @@ on: permissions: contents: read - pull-requests: read jobs: detect-markdown-only: - name: Detect markdown-only changes - runs-on: ubuntu-latest - outputs: - markdown_only: ${{ steps.detect.outputs.markdown_only }} - steps: - - name: Detect markdown-only PR - id: detect - env: - GH_TOKEN: ${{ github.token }} - PR_NUMBER: ${{ github.event.pull_request.number }} - REPOSITORY: ${{ github.repository }} - EVENT_NAME: ${{ github.event_name }} - run: | - if [ "$EVENT_NAME" != "pull_request" ]; then - echo "markdown_only=false" >> "$GITHUB_OUTPUT" - exit 0 - fi - - gh api --paginate "repos/$REPOSITORY/pulls/$PR_NUMBER/files" --jq '.[].filename' > "$RUNNER_TEMP/changed-files.txt" - - if [ ! -s "$RUNNER_TEMP/changed-files.txt" ]; then - markdown_only=false - elif grep -qvE '\.md$' "$RUNNER_TEMP/changed-files.txt"; then - markdown_only=false - else - markdown_only=true - fi - - echo "markdown_only=$markdown_only" >> "$GITHUB_OUTPUT" - echo "markdown_only=$markdown_only" + uses: PostHog/.github/.github/workflows/detect-markdown-only.yml@ec25337d9fae0100622cbfea1bd5bd88284ac10b + permissions: + pull-requests: read validation: needs: detect-markdown-only From 09ac998eb6bb4532c16a91f36d07114a67e07f54 Mon Sep 17 00:00:00 2001 From: Dustin Byrne Date: Tue, 16 Jun 2026 13:54:29 -0400 Subject: [PATCH 4/5] chore: use neutral markdown-only check wording --- .github/workflows/build.yml | 4 ++-- .github/workflows/gradle-wrapper-validation.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3693fa9..d8618273 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,9 +23,9 @@ jobs: runs-on: ubuntu-latest steps: - - name: Skip expensive CI for markdown-only PR + - name: Complete markdown-only PR check if: needs.detect-markdown-only.outputs.markdown_only == 'true' - run: echo "Only Markdown files changed; marking this check successful without running expensive CI." + run: echo "Only Markdown files changed; no additional work is required for this check." - name: Git checkout if: needs.detect-markdown-only.outputs.markdown_only != 'true' uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index 34b616d2..28120144 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -17,9 +17,9 @@ jobs: needs: detect-markdown-only runs-on: ubuntu-latest steps: - - name: Skip expensive CI for markdown-only PR + - name: Complete markdown-only PR check if: needs.detect-markdown-only.outputs.markdown_only == 'true' - run: echo "Only Markdown files changed; marking this check successful without running expensive CI." + run: echo "Only Markdown files changed; no additional work is required for this check." - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 if: needs.detect-markdown-only.outputs.markdown_only != 'true' - uses: gradle/actions/wrapper-validation@5e2ebd065dc2488b7a6ad670704656cbbe1e8f60 # v6.1.1 From 4cb6e0b65fb3b2e6c4a97d3b5ea14e2363196c0b Mon Sep 17 00:00:00 2001 From: Dustin Byrne Date: Tue, 16 Jun 2026 14:03:59 -0400 Subject: [PATCH 5/5] chore: limit docs-only short-circuit to required checks --- .github/workflows/gradle-wrapper-validation.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index 28120144..4c417da9 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -4,23 +4,15 @@ on: branches: - main pull_request: + paths-ignore: + - "**/*.md" permissions: contents: read -jobs: - detect-markdown-only: - uses: PostHog/.github/.github/workflows/detect-markdown-only.yml@ec25337d9fae0100622cbfea1bd5bd88284ac10b - permissions: - pull-requests: read +jobs: validation: - needs: detect-markdown-only runs-on: ubuntu-latest steps: - - name: Complete markdown-only PR check - if: needs.detect-markdown-only.outputs.markdown_only == 'true' - run: echo "Only Markdown files changed; no additional work is required for this check." - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - if: needs.detect-markdown-only.outputs.markdown_only != 'true' - uses: gradle/actions/wrapper-validation@5e2ebd065dc2488b7a6ad670704656cbbe1e8f60 # v6.1.1 - if: needs.detect-markdown-only.outputs.markdown_only != 'true'