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.

fix(ci): block fork PRs from rust image build (#68628)

Georges-Antoine Assi428e3056bec5
diff --git a/.github/workflows/_rust-build-images.yml b/.github/workflows/_rust-build-images.yml
index 7a346c369def..4f5986b5c558 100644
--- a/.github/workflows/_rust-build-images.yml
+++ b/.github/workflows/_rust-build-images.yml
@@ -142,11 +142,17 @@ jobs:
- name: Retrieve sccache configuration
id: sccache
+ env:
+ IS_FORK_PR: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
run: |
+ echo "cache-key-prefix=cargo-${{ hashFiles('rust/Cargo.lock') }}" >> "$GITHUB_OUTPUT"
+ if [ "$IS_FORK_PR" = "true" ]; then
+ echo "Fork PR — skipping sccache credentials (build runs without remote cache)"
+ exit 0
+ fi
echo "endpoint=$SCCACHE_WEBDAV_ENDPOINT" >> "$GITHUB_OUTPUT"
echo "::add-mask::$SCCACHE_WEBDAV_TOKEN"
echo "token=$SCCACHE_WEBDAV_TOKEN" >> "$GITHUB_OUTPUT"
- echo "cache-key-prefix=cargo-${{ hashFiles('rust/Cargo.lock') }}" >> "$GITHUB_OUTPUT"
- name: Build and push image
id: docker_build
diff --git a/.github/workflows/rust-docker-build.yml b/.github/workflows/rust-docker-build.yml
index 89494169fb7c..c5fbb2752f62 100644
--- a/.github/workflows/rust-docker-build.yml
+++ b/.github/workflows/rust-docker-build.yml
@@ -39,7 +39,10 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 10
# Skip on workflow_dispatch — always build everything (escape hatch)
- if: github.event_name != 'workflow_dispatch'
+ if: >-
+ github.event_name != 'workflow_dispatch' &&
+ (github.event_name != 'pull_request' ||
+ github.event.pull_request.head.repo.full_name == github.repository)
permissions:
contents: read
outputs:
@@ -77,6 +80,8 @@ jobs:
# Run unless affected explicitly found zero images ('none') or failed.
if: |
always() && !cancelled() &&
+ (github.event_name != 'pull_request' ||
+ github.event.pull_request.head.repo.full_name == github.repository) &&
needs.affected.result != 'failure' &&
needs.affected.outputs.image-filter != 'none'
uses: ./.github/workflows/_rust-build-images.yml