Skip to content

: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.

chore(ci): skip openapi setup on unrelated master pushes (#127053)

posthog[bot]1aa9d3255208
diff --git a/.github/workflows/ci-openapi-codegen.yml b/.github/workflows/ci-openapi-codegen.yml
index ca7c6087e2d3..352b8b170475 100644
--- a/.github/workflows/ci-openapi-codegen.yml
+++ b/.github/workflows/ci-openapi-codegen.yml
@@ -10,7 +10,7 @@ on:
- 'tools/openapi-codegen/**'
concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
+ group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.sha || github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
@@ -38,10 +38,34 @@ jobs:
/tools/openapi-codegen/
sparse-checkout-cone-mode: false
+ - name: Check master push inputs
+ id: changes
+ if: github.event_name == 'push'
+ env:
+ BEFORE: ${{ github.event.before }}
+ # Use the complete push diff, not the trigger's first 300 changed files.
+ # Missing history or a failed comparison must run the tests.
+ run: |
+ if [[ "$BEFORE" =~ ^[0-9a-f]{40}$ ]] &&
+ git fetch --no-tags --depth=1 origin "$BEFORE" &&
+ git diff --quiet "$BEFORE" "$GITHUB_SHA" -- \
+ ':(top,glob)*' \
+ ':(top,glob)**/package.json' \
+ .github/workflows/ci-openapi-codegen.yml \
+ .github/actions/pnpm-install/ \
+ .github/actions/setup-pnpm/ \
+ .husky/ bin/fix-rdkafka-paths patches/ tools/openapi-codegen/; then
+ echo 'run=false' >> "$GITHUB_OUTPUT"
+ else
+ echo 'run=true' >> "$GITHUB_OUTPUT"
+ fi
+
- name: Install pnpm dependencies
+ if: steps.changes.outputs.run != 'false'
uses: ./.github/actions/pnpm-install
with:
install-command: pnpm --filter=@posthog/openapi-codegen install --frozen-lockfile
- name: Run tests
+ if: steps.changes.outputs.run != 'false'
run: pnpm --filter=@posthog/openapi-codegen test