From 034076f527f14de69415b209e7aca9b6f38563fc Mon Sep 17 00:00:00 2001 From: Vincent Lechemin Date: Wed, 22 Dec 2021 11:06:47 +0100 Subject: [PATCH] feat: add option `strip_prefix` https://docs.sentry.io/product/cli/releases/#sentry-cli-sourcemaps Co-authored-by: Tim Pope --- README.md | 1 + action.yml | 3 +++ src/main.ts | 2 ++ src/options.ts | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/README.md b/README.md index a34ca8bd..eda5e102 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ Adding the following to your workflow will create a new Sentry release and tell |`set_commits`| Specify whether to set commits for the release. Either "auto" or "skip". |"auto"| |`projects`| Space-separated list of paths of projects. When omitted, falls back to the environment variable `SENTRY_PROJECT` to determine the project. |-| |`url_prefix`| Adds a prefix to source map urls after stripping them. |-| +|`strip_prefix`|Will chop-off a prefix from all sources references inside uploaded source maps. For instance, you can use this to remove a path that is build machine specific.|-| |`strip_common_prefix`| Will remove a common prefix from uploaded filenames. Useful for removing a path that is build-machine-specific. |`false`| |`working_directory`| Directory to collect sentry release information from. Useful when collecting information from a non-standard checkout directory. |-| |`disable_telemetry`| The action sends telemetry data and crash reports to Sentry. This helps us improve the action. You can turn this off by setting this flag. |`false`| diff --git a/action.yml b/action.yml index 38976dae..93503abc 100644 --- a/action.yml +++ b/action.yml @@ -44,6 +44,9 @@ inputs: strip_common_prefix: description: 'Will remove a common prefix from uploaded filenames. Useful for removing a path that is build-machine-specific.' required: false + strip_prefix: + description: 'Will chop-off a prefix from all sources references inside uploaded source maps. For instance, you can use this to remove a path that is build machine specific.' + required: false working_directory: description: 'Directory to collect sentry release information from. Useful when collecting information from a non-standard checkout directory.' required: false diff --git a/src/main.ts b/src/main.ts index befd51ed..64d87c63 100644 --- a/src/main.ts +++ b/src/main.ts @@ -30,6 +30,7 @@ withTelemetry( const setCommitsOption = options.getSetCommitsOption(); const projects = options.getProjects(); const urlPrefix = options.getUrlPrefixOption(); + const stripPrefix = options.getStripPrefixOption(); const stripCommonPrefix = options.getBooleanOption( 'strip_common_prefix', false @@ -90,6 +91,7 @@ withTelemetry( projects: localProjects, dist, urlPrefix, + stripPrefix, stripCommonPrefix, }; return getCLI().uploadSourceMaps(version, sourceMapOptions); diff --git a/src/options.ts b/src/options.ts index 52cfe85b..19c00d4f 100644 --- a/src/options.ts +++ b/src/options.ts @@ -195,3 +195,7 @@ export const getUrlPrefixOption = (): string => { export const getWorkingDirectory = (): string => { return core.getInput('working_directory'); }; + +export const getStripPrefixOption = (): string => { + return core.getInput('strip_prefix'); +};