Skip to content

[build-tools] Add eas/posthog_upload_sourcemaps workflow function#3947

Open
gwdp wants to merge 1 commit into
gwdp/eng-21551-posthog-wait-for-metricfrom
gwdp/eng-21551-posthog-upload-sourcemaps
Open

[build-tools] Add eas/posthog_upload_sourcemaps workflow function#3947
gwdp wants to merge 1 commit into
gwdp/eng-21551-posthog-wait-for-metricfrom
gwdp/eng-21551-posthog-upload-sourcemaps

Conversation

@gwdp

@gwdp gwdp commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Why

Upload your app's source maps to PostHog from a workflow, so error-tracking stack traces are readable instead of minified. For EAS Update and custom builds, where the automatic build-time upload doesn't run.

How

Adds eas/posthog_upload_sourcemaps. Runs @posthog/cli hermes upload against a directory (default dist) with the connect step's POSTHOG_CLI_* creds. Chunk IDs are injected at bundle time by PostHog's Expo metro config (getPostHogExpoConfig), so this step just ships what's already in the export.

ignore_error (default false) fails the step on an upload error; set it true to warn and continue.
(This is the outlier of the posthog functions, but felt the right call, defaults to fail; Lmk if different thoughts)

Test Plan

CI passes. Ran it live against coin-flip with the metro config in place: expo export --source-maps then this step uploaded the Hermes map to PostHog (Found 1 maps to upload, 1 upload keys). Test workflow below covers the happy path plus a forced failure and an ignored one.

Test workflow
name: PostHog source map upload test

jobs:
  upload_sourcemaps:
    environment: production
    steps:
      - uses: eas/checkout
      - run: npm ci
      - run: npx expo export --source-maps --platform ios
      - uses: eas/posthog_upload_sourcemaps
        with:
          directory: dist

  upload_failure:
    environment: production
    steps:
      - uses: eas/posthog_upload_sourcemaps
        with:
          directory: does-not-exist

  ignored_failure:
    environment: production
    steps:
      - uses: eas/posthog_upload_sourcemaps
        with:
          directory: does-not-exist
          ignore_error: true
Screenshot 2026-07-03 at 2 15 05 PM Screenshot 2026-07-03 at 2 15 15 PM Screenshot 2026-07-03 at 2 17 52 PM Screenshot 2026-07-03 at 2 17 56 PM Screenshot 2026-07-03 at 2 18 29 PM

@linear-code

linear-code Bot commented Jul 3, 2026

Copy link
Copy Markdown

ENG-21551

gwdp commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.71%. Comparing base (bc4056b) to head (d089cc8).

Additional details and impacted files
@@                            Coverage Diff                             @@
##           gwdp/eng-21551-posthog-wait-for-metric    #3947      +/-   ##
==========================================================================
+ Coverage                                   59.69%   59.71%   +0.03%     
==========================================================================
  Files                                         942      943       +1     
  Lines                                       41555    41579      +24     
  Branches                                     8757     8758       +1     
==========================================================================
+ Hits                                        24802    24826      +24     
  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-upload-sourcemaps branch 2 times, most recently from b6df873 to eb91e64 Compare July 3, 2026 21:40
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-metric branch from a8e1b57 to f630079 Compare July 3, 2026 21:40
@gwdp gwdp requested a review from sjchmiela July 3, 2026 21:46
@gwdp gwdp marked this pull request as ready for review July 3, 2026 21:46
@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.

logger.info(`Uploading source maps from "${directory}" to PostHog`);
try {
await spawn(
'npx',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we might need -y?

@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-upload-sourcemaps branch from eb91e64 to 7d0223e Compare July 6, 2026 19:51
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-metric branch 2 times, most recently from 28718f6 to 6e72fed Compare July 6, 2026 20:40
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-upload-sourcemaps branch 2 times, most recently from 6952ef5 to fc5c5d9 Compare July 6, 2026 21:59
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-metric branch from 6e72fed to 2755d8a Compare July 6, 2026 21:59
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-upload-sourcemaps branch from fc5c5d9 to abdc0c9 Compare July 6, 2026 22:21
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-metric branch 2 times, most recently from 58cfdcf to 9d6b3f4 Compare July 6, 2026 22:54
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-upload-sourcemaps branch 2 times, most recently from fc81011 to cdfc8f9 Compare July 6, 2026 23:35
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-metric branch from 9d6b3f4 to 01a7642 Compare July 6, 2026 23:35
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-metric branch from 01a7642 to 9a9a276 Compare July 6, 2026 23:50
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-upload-sourcemaps branch from cdfc8f9 to 82b0571 Compare July 6, 2026 23:50
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-upload-sourcemaps branch from 82b0571 to d089cc8 Compare July 7, 2026 23:43
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-metric branch from 9a9a276 to bc4056b 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