: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): fold pr housekeeping workflows into one dispatch (#68964)
Raúl Negrón-Oteroa9ef6f6c4b75
diff --git a/.github/workflows/call-flags-project-board.yml b/.github/workflows/call-flags-project-board.ymldeleted file mode 100644index 13a4b0df42e8..000000000000--- a/.github/workflows/call-flags-project-board.yml+++ /dev/null@@ -1,25 +0,0 @@-# This workflow is used to call the flags-project-board workflow when a pull request is opened, ready for review, review requested, synchronized, converted to draft, or reopened.-# It is used to update the feature flags project board with the pull request information.--name: Call Feature Flags Project Workflow--on:- pull_request:- types: [opened, ready_for_review, review_requested, synchronize, converted_to_draft, reopened]--permissions:- contents: read--jobs:- call-flags-project:- uses: PostHog/.github/.github/workflows/flags-project-board.yml@69336b569d22687f8982eea6ff7d450a885cda05- if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}- with:- pr_number: ${{ github.event.pull_request.number }}- pr_node_id: ${{ github.event.pull_request.node_id }}- is_draft: ${{ github.event.pull_request.draft }}- # The called workflow lives in PostHog/.github and only declares `inputs:` (no `secrets:`) under- # workflow_call, so scoped secret passing isn't possible until that reusable workflow adds a- # secrets: block too.- # nosemgrep: yaml.github-actions.security.secrets-inherit.secrets-inherit- secrets: inheritdiff --git a/.github/workflows/ci-migrations-service-separation-check.yml b/.github/workflows/ci-migrations-service-separation-check.ymlindex 590ae27ffec9..8e8047948268 100644--- a/.github/workflows/ci-migrations-service-separation-check.yml+++ b/.github/workflows/ci-migrations-service-separation-check.yml@@ -1,7 +1,15 @@name: Migration & Service Separation Check+# Reusable workflow, called by pr-housekeeping.yml on every PR push.+# merge_group stays as a direct trigger for the merge queue.+on:- pull_request:+ workflow_call:+ secrets:+ GH_APP_POSTHOG_PATHS_FILTER_APP_ID:+ required: false+ GH_APP_POSTHOG_PATHS_FILTER_PRIVATE_KEY:+ required: falsemerge_group:permissions:@@ -29,7 +37,7 @@ jobs:GITHUB_REF: ${{ github.ref }}GITHUB_REPOSITORY: ${{ github.repository }}run: |- if [ "$EVENT_NAME" = "pull_request" ]; then+ if [ "$EVENT_NAME" = "pull_request" ] || [ "$EVENT_NAME" = "workflow_call" ]; thenlabels="$PR_LABELS_JSON"elif [ "$EVENT_NAME" = "merge_group" ]; then# GITHUB_REF looks like refs/heads/gh-readonly-queue/<base>/pr-<num>-<sha>diff --git a/.github/workflows/ci-turbo.yml b/.github/workflows/ci-turbo.ymlindex f5fd3008fb2b..98e686dd6a4f 100644--- a/.github/workflows/ci-turbo.yml+++ b/.github/workflows/ci-turbo.yml@@ -1,10 +1,10 @@name: Turbo CI-on:- pull_request:-concurrency:- group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}- cancel-in-progress: ${{ github.event_name == 'pull_request' }}+# Reusable workflow, called by pr-housekeeping.yml on every PR push.+# Push-cancels-previous-push comes from the caller's concurrency group.++on:+ workflow_call:jobs:turbo-affected-4:diff --git a/.github/workflows/monitor-github-rate-limit.yml b/.github/workflows/monitor-github-rate-limit.ymlindex 037bc4e5c77a..88f3ee67d9b5 100644--- a/.github/workflows/monitor-github-rate-limit.yml+++ b/.github/workflows/monitor-github-rate-limit.yml@@ -7,7 +7,8 @@ name: Monitor GitHub Rate Limit# Trigger strategy: ride real PR/master events for density (synchronize fires# on every PR push and is the dominant signal source on this repo), with a# 30-minute schedule as a quiet-time floor. A delayed scheduled tick is fine-# here — events fill the gap.+# here — events fill the gap. PR events arrive via pr-housekeeping.yml+# (workflow_call), sharing that workflow's single run dispatch.## Alerting belongs downstream in PostHog (windowed thresholds, attribution by# repo) — not in the workflow itself. Keep this file focused on emission.@@ -24,8 +25,14 @@ name: Monitor GitHub Rate Limit# To change the threshold/window, edit the insight + alert in PostHog, not here.on:- pull_request:- types: [opened, synchronize]+ workflow_call:+ secrets:+ POSTHOG_DEVEX_PROJECT_API_TOKEN:+ required: false+ GH_APP_POSTHOG_DEVEX_GENERAL_APP_ID:+ required: false+ GH_APP_POSTHOG_DEVEX_GENERAL_PRIVATE_KEY:+ required: falsepush:branches: [master]schedule:diff --git a/.github/workflows/pr-housekeeping.yml b/.github/workflows/pr-housekeeping.ymlnew file mode 100644index 000000000000..f6df5b9da1cb--- /dev/null+++ b/.github/workflows/pr-housekeeping.yml@@ -0,0 +1,83 @@+name: PR housekeeping++# One dispatch per PR event instead of eight. GitHub's run-queue cap+# (500 runs/10s/repo) counts workflow runs, and a run that calls reusable+# workflows counts once, so folding the small always-fire PR workflows+# under this parent divides the burst budget every push consumes.++on:+ pull_request:+ types: [opened, synchronize, reopened, edited, ready_for_review, review_requested, converted_to_draft]++# Keyed by event action so a new push (synchronize) cancels the previous+# push's run without cancelling runs fired by other event types on the PR.+concurrency:+ group: pr-housekeeping-${{ github.event.action }}-${{ github.event.pull_request.number }}+ cancel-in-progress: true++# Parent defaults stay read-only; jobs that need more request it explicitly.+permissions:+ contents: read+ pull-requests: read++jobs:+ lint-pr:+ if: contains(fromJSON('["opened", "edited", "synchronize"]'), github.event.action)+ uses: ./.github/workflows/pr-updated.yml++ turbo:+ if: contains(fromJSON('["opened", "synchronize", "reopened"]'), github.event.action)+ uses: ./.github/workflows/ci-turbo.yml++ rate-limit-monitor:+ if: contains(fromJSON('["opened", "synchronize"]'), github.event.action)+ uses: ./.github/workflows/monitor-github-rate-limit.yml+ secrets:+ POSTHOG_DEVEX_PROJECT_API_TOKEN: ${{ secrets.POSTHOG_DEVEX_PROJECT_API_TOKEN }}+ GH_APP_POSTHOG_DEVEX_GENERAL_APP_ID: ${{ secrets.GH_APP_POSTHOG_DEVEX_GENERAL_APP_ID }}+ GH_APP_POSTHOG_DEVEX_GENERAL_PRIVATE_KEY: ${{ secrets.GH_APP_POSTHOG_DEVEX_GENERAL_PRIVATE_KEY }}++ flags-project-board:+ # No synchronize: board status only transitions on reviewer/draft+ # changes, and pushes change neither. Re-asserting the same status on+ # every push wasted the run and fought manual card moves.+ if: contains(fromJSON('["opened", "reopened", "ready_for_review", "review_requested", "converted_to_draft"]'), github.event.action) && github.event.pull_request.head.repo.full_name == github.repository+ uses: PostHog/.github/.github/workflows/flags-project-board.yml@2db3d3b946aeb9e479ce9f0078139a67f8ef38ce+ permissions:+ contents: read+ with:+ pr_number: ${{ github.event.pull_request.number }}+ pr_node_id: ${{ github.event.pull_request.node_id }}+ is_draft: ${{ github.event.pull_request.draft }}+ secrets:+ PROJECT_BOARD_BOT_APP_ID: ${{ secrets.PROJECT_BOARD_BOT_APP_ID }}+ PROJECT_BOARD_BOT_PRIVATE_KEY: ${{ secrets.PROJECT_BOARD_BOT_PRIVATE_KEY }}++ pr-opened:+ if: contains(fromJSON('["opened", "ready_for_review"]'), github.event.action)+ uses: ./.github/workflows/pr-opened.yml+ permissions:+ pull-requests: write+ secrets:+ GH_APP_POSTHOG_ASSIGN_REVIEWERS_APP_ID: ${{ secrets.GH_APP_POSTHOG_ASSIGN_REVIEWERS_APP_ID }}+ GH_APP_POSTHOG_ASSIGN_REVIEWERS_PRIVATE_KEY: ${{ secrets.GH_APP_POSTHOG_ASSIGN_REVIEWERS_PRIVATE_KEY }}++ resolve-bot-comments:+ if: github.event.action == 'synchronize'+ uses: ./.github/workflows/pr-resolve-outdated-bot-comments.yml+ secrets:+ GH_APP_POSTHOG_REVIEW_COMMENT_RESOLVER_APP_ID: ${{ secrets.GH_APP_POSTHOG_REVIEW_COMMENT_RESOLVER_APP_ID }}+ GH_APP_POSTHOG_REVIEW_COMMENT_RESOLVER_PRIVATE_KEY: ${{ secrets.GH_APP_POSTHOG_REVIEW_COMMENT_RESOLVER_PRIVATE_KEY }}++ migrations-separation:+ if: contains(fromJSON('["opened", "synchronize", "reopened"]'), github.event.action)+ uses: ./.github/workflows/ci-migrations-service-separation-check.yml+ secrets:+ GH_APP_POSTHOG_PATHS_FILTER_APP_ID: ${{ secrets.GH_APP_POSTHOG_PATHS_FILTER_APP_ID }}+ GH_APP_POSTHOG_PATHS_FILTER_PRIVATE_KEY: ${{ secrets.GH_APP_POSTHOG_PATHS_FILTER_PRIVATE_KEY }}++ release-plan:+ if: contains(fromJSON('["opened", "synchronize", "reopened"]'), github.event.action)+ uses: ./.github/workflows/release.yml+ secrets:+ POSTHOG_API_TOKEN: ${{ secrets.POSTHOG_API_TOKEN }}diff --git a/.github/workflows/pr-opened.yml b/.github/workflows/pr-opened.ymlindex fec7a308ef00..c5cbeaa99ee7 100644--- a/.github/workflows/pr-opened.yml+++ b/.github/workflows/pr-opened.yml@@ -1,8 +1,14 @@name: Opened PR+# Reusable workflow, called by pr-housekeeping.yml on PR opened/ready_for_review.+on:- pull_request:- types: [opened, ready_for_review]+ workflow_call:+ secrets:+ GH_APP_POSTHOG_ASSIGN_REVIEWERS_APP_ID:+ required: false+ GH_APP_POSTHOG_ASSIGN_REVIEWERS_PRIVATE_KEY:+ required: falsepermissions:pull-requests: writediff --git a/.github/workflows/pr-resolve-outdated-bot-comments.yml b/.github/workflows/pr-resolve-outdated-bot-comments.ymlindex 22d46434b632..45c4a608b6c5 100644--- a/.github/workflows/pr-resolve-outdated-bot-comments.yml+++ b/.github/workflows/pr-resolve-outdated-bot-comments.yml@@ -1,16 +1,19 @@name: Resolve outdated bot comments+# Reusable workflow, called by pr-housekeeping.yml on PR synchronize.+# Push-cancels-previous-push comes from the caller's concurrency group.+on:- pull_request:- types: [synchronize]+ workflow_call:+ secrets:+ GH_APP_POSTHOG_REVIEW_COMMENT_RESOLVER_APP_ID:+ required: false+ GH_APP_POSTHOG_REVIEW_COMMENT_RESOLVER_PRIVATE_KEY:+ required: falsepermissions:contents: read-concurrency:- group: resolve-bot-comments-${{ github.event.pull_request.number }}- cancel-in-progress: true-jobs:resolve-outdated:name: Resolve outdated bot review commentsdiff --git a/.github/workflows/pr-updated.yml b/.github/workflows/pr-updated.ymlindex d581dd7d720d..640b5fd09453 100644--- a/.github/workflows/pr-updated.yml+++ b/.github/workflows/pr-updated.yml@@ -1,11 +1,9 @@name: Updated PR+# Reusable workflow, called by pr-housekeeping.yml on PR open/edit/push.+on:- pull_request:- types:- - opened- - edited- - synchronize+ workflow_call:jobs:lint-pr:diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex a2310b32368c..c95b9a5b0997 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -16,8 +16,12 @@ env:CARGO_DIST_INSTALLER_SHA256: b657cf8c04a8b7bc28f39d220f7e6dd11bbd2bdb072c552262bd9ccf597261b5# Publishing is handled by the Release CLI workflow after Release environment approval.+# Reusable workflow, called by pr-housekeeping.yml on every PR push.on:- pull_request:+ workflow_call:+ secrets:+ POSTHOG_API_TOKEN:+ required: falsejobs:# Run 'dist plan' (or host) to determine what tasks we need to do