Skip to content

Commit da553eb

Browse files
authored
feat: making it feature parity with the cli (#4)
* [refactor] add `with error tracking write scope` to readme * [feat] make it feature parity with the cli
1 parent 4045df6 commit da553eb

File tree

2 files changed

+53
-8
lines changed

2 files changed

+53
-8
lines changed

README.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ See the PostHog documentation for end-to-end guidance: [Upload source maps](http
1111

1212
## Inputs
1313

14-
| **Name** | **Required** | **Description** |
15-
| ----------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
16-
| `directory` | Yes | Directory containing built assets (e.g., `dist`) |
17-
| `env-id` | Yes | PostHog environment ID. See [environment settings](https://app.posthog.com/settings/environment#variables) |
18-
| `cli-token` | Yes | PostHog CLI token with error tracking write scope. See [API key settings](https://app.posthog.com/settings/user-api-keys#variables) |
19-
| `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 |
20-
| `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 |
21-
| `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` |
14+
| **Name** | **Required** | **Description** |
15+
| ---------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
16+
| `directory` | Yes | Directory containing built assets (e.g., `dist`) |
17+
| `env-id` | Yes | PostHog environment ID. See [environment settings](https://app.posthog.com/settings/environment#variables) |
18+
| `cli-token` | Yes | PostHog CLI token with error tracking write scope. See [API key settings](https://app.posthog.com/settings/user-api-keys#variables) |
19+
| `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 |
20+
| `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 |
21+
| `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` |
22+
| `delete-after-upload` | No | Whether to delete the source map files after uploading them (default: `false`) |
23+
| `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`) |
24+
| `batch-size` | No | The maximum number of chunks to upload in a single batch (default: 50) |
25+
| `ignore` | No | One or more directory glob patterns to ignore (comma-separated, e.g., `node_modules,*.test.js`) |
2226

2327
## Example usage
2428

@@ -58,4 +62,16 @@ jobs:
5862

5963
# If the current Git commit is not accessible, set the version explicitly
6064
# version: 1.2.3
65+
66+
# Delete source map files after uploading
67+
# delete-after-upload: true
68+
69+
# Skip SSL verification (only for self-signed certificates)
70+
# skip-ssl-verification: true
71+
72+
# Custom batch size for uploads
73+
# batch-size: 100
74+
75+
# Ignore specific patterns
76+
# ignore: node_modules,*.test.js,coverage
6177
```

action.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ inputs:
2727
host:
2828
description: "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`"
2929
required: false
30+
delete-after-upload:
31+
description: "Whether to delete the source map files after uploading them"
32+
required: false
33+
default: "false"
34+
skip-ssl-verification:
35+
description: "Whether to skip SSL verification when uploading chunks - only use when using self-signed certificates for self-deployed instances"
36+
required: false
37+
default: "false"
38+
batch-size:
39+
description: "The maximum number of chunks to upload in a single batch (default: 50)"
40+
required: false
41+
ignore:
42+
description: "One or more directory glob patterns to ignore (comma-separated)"
43+
required: false
3044

3145
runs:
3246
using: "composite"
@@ -53,4 +67,19 @@ runs:
5367
if [ -n "${{ inputs.version }}" ]; then
5468
args+=(--version "${{ inputs.version }}")
5569
fi
70+
if [ "${{ inputs.delete-after-upload }}" = "true" ]; then
71+
args+=(--delete-after)
72+
fi
73+
if [ "${{ inputs.skip-ssl-verification }}" = "true" ]; then
74+
args+=(--skip-ssl-verification)
75+
fi
76+
if [ -n "${{ inputs.batch-size }}" ]; then
77+
args+=(--batch-size "${{ inputs.batch-size }}")
78+
fi
79+
if [ -n "${{ inputs.ignore }}" ]; then
80+
IFS=',' read -ra IGNORE_PATTERNS <<< "${{ inputs.ignore }}"
81+
for pattern in "${IGNORE_PATTERNS[@]}"; do
82+
args+=(--ignore "${pattern// /}")
83+
done
84+
fi
5685
posthog-cli "${global_args[@]}" sourcemap process "${args[@]}"

0 commit comments

Comments
 (0)