Skip to content

PostHog/upload-source-maps

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

PostHog source maps github action

Inject and upload JavaScript source maps to PostHog using the PostHog CLI.

Important: This action does not build your project. You are responsible for compiling your app and generating source maps (for example, by running npm run build). This action only does the following:

  • Injects source map references into your built files
  • Uploads the source maps to PostHog

See the PostHog documentation for end-to-end guidance: Upload source maps.

Inputs

Name Required Description
directory Yes Directory containing built assets (e.g., dist)
env-id Yes PostHog environment ID. See environment settings
cli-token Yes PostHog CLI token with error tracking write scope. See API key settings
project No Project identifier. If not provided, the action tries to read the Git repository name. If it cannot determine a value, the action fails
version No Release/version (e.g., commit SHA). If not provided, the action uses the current commit SHA. If it cannot determine a value, the action fails
host No PostHog host URL. If you use the US cloud, you don't need to set this. For the EU cloud, set https://eu.posthog.com
delete-after-upload No Whether to delete the source map files after uploading them (default: false)
skip-ssl-verification No Whether to skip SSL verification when uploading chunks - only use when using self-signed certificates for self-deployed instances (default: false)
batch-size No The maximum number of chunks to upload in a single batch (default: 50)
ignore No One or more directory glob patterns to ignore (comma-separated, e.g., node_modules,*.test.js)

Example usage

name: My main workflow

on:
  push:
    branches: [main]

jobs:
  build_and_upload:
    runs-on: ubuntu-latest
    steps:
      # Build the application and generate source maps
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - run: npm ci
      - run: npm run build

      # Inject and upload source maps using this action
      - name: Inject & upload source maps to PostHog
        uses: PostHog/upload-source-maps@v0.4.6.1
        with:
          directory: dist
          env-id: ${{ secrets.POSTHOG_ENV_ID }}
          cli-token: ${{ secrets.POSTHOG_CLI_TOKEN }}

          # If using the EU cloud, set the host explicitly
          # host: https://eu.posthog.com

          # If a Git repository is not accessible, set the project explicitly
          # project: my-awesome-project

          # If the current Git commit is not accessible, set the version explicitly
          # version: 1.2.3

          # Delete source map files after uploading
          # delete-after-upload: true

          # Skip SSL verification (only for self-signed certificates)
          # skip-ssl-verification: true

          # Custom batch size for uploads
          # batch-size: 100

          # Ignore specific patterns
          # ignore: node_modules,*.test.js,coverage

About

Github action which automatically injects and uploads source maps

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •