-
-
Notifications
You must be signed in to change notification settings - Fork 40
feat: add an input to run at a subdirectory of the repo root #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "changesets-gitlab": minor | ||
| --- | ||
|
|
||
| feat: add an input to run at a subdirectory of the repo root |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,6 +161,18 @@ export const execSync = (command: string) => | |
|
|
||
| export const getOptionalInput = (name: string) => getInput(name) || undefined | ||
|
|
||
| export const getCwdInput = (): string => { | ||
| const input = getOptionalInput('cwd') | ||
| if (!input) { | ||
| return '' | ||
| } | ||
| const normalized = input.replace(/^\.\//, '').replace(/\/$/, '') | ||
| if (path.isAbsolute(normalized) || normalized.split('/').includes('..')) { | ||
| throw new Error(`Invalid cwd input: "${input}"`) | ||
| } | ||
| return normalized === '.' ? '' : normalized | ||
| } | ||
|
Comment on lines
+164
to
+174
|
||
|
|
||
| // eslint-disable-next-line sonarjs/function-return-type | ||
| export const getUsername = (api: Gitlab) => { | ||
| return ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newChangesetFileNameis now partially derived from user input (INPUT_CWD). It’s later used as thefile_namequery parameter inaddChangesetUrl; since that parameter value isn’t URL-encoded, spaces or other special characters incwdcan produce a broken link. Encode thefile_nameparameter (or further restrict allowed characters incwd).