Skip to content

[build-tools] Add eas/posthog_capture_event workflow function#3934

Open
gwdp wants to merge 1 commit into
mainfrom
gwdp/eng-21551-posthog-capture-event
Open

[build-tools] Add eas/posthog_capture_event workflow function#3934
gwdp wants to merge 1 commit into
mainfrom
gwdp/eng-21551-posthog-capture-event

Conversation

@gwdp

@gwdp gwdp commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Why

First PostHog workflow step: send an event from a workflow (e.g. mark a deploy).

How

add eas/posthog_capture_event function; Uses the env vars integrations:posthog:connect already sets, or api_key/host inputs.

No distinct_id = anonymous event, so CI runs don't create person profiles. Failures fail the step; set ignore_error: true to log a warning and continue instead (same as upload_artifact).

Test Plan

CI passes. Ran this workflow against a local — all three jobs green, both events visible in the project's PostHog activity (anonymous one under the eas-workflow person), and the ignored failure logs a warning without failing the step:

name: PostHog capture test

jobs:
  anonymous_event:
    steps:
      - uses: eas/posthog_capture_event
        with:
          event: eas_workflow_test
          properties:
            source: coin-flip-workflow-test

  identified_event:
    steps:
      - uses: eas/posthog_capture_event
        with:
          event: eas_workflow_test_identified
          distinct_id: gwdp-local-test
          properties:
            source: coin-flip-workflow-test
            variant: identified

  ignored_failure:
    steps:
      - uses: eas/posthog_capture_event
        with:
          event: eas_workflow_test_ignored
          host: https://example.com
          ignore_error: true

Workflow succeeds

Screenshot 2026-07-02 at 4 51 42 PM

Data appears on my posthog organization

Screenshot 2026-07-02 at 4 52 57 PM

@linear-code

linear-code Bot commented Jul 2, 2026

Copy link
Copy Markdown

ENG-21551

@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-capture-event branch from cd23f3a to 5ce0514 Compare July 2, 2026 18:32
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.55%. Comparing base (fc0ebff) to head (dcd93a6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3934      +/-   ##
==========================================
+ Coverage   59.44%   59.55%   +0.11%     
==========================================
  Files         937      940       +3     
  Lines       41303    41414     +111     
  Branches     8701     8725      +24     
==========================================
+ Hits        24550    24661     +111     
  Misses      16659    16659              
  Partials       94       94              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-capture-event branch 8 times, most recently from c08213f to 0d8006c Compare July 3, 2026 07:35
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
**/* @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

sjchmiela
sjchmiela previously approved these changes Jul 6, 2026
Comment thread packages/build-tools/src/steps/functions/capturePostHogEvent.ts Outdated
Comment thread packages/build-tools/src/steps/utils/posthog.ts Outdated
Comment thread packages/build-tools/src/steps/utils/posthog.ts Outdated
Comment thread packages/build-tools/src/steps/utils/posthog.ts Outdated
Comment thread packages/build-tools/src/steps/utils/posthog.ts Outdated
Comment thread packages/build-tools/src/steps/utils/posthog.ts Outdated
Comment thread packages/build-tools/src/steps/functions/capturePostHogEvent.ts Outdated
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-capture-event branch 6 times, most recently from 1c7e9db to e28aa8f Compare July 6, 2026 23:35
@gwdp

gwdp commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Ty for the review @sjchmiela! Did a good pass across the comments, and hopefully I didn't miss anything. Let me know how you feel about this direction.

@gwdp gwdp requested a review from sjchmiela July 6, 2026 23:40
@gwdp gwdp dismissed sjchmiela’s stale review July 7, 2026 23:37

significant changes since approval

@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-capture-event branch from e28aa8f to dcd93a6 Compare July 7, 2026 23:43
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants