: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 markdown lint when its inputs are unchanged (#128853)
posthog[bot]2171e74016a0
diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.ymlindex f9a24b6719a0..0cce5c4ee88b 100644--- a/.github/workflows/ci-frontend.yml+++ b/.github/workflows/ci-frontend.yml@@ -107,6 +107,16 @@ jobs:replay_shared: >-${{ (steps.filter.outputs.replay_shared || 'true') == 'true' }}complexity_files: ${{ steps.filter.outputs.complexity_files }}+ # The API caps lists at 3000 rows. Renames expand to two paths, so a+ # count mismatch also keeps the full scan rather than trusting a partial list.+ markdown: >-+ ${{ github.event_name != 'pull_request'+ || startsWith(github.head_ref, 'trunk-merge/')+ || steps.filter.outputs.markdown != 'false'+ || github.event.pull_request.changed_files == null+ || steps.filter.outputs.all_files_count == ''+ || steps.filter.outputs.all_files_count >= 3000+ || steps.filter.outputs.all_files_count != github.event.pull_request.changed_files }}steps:# For pull requests it's not necessary to check out the code, but we# also want this to run on master, so we need to check out@@ -135,6 +145,24 @@ jobs:token: ${{ steps.app-token.outputs.token || github.token }}list-files: 'escape'filters: |+ all_files:+ - '**'+ markdown: &markdown_inputs+ - '**/*.{md,mdx}'+ - '**/.markdownlint*'+ - '.config/**'+ - '**/.gitignore'+ - '**/package.json'+ - '**/.npmrc'+ - '**/.pnpmfile.*'+ - 'pnpm-*.yaml'+ - 'patches/**'+ - '.nvmrc'+ - '.node-version'+ - '.github/workflows/ci-frontend.yml'+ - '.github/actions/paths-filter/**'+ - '.github/actions/pnpm-install/**'+ - '.github/actions/setup-pnpm/**'# Consumed as a file list (complexity_files) by the changed-file# complexity check — the PR files API, not a hand-rolled git diff.complexity:@@ -145,6 +173,7 @@ jobs:- 'products/**/*.ts'- 'products/**/*.tsx'frontend:+ - *markdown_inputs- '.github/scripts/jest-retries.cjs'- '.github/scripts/jest-select.js'- 'patches/[email protected]'@@ -438,6 +467,7 @@ jobs:run: pnpm exec oxfmt --check "**/*.{yaml,yml}"- name: Lint markdown files+ if: needs.changes.outputs.markdown != 'false'run: pnpm exec markdownlint-cli2 --config .config/.markdownlint-cli2.jsonc "**/*.{md,mdx}"frontend-bundle-size:diff --git a/tools/workflow-plan/tests/workflows.test.ts b/tools/workflow-plan/tests/workflows.test.tsindex 1b71fae63c14..b313470b1b1c 100644--- a/tools/workflow-plan/tests/workflows.test.ts+++ b/tools/workflow-plan/tests/workflows.test.ts@@ -6,7 +6,7 @@ import { readdirSync } from 'node:fs'import path from 'node:path'import { describe, expect, it } from 'vitest'-import { evaluateCondition, evaluateValue, planFunctions } from '../src/expressions.ts'+import { type JsonValue, evaluateCondition, evaluateValue, planFunctions } from '../src/expressions.ts'import {type Outcome,type Scenario,@@ -592,6 +592,41 @@ const namedJobs = (file: string): Set<string> =>)describe('CI workflow run plans', () => {+ it.each([+ ['unrelated PR', pullRequest(), 'false', '2', 2, false],+ ['unrelated fork PR', pullRequest({ fork: true }), 'false', '2', 2, false],+ ['Markdown inputs changed', pullRequest(), 'true', '2', 2, true],+ ['missing filter output', pullRequest(), '', '', 2, true],+ ['missing file count', pullRequest(), 'false', '', 2, true],+ ['missing event count', pullRequest(), 'false', '0', null, true],+ ['incomplete list', pullRequest(), 'false', '2', 3, true],+ ['rename expands the list', pullRequest(), 'false', '3', 2, true],+ ['API file cap', pullRequest(), 'false', '3000', 3000, true],+ ['API truncated list', pullRequest(), 'false', '3000', 3001, true],+ ['merge queue', mergeQueue(), 'false', '2', 2, true],+ ['master push', push(), 'false', '2', 2, true],+ ['manual run', workflowDispatch(), 'false', '2', 2, true],+ ])('frontend Markdown lint keeps full coverage (%s)', (name, github, markdown, count, changedFiles, runs) => {+ const wf = workflow('ci-frontend.yml')+ const event = github.event as Record<string, JsonValue>+ const scenarioGithub = {+ ...github,+ event: { ...event, pull_request: { ...(event.pull_request as object), changed_files: changedFiles } },+ }+ const plan = planWorkflow(wf, {+ name,+ github: scenarioGithub,+ steps: {+ ...allFiltersChanged(wf),+ changes: { filter: { outputs: { frontend: 'true', markdown, all_files_count: count } } },+ },+ })+ expect(plan.errors).toEqual([])+ const steps = plan.jobs['frontend-format']?.steps ?? []+ expect(steps.find((step) => step.name === 'Lint markdown files')?.runs).toBe(runs)+ expect(steps.find((step) => step.name === 'Check markdown formatting with oxfmt')?.runs).toBe(true)+ })+it.each([['ready PR', pullRequest(), true, true],['merge queue', mergeQueue(), true, false],