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): stop publishing parser packages from pull requests (#102527)

Raúl Negrón-Otero374ca6fcb21e
diff --git a/.github/workflows/build-hogql-parser-npm.yml b/.github/workflows/build-hogql-parser-npm.yml
index a4a1d96529c3..9f26d78551c7 100644
--- a/.github/workflows/build-hogql-parser-npm.yml
+++ b/.github/workflows/build-hogql-parser-npm.yml
@@ -5,14 +5,14 @@ on:
paths:
- common/hogql_parser/**
- .github/workflows/build-hogql-parser-npm.yml
+ workflow_dispatch:
permissions:
contents: read
- pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
- cancel-in-progress: true
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# npm's audit blocks the pnpm bootstrap. See .github/actions/pnpm-install for why.
@@ -24,9 +24,10 @@ jobs:
name: Check npm package version
runs-on: ubuntu-24.04
timeout-minutes: 5
+ permissions:
+ contents: read
+ pull-requests: write
outputs:
- committed-version: ${{ steps.check-package-version.outputs.committed-version }}
- published-version: ${{ steps.check-package-version.outputs.published-version }}
is-new-version: ${{ steps.check-package-version.outputs.is-new-version }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -36,6 +37,7 @@ jobs:
- name: Check if common/hogql_parser/ has changed
id: changed-files
+ if: github.event_name == 'pull_request'
uses: step-security/changed-files@2e07db73e5ccdb319b9a6c7766bd46d39d304bad # v47.0.5
with:
files_yaml: |
@@ -54,7 +56,6 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMITTED_VERSION: ${{ steps.check-package-version.outputs.committed-version }}
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != 'PostHog/posthog' }}
- PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
message_body="It looks like the code of \`@posthog/hogql-parser\` (npm) changed in this PR, but its version stayed the same at $COMMITTED_VERSION. 👀"
message_body+=$'\n'"Make sure to resolve this in \`common/hogql_parser/package.json\` before merging!"
@@ -64,7 +65,7 @@ jobs:
if [ -f .github/scripts/post-reminder-section.mjs ]; then
BODY="$message_body" GITHUB_TOKEN="$GH_TOKEN" node .github/scripts/post-reminder-section.mjs hogql-parser-npm warn "version bump needed"
else
- echo "Skipping hogql-parser-npm section — script not present on this checkout"
+ echo "$message_body"
fi
# Version was bumped — mark any reminder from an earlier push resolved.
@@ -84,7 +85,8 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 30
if: needs.check-package-version.outputs.is-new-version == 'true' &&
- github.event.pull_request.head.repo.full_name == 'PostHog/posthog'
+ (github.event_name == 'workflow_dispatch' ||
+ github.event.pull_request.head.repo.full_name == 'PostHog/posthog')
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -107,6 +109,10 @@ jobs:
publish-npm:
name: Publish on npm
needs: build-wasm
+ # A version must not ship before the code that produces it lands, so a release
+ # is a manual dispatch on master and never a pull request run.
+ if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' && github.repository == 'PostHog/posthog'
+ environment: npm-hogql-parser
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
@@ -132,72 +138,3 @@ jobs:
env:
NODE_AUTH_TOKEN: ''
NPM_CONFIG_PROVENANCE: true
-
- # Use GitHub app token so Actions run after committing changes
- - name: Get app token
- id: app-token
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
- with:
- client-id: ${{ secrets.GH_APP_POSTHOG_TESTS_APP_ID }}
- private-key: ${{ secrets.GH_APP_POSTHOG_TESTS_PRIVATE_KEY }}
-
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- with:
- ref: ${{ github.event.pull_request.head.ref }}
- token: ${{ steps.app-token.outputs.token }}
-
- - name: Install pnpm
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
-
- - name: Fix node-gyp permissions
- run: find ~/setup-pnpm -name gyp_main.py -exec chmod +x {} +
-
- - name: Set up Node.js
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- with:
- node-version-file: .nvmrc
-
- # Direct install: Publishing commits to the PR head, which may predate the local action.
- - name: Install uv
- id: setup-uv
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
- with:
- version: '0.12.13'
-
- - name: Update @posthog/hogql-parser in frontend
- shell: bash
- env:
- RETRIES: 20
- run: |
- VERSION=$(node -p "require('./common/hogql_parser/package.json').version")
- for i in $(seq 1 $RETRIES); do
- if pnpm --filter=@posthog/frontend add "@posthog/hogql-parser@$VERSION"; then
- break
- fi
- if [[ $i -eq $RETRIES ]]; then
- echo "Failed to update @posthog/hogql-parser in frontend"
- exit 1
- fi
- sleep 0.5
- done
-
- - name: Check for pin changes
- id: check-pin
- shell: bash
- run: |
- if git diff --quiet frontend/package.json pnpm-lock.yaml; then
- echo "changed=false" >> $GITHUB_OUTPUT
- else
- echo "changed=true" >> $GITHUB_OUTPUT
- fi
-
- - name: Commit pin
- if: steps.check-pin.outputs.changed == 'true'
- uses: planetscale/ghcommit-action@25309d8005ac7c3bcd61d3fe19b69e0fe47dbdde # v0.2.20
- with:
- commit_message: 'Use new @posthog/hogql-parser npm version'
- repo: ${{ github.repository }}
- branch: ${{ github.event.pull_request.head.ref }}
- file_pattern: 'frontend/package.json pnpm-lock.yaml'
- env:
- GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
diff --git a/.github/workflows/build-hogql-parser-rs.yml b/.github/workflows/build-hogql-parser-rs.yml
index 52d15d0b5170..7fd9ee14526c 100644
--- a/.github/workflows/build-hogql-parser-rs.yml
+++ b/.github/workflows/build-hogql-parser-rs.yml
@@ -5,23 +5,25 @@ on:
paths:
- rust/hogql/parser/**
- .github/workflows/build-hogql-parser-rs.yml
+ workflow_dispatch:
permissions:
contents: read
- pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
- cancel-in-progress: true
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check-version:
name: Check version legitimacy
runs-on: ubuntu-22.04
timeout-minutes: 5
+ permissions:
+ contents: read
+ pull-requests: write
outputs:
parser-release-needed: ${{ steps.version.outputs.parser-release-needed }}
- local-version: ${{ steps.version.outputs.local-version }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
@@ -30,6 +32,7 @@ jobs:
- name: Check if rust/hogql/parser/ or the workflow has changed
id: changed-files
+ if: github.event_name == 'pull_request'
uses: step-security/changed-files@2e07db73e5ccdb319b9a6c7766bd46d39d304bad # v47.0.5
with:
files_yaml: |
@@ -43,21 +46,21 @@ jobs:
id: version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- PARSER_CHANGED: ${{ steps.changed-files.outputs.parser_any_changed }}
+ # A manual dispatch is already a release decision, so it checks the version
+ # without asking which files changed.
+ PARSER_CHANGED: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.changed-files.outputs.parser_any_changed }}
WORKFLOW_CHANGED: ${{ steps.changed-files.outputs.workflow_any_changed }}
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != 'PostHog/posthog' }}
- PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
parser_release_needed='false'
- # Local version from the pyproject.toml — single source of truth, matches Cargo.toml.
- local=$(grep -m1 '^version = ' rust/hogql/parser/pyproject.toml | sed -E 's/version = "(.*)"/\1/')
- echo "local-version=$local" >> $GITHUB_OUTPUT
if [[ "$PARSER_CHANGED" == 'true' ]]; then
+ # Local version from the pyproject.toml — single source of truth, matches Cargo.toml.
+ local=$(grep -m1 '^version = ' rust/hogql/parser/pyproject.toml | sed -E 's/version = "(.*)"/\1/')
# 200 = version already on PyPI, 404 = needs release.
http_code=$(curl -o /dev/null -sSL -w '%{http_code}' "https://pypi.org/pypi/hogql-parser-rs/$local/json")
if [[ "$http_code" == '404' ]]; then
parser_release_needed='true'
- # Version was bumped — mark any reminder from an earlier push resolved.
+ # Version was bumped, so mark any reminder from an earlier push resolved.
if [ -f .github/scripts/post-reminder-section.mjs ]; then
GITHUB_TOKEN="$GH_TOKEN" node .github/scripts/post-reminder-section.mjs hogql-parser-rs --clear "version bumped to $local"
fi
@@ -67,17 +70,19 @@ jobs:
if [[ "$IS_FORK" == 'true' ]]; then
message_body+=$'\n'"This needs to be performed on a branch created on the PostHog/posthog repo itself. A PostHog team member can assist with this."
fi
- if [ -f .github/scripts/post-reminder-section.mjs ]; then
+ if [[ "$GITHUB_EVENT_NAME" != 'pull_request' ]]; then
+ echo "::warning::hogql-parser-rs $local is already on PyPI, so this run publishes nothing. Bump the version to release a new one."
+ elif [ -f .github/scripts/post-reminder-section.mjs ]; then
BODY="$message_body" GITHUB_TOKEN="$GH_TOKEN" node .github/scripts/post-reminder-section.mjs hogql-parser-rs warn "version bump needed"
else
- echo "Skipping hogql-parser-rs section — script not present on this checkout"
+ echo "$message_body"
fi
else
echo "::warning::Unexpected HTTP $http_code from PyPI for hogql-parser-rs $local; assuming not yet published."
parser_release_needed='true'
fi
fi
- # Exercise the release pipeline on workflow-only edits; skip-existing makes publish a no-op.
+ # Build the wheels on workflow-only edits too, so a change to this file is checked.
if [[ "$WORKFLOW_CHANGED" == 'true' ]]; then
parser_release_needed='true'
fi
@@ -99,7 +104,8 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
if: needs.check-version.outputs.parser-release-needed == 'true' &&
- github.event.pull_request.head.repo.full_name == 'PostHog/posthog'
+ (github.event_name == 'workflow_dispatch' ||
+ github.event.pull_request.head.repo.full_name == 'PostHog/posthog')
strategy:
fail-fast: false
matrix:
@@ -164,7 +170,10 @@ jobs:
publish:
name: Publish on PyPI
- needs: [check-version, build-wheels]
+ needs: build-wheels
+ # A version must not ship before the code that produces it lands, so a release
+ # is a manual dispatch on master and never a pull request run.
+ if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' && github.repository == 'PostHog/posthog'
environment: pypi-hogql-parser-rs
permissions:
id-token: write # PyPI trusted publishing + provenance OIDC handshake
@@ -190,91 +199,3 @@ jobs:
# Attaches the attestations generated above to the PyPI release.
attestations: true
skip-existing: true
-
- - name: Get app token
- id: app-token
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
- with:
- client-id: ${{ secrets.GH_APP_POSTHOG_TESTS_APP_ID }}
- private-key: ${{ secrets.GH_APP_POSTHOG_TESTS_PRIVATE_KEY }}
-
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- with:
- ref: ${{ github.event.pull_request.head.ref }}
- token: ${{ steps.app-token.outputs.token }}
-
- - name: Set up Python
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- with:
- python-version: 3.13.13
-
- # Direct install: Publishing commits to the PR head, which may predate the local action.
- - name: Install uv
- id: setup-uv
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
- with:
- version: '0.12.13'
- enable-cache: true
- cache-dependency-glob: uv.lock
- save-cache: ${{ github.ref == 'refs/heads/master' }}
-
- - name: Update hogql-parser-rs in requirements
- shell: bash
- env:
- RETRIES: 20
- VERSION: ${{ needs.check-version.outputs.local-version }}
- run: |
- # `--refresh-package` bypasses the restored uv index cache, which
- # otherwise won't have the version we just published. Retry anyway
- # in case PyPI propagation lags the publish step.
- for i in $(seq 1 "$RETRIES"); do
- if uv add --refresh-package hogql-parser-rs "hogql-parser-rs==$VERSION"; then
- break
- fi
- if [[ $i -eq $RETRIES ]]; then
- echo "Failed to update hogql-parser-rs in requirements"
- exit 1
- fi
- sleep 0.5
- done
-
- - name: Check for pin changes
- id: check-pin
- shell: bash
- run: |
- if git diff --quiet pyproject.toml uv.lock; then
- echo "changed=false" >> $GITHUB_OUTPUT
- else
- echo "changed=true" >> $GITHUB_OUTPUT
- fi
-
- - name: Commit pin
- if: steps.check-pin.outputs.changed == 'true'
- uses: planetscale/ghcommit-action@25309d8005ac7c3bcd61d3fe19b69e0fe47dbdde # v0.2.20
- with:
- commit_message: 'Use new hogql-parser-rs version'
- repo: ${{ github.repository }}
- branch: ${{ github.event.pull_request.head.ref }}
- file_pattern: 'pyproject.toml uv.lock'
- env:
- GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
-
- - name: Verify pin is consistent with the published version
- shell: bash
- env:
- CHANGED: ${{ steps.check-pin.outputs.changed }}
- VERSION: ${{ needs.check-version.outputs.local-version }}
- run: |
- # The commit step is a no-op when pyproject.toml + uv.lock were already
- # pre-bumped on the branch to the version we just published — fine.
- # Verify the pin is consistent with the published version (i.e. the
- # branch is in a deployable state) before declaring success.
- if [[ "$CHANGED" != "true" ]]; then
- pinned=$(grep -m1 'hogql-parser-rs==' pyproject.toml | sed -E 's/.*hogql-parser-rs==([^"]*).*/\1/')
- if [[ "$pinned" != "$VERSION" ]]; then
- echo "::error::hogql-parser-rs published to PyPI as $VERSION but pyproject.toml pin says $pinned."
- echo "Check the 'Update hogql-parser-rs in requirements' step above for why uv add did not produce a diff."
- exit 1
- fi
- echo "pyproject.toml already pinned to $VERSION; commit-pin no-op is expected."
- fi
diff --git a/.github/workflows/build-hogql-parser.yml b/.github/workflows/build-hogql-parser.yml
index 5b3a8a8ce014..3ac5d374f7d2 100644
--- a/.github/workflows/build-hogql-parser.yml
+++ b/.github/workflows/build-hogql-parser.yml
@@ -5,23 +5,25 @@ on:
paths:
- common/hogql_parser/**
- .github/workflows/build-hogql-parser.yml
+ workflow_dispatch:
permissions:
contents: read
- pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
- cancel-in-progress: true
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check-version:
name: Check version legitimacy
runs-on: ubuntu-22.04
timeout-minutes: 5
+ permissions:
+ contents: read
+ pull-requests: write
outputs:
parser-release-needed: ${{ steps.version.outputs.parser-release-needed }}
- version-release-needed: ${{ steps.version.outputs.version-release-needed }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
@@ -30,6 +32,7 @@ jobs:
- name: Check if common/hogql_parser/ or the workflow has changed
id: changed-files
+ if: github.event_name == 'pull_request'
uses: step-security/changed-files@2e07db73e5ccdb319b9a6c7766bd46d39d304bad # v47.0.5
with:
files_yaml: |
@@ -43,10 +46,11 @@ jobs:
id: version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- PARSER_CHANGED: ${{ steps.changed-files.outputs.parser_any_changed }}
+ # A manual dispatch is already a release decision, so it checks the version
+ # without asking which files changed.
+ PARSER_CHANGED: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.changed-files.outputs.parser_any_changed }}
WORKFLOW_CHANGED: ${{ steps.changed-files.outputs.workflow_any_changed }}
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != 'PostHog/posthog' }}
- PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
parser_release_needed='false'
if [[ "$PARSER_CHANGED" == 'true' ]]; then
@@ -55,7 +59,7 @@ jobs:
http_code=$(curl -o /dev/null -sSL -w '%{http_code}' "https://pypi.org/pypi/hogql-parser/$local/json")
if [[ "$http_code" == '404' ]]; then
parser_release_needed='true'
- # Version was bumped — mark any reminder from an earlier push resolved.
+ # Version was bumped, so mark any reminder from an earlier push resolved.
if [ -f .github/scripts/post-reminder-section.mjs ]; then
GITHUB_TOKEN="$GH_TOKEN" node .github/scripts/post-reminder-section.mjs hogql-parser-py --clear "version bumped to $local"
fi
@@ -65,21 +69,19 @@ jobs:
if [[ "$IS_FORK" == 'true' ]]; then
message_body+=$'\n'"This needs to be performed on a branch created on the PostHog/posthog repo itself. A PostHog team member can assist with this."
fi
- if [ -f .github/scripts/post-reminder-section.mjs ]; then
+ if [[ "$GITHUB_EVENT_NAME" != 'pull_request' ]]; then
+ echo "::warning::hogql-parser $local is already on PyPI, so this run publishes nothing. Bump the version to release a new one."
+ elif [ -f .github/scripts/post-reminder-section.mjs ]; then
BODY="$message_body" GITHUB_TOKEN="$GH_TOKEN" node .github/scripts/post-reminder-section.mjs hogql-parser-py warn "version bump needed"
else
- echo "Skipping hogql-parser-py section — script not present on this checkout"
+ echo "$message_body"
fi
else
echo "::warning::Unexpected HTTP $http_code from PyPI for hogql-parser $local; assuming not yet published."
parser_release_needed='true'
fi
fi
- # A genuinely new version (the 404/unknown cases above) — not a workflow-only
- # exercise — is what must move the pyproject/uv.lock pin. Emit it now, before
- # the workflow-only override below raises parser-release-needed on its own.
- echo "version-release-needed=$parser_release_needed" >> $GITHUB_OUTPUT
- # Exercise the release pipeline on workflow-only edits; skip-existing makes publish a no-op.
+ # Build the wheels on workflow-only edits too, so a change to this file is checked.
if [[ "$WORKFLOW_CHANGED" == 'true' ]]; then
parser_release_needed='true'
fi
@@ -91,7 +93,8 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
if: needs.check-version.outputs.parser-release-needed == 'true' &&
- github.event.pull_request.head.repo.full_name == 'PostHog/posthog'
+ (github.event_name == 'workflow_dispatch' ||
+ github.event.pull_request.head.repo.full_name == 'PostHog/posthog')
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm, macos-14, macos-15-intel]
@@ -144,7 +147,10 @@ jobs:
publish:
name: Publish on PyPI
- needs: [check-version, build-wheels]
+ needs: build-wheels
+ # A version must not ship before the code that produces it lands, so a release
+ # is a manual dispatch on master and never a pull request run.
+ if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' && github.repository == 'PostHog/posthog'
environment: pypi-hogql-parser
permissions:
id-token: write
@@ -179,90 +185,3 @@ jobs:
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
skip-existing: true
-
- # Use GitHub app token so Actions run after commiting changes
- - name: Get app token
- id: app-token
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
- with:
- client-id: ${{ secrets.GH_APP_POSTHOG_TESTS_APP_ID }}
- private-key: ${{ secrets.GH_APP_POSTHOG_TESTS_PRIVATE_KEY }}
-
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- with:
- ref: ${{ github.event.pull_request.head.ref }}
- token: ${{ steps.app-token.outputs.token }}
-
- - name: Set up Python
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- with:
- python-version: 3.13.13
-
- # Direct install: Publishing commits to the PR head, which may predate the local action.
- - name: Install uv
- id: setup-uv
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
- with:
- version: '0.12.13'
- enable-cache: true
- cache-dependency-glob: uv.lock
- save-cache: ${{ github.ref == 'refs/heads/master' }}
-
- - name: Update hogql-parser in requirements
- shell: bash
- env:
- RETRIES: 20
- run: |
- # setuptools isn't installed by default after actions/setup-python, but
- # `python setup.py --version` needs it. Mirrors the sdist step above.
- pip install setuptools==80.9.0
- VERSION=$(cd common/hogql_parser && python setup.py --version)
- # `--refresh-package` bypasses the restored uv index cache, which
- # otherwise won't have the version we just published. Retry anyway
- # in case PyPI propagation lags the publish step.
- for i in $(seq 1 "$RETRIES"); do
- if uv add --refresh-package hogql-parser "hogql-parser==$VERSION"; then
- break
- fi
- if [[ $i -eq $RETRIES ]]; then
- echo "Failed to update hogql-parser in requirements"
- exit 1
- fi
- sleep 0.5
- done
-
- - name: Check for pin changes
- id: check-pin
- shell: bash
- run: |
- if git diff --quiet pyproject.toml uv.lock; then
- echo "changed=false" >> $GITHUB_OUTPUT
- else
- echo "changed=true" >> $GITHUB_OUTPUT
- fi
-
- - name: Commit pin
- if: steps.check-pin.outputs.changed == 'true'
- uses: planetscale/ghcommit-action@25309d8005ac7c3bcd61d3fe19b69e0fe47dbdde # v0.2.20
- with:
- commit_message: 'Use new hogql-parser version'
- repo: ${{ github.repository }}
- branch: ${{ github.event.pull_request.head.ref }}
- file_pattern: 'pyproject.toml uv.lock'
- env:
- GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
-
- - name: Fail if pin update produced no commit
- # Only a real version release must move the pin. Workflow-only edits
- # exercise the pipeline as a skip-existing no-op and legitimately leave
- # the pin untouched, so the guard must not fire for them.
- if: needs.check-version.outputs.version-release-needed == 'true'
- shell: bash
- env:
- CHANGED: ${{ steps.check-pin.outputs.changed }}
- run: |
- if [[ "$CHANGED" != "true" ]]; then
- echo "::error::hogql-parser wheel was published to PyPI but pyproject.toml pin was not updated."
- echo "Check the 'Update hogql-parser in requirements' step above for why uv add did not produce a diff."
- exit 1
- fi
diff --git a/rust/hogql/parser/README.md b/rust/hogql/parser/README.md
index 3c494e3831f0..db7823c88c56 100644
--- a/rust/hogql/parser/README.md
+++ b/rust/hogql/parser/README.md
@@ -143,9 +143,10 @@ enforces this.)
Version is intentionally locked in step with
[`common/hogql_parser`](../../../common/hogql_parser) (the C++ parser
-PyPI package) so a bump signals "both parsers move together." The
-publish workflow builds wheels, pushes to PyPI via trusted publishing,
-then opens a follow-up PR that updates the repo-root pin.
+PyPI package) so a bump signals "both parsers move together." A pull
+request that bumps the version builds the wheels as a check.
+Publishing is a manual dispatch of that workflow from `master`, and
+moving the repo-root pin is a separate pull request afterwards.
## Adding a new grammar feature
diff --git a/tools/workflow-plan/tests/workflows.test.ts b/tools/workflow-plan/tests/workflows.test.ts
index 2778c325030b..2995dedc6303 100644
--- a/tools/workflow-plan/tests/workflows.test.ts
+++ b/tools/workflow-plan/tests/workflows.test.ts
@@ -87,6 +87,55 @@ const frontend = suite('ci-frontend.yml', frontendSelectors)
const deltalite = suite('build-deltalite.yml')
const PINNED_WORKFLOWS = ['ci-backend.yml', 'ci-frontend.yml']
+interface ReleaseWorkflow {
+ file: string
+ // The job that decides whether the version needs a release, plus the step and output carrying
+ // that verdict. Naming them rather than deriving them keeps a renamed job a test failure.
+ check: string
+ step: string
+ output: string
+ build: string
+ publish: string
+}
+
+// The two PyPI parsers share a job layout; the npm one names everything differently.
+const PYPI_PARSER_JOBS = {
+ check: 'check-version',
+ step: 'version',
+ output: 'parser-release-needed',
+ build: 'build-wheels',
+ publish: 'publish',
+} as const
+
+const RELEASE_WORKFLOWS: ReleaseWorkflow[] = [
+ { file: 'build-hogql-parser.yml', ...PYPI_PARSER_JOBS },
+ { file: 'build-hogql-parser-rs.yml', ...PYPI_PARSER_JOBS },
+ {
+ file: 'build-hogql-parser-npm.yml',
+ check: 'check-package-version',
+ step: 'check-package-version',
+ output: 'is-new-version',
+ build: 'build-wasm',
+ publish: 'publish-npm',
+ },
+]
+
+// A release workflow builds its artifacts on a pull request as a check. Only a manual dispatch
+// from master reaches the job that uploads to a registry. The version verdict is stubbed true,
+// so the publish job is held back by the event and the ref alone.
+const releaseExpectations = ({ file, check, step, output, build, publish }: ReleaseWorkflow): Expectation[] => {
+ const release = suite(file, { [check]: { [step]: { outputs: { [output]: 'true' } } } })
+ return [
+ release({ name: 'ready PR' }, { runs: [check, build], skipped: [publish] }),
+ release({ name: 'fork PR', github: pullRequest({ fork: true }) }, { runs: [check], skipped: [build, publish] }),
+ release({ name: 'master dispatch', github: workflowDispatch() }, { runs: [check, build, publish] }),
+ release(
+ { name: 'branch dispatch', github: workflowDispatch('feat/example') },
+ { runs: [check, build], skipped: [publish] }
+ ),
+ ]
+}
+
const frontendOnlyFilters: Stubs = {
changes: {
filter: pathsFilter({
@@ -340,6 +389,7 @@ const EXPECTATIONS: Expectation[] = [
results: { frontend_tests: 'cancelled' },
}
),
+ ...RELEASE_WORKFLOWS.flatMap(releaseExpectations),
deltalite({ name: 'ready PR' }, { runs: ['check-version', 'build-wheels'], skipped: ['publish'] }),
deltalite(
{ name: 'fork PR', github: pullRequest({ fork: true }) },