:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(ci): skip backend tests for markdown-only changes (#65468)
Paul D'Ambra2e1bf5448d70
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.ymlindex 15f917536492..13ab41d555a6 100644--- a/.depot/workflows/ci-backend.yml+++ b/.depot/workflows/ci-backend.yml@@ -171,7 +171,7 @@ jobs:name: Determine need to run backend and migration checks# Set job outputs to values from filter stepoutputs:- backend: ${{ steps.filter.outputs.backend || 'true' }}+ backend: ${{ steps.backend_docs.outputs.backend || 'true' }}backend_files: ${{ steps.filter.outputs.backend_files }}migrations: ${{ steps.filter.outputs.migrations || 'true' }}migrations_files: ${{ steps.filter.outputs.migrations_files }}@@ -403,6 +403,38 @@ jobs:echo "data_import_sources_only=$only_sources" >> "$GITHUB_OUTPUT"echo "Only data warehouse import sources changed: $only_sources"+ # A change that only touches Markdown docs (e.g. a README under+ # posthog/) still matches the broad backend globs above, needlessly+ # running the whole backend suite. Drop the backend signal when+ # every backend-matched file is Markdown.+ # PR/merge_group events only; push keeps the default full run.+ - name: Ignore Markdown-only changes for backend+ id: backend_docs+ if: github.event_name != 'push'+ # If this step ever errors, the job output falls back to+ # backend='true', so a failure here can only over-run the+ # backend suite, never wrongly skip it.+ continue-on-error: true+ env:+ BACKEND: ${{ steps.filter.outputs.backend }}+ BACKEND_FILES: ${{ steps.filter.outputs.backend_files }}+ run: |+ backend="$BACKEND"+ if [ "$backend" = "true" ] && [ -n "$BACKEND_FILES" ]; then+ # backend_files is in dorny/paths-filter's "escape" format+ # (space-delimited, backslash-escaped). Decode it with xargs+ # so paths containing whitespace stay intact and a very long+ # list can't overflow the argument list, then skip the backend+ # suite only when every changed file is Markdown.+ if files=$(printf '%s' "$BACKEND_FILES" | xargs -n1); then+ if ! printf '%s\n' "$files" | grep -qvE '\.(md|mdx)$'; then+ backend=false+ fi+ fi+ fi+ echo "backend=$backend" >> "$GITHUB_OUTPUT"+ echo "Backend tests needed: $backend"+detect-snapshot-mode:name: Detect snapshot moderuns-on: depot-ubuntu-latestdiff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.ymlindex 9f2f528820db..4ccf2d42e5df 100644--- a/.github/workflows/ci-backend.yml+++ b/.github/workflows/ci-backend.yml@@ -78,7 +78,7 @@ jobs:name: Determine need to run backend and migration checks# Set job outputs to values from filter stepoutputs:- backend: ${{ steps.filter.outputs.backend || 'true' }}+ backend: ${{ steps.backend_docs.outputs.backend || 'true' }}backend_files: ${{ steps.filter.outputs.backend_files }}migrations: ${{ steps.filter.outputs.migrations || 'true' }}migrations_files: ${{ steps.filter.outputs.migrations_files }}@@ -325,6 +325,38 @@ jobs:echo "data_import_sources_only=$only_sources" >> "$GITHUB_OUTPUT"echo "Only data warehouse import sources changed: $only_sources"+ # A change that only touches Markdown docs (e.g. a README under+ # posthog/) still matches the broad backend globs above, needlessly+ # running the whole backend suite. Drop the backend signal when+ # every backend-matched file is Markdown.+ # PR/merge_group events only; push keeps the default full run.+ - name: Ignore Markdown-only changes for backend+ id: backend_docs+ if: github.event_name != 'push'+ # If this step ever errors, the job output falls back to+ # backend='true', so a failure here can only over-run the+ # backend suite, never wrongly skip it.+ continue-on-error: true+ env:+ BACKEND: ${{ steps.filter.outputs.backend }}+ BACKEND_FILES: ${{ steps.filter.outputs.backend_files }}+ run: |+ backend="$BACKEND"+ if [ "$backend" = "true" ] && [ -n "$BACKEND_FILES" ]; then+ # backend_files is in dorny/paths-filter's "escape" format+ # (space-delimited, backslash-escaped). Decode it with xargs+ # so paths containing whitespace stay intact and a very long+ # list can't overflow the argument list, then skip the backend+ # suite only when every changed file is Markdown.+ if files=$(printf '%s' "$BACKEND_FILES" | xargs -n1); then+ if ! printf '%s\n' "$files" | grep -qvE '\.(md|mdx)$'; then+ backend=false+ fi+ fi+ fi+ echo "backend=$backend" >> "$GITHUB_OUTPUT"+ echo "Backend tests needed: $backend"+detect-snapshot-mode:name: Detect snapshot moderuns-on: depot-ubuntu-latest