chore(deps-dev): bump gts from 5.3.1 to 6.0.0 (#665)
Bumps [gts](https://github.com/google/gts) from 5.3.1 to 6.0.0. - [Release notes](https://github.com/google/gts/releases) - [Changelog](https://github.com/google/gts/blob/main/CHANGELOG.md) - [Commits](https://github.com/google/gts/compare/v5.3.1...v6.0.0) --- updated-dependencies: - dependency-name: gts dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
46
src/io.ts
46
src/io.ts
@@ -48,11 +48,11 @@ Object.entries(outputs).forEach(([name, value]) => core.setOutput(name, value));
|
||||
export function getInput<T extends input>(name: T, parseAsBool: true): boolean;
|
||||
export function getInput<T extends input>(
|
||||
name: T,
|
||||
parseAsBool?: false
|
||||
parseAsBool?: false,
|
||||
): InputTypes[T];
|
||||
export function getInput<T extends input>(
|
||||
name: T,
|
||||
parseAsBool = false
|
||||
parseAsBool = false,
|
||||
): InputTypes[T] | boolean {
|
||||
if (parseAsBool) return core.getBooleanInput(name);
|
||||
return core.getInput(name) as InputTypes[T];
|
||||
@@ -85,18 +85,18 @@ export async function checkInputs() {
|
||||
// #region add, remove
|
||||
if (!getInput('add') && !getInput('remove'))
|
||||
throw new Error(
|
||||
"Both 'add' and 'remove' are empty, the action has nothing to do."
|
||||
"Both 'add' and 'remove' are empty, the action has nothing to do.",
|
||||
);
|
||||
|
||||
if (getInput('add')) {
|
||||
const parsed = parseInputArray(getInput('add'));
|
||||
if (parsed.length === 1)
|
||||
core.info(
|
||||
'Add input parsed as single string, running 1 git add command.'
|
||||
'Add input parsed as single string, running 1 git add command.',
|
||||
);
|
||||
else if (parsed.length > 1)
|
||||
core.info(
|
||||
`Add input parsed as string array, running ${parsed.length} git add commands.`
|
||||
`Add input parsed as string array, running ${parsed.length} git add commands.`,
|
||||
);
|
||||
else core.setFailed('Add input: array length < 1');
|
||||
}
|
||||
@@ -104,11 +104,11 @@ export async function checkInputs() {
|
||||
const parsed = parseInputArray(getInput('remove') || '');
|
||||
if (parsed.length === 1)
|
||||
core.info(
|
||||
'Remove input parsed as single string, running 1 git rm command.'
|
||||
'Remove input parsed as single string, running 1 git rm command.',
|
||||
);
|
||||
else if (parsed.length > 1)
|
||||
core.info(
|
||||
`Remove input parsed as string array, running ${parsed.length} git rm commands.`
|
||||
`Remove input parsed as string array, running ${parsed.length} git rm commands.`,
|
||||
);
|
||||
else core.setFailed('Remove input: array length < 1');
|
||||
}
|
||||
@@ -119,10 +119,10 @@ export async function checkInputs() {
|
||||
if (!default_author_valid.includes(getInput('default_author')))
|
||||
throw new Error(
|
||||
`'${getInput(
|
||||
'default_author'
|
||||
'default_author',
|
||||
)}' is not a valid value for default_author. Valid values: ${default_author_valid.join(
|
||||
', '
|
||||
)}`
|
||||
', ',
|
||||
)}`,
|
||||
);
|
||||
// #endregion
|
||||
|
||||
@@ -154,11 +154,11 @@ export async function checkInputs() {
|
||||
const res = await getUserInfo(process.env.GITHUB_ACTOR);
|
||||
if (!res?.name)
|
||||
core.warning(
|
||||
"Couldn't fetch author name, filling with github_actor."
|
||||
"Couldn't fetch author name, filling with github_actor.",
|
||||
);
|
||||
if (!res?.email)
|
||||
core.warning(
|
||||
"Couldn't fetch author email, filling with github_actor."
|
||||
"Couldn't fetch author email, filling with github_actor.",
|
||||
);
|
||||
|
||||
res?.name && (name = res?.name);
|
||||
@@ -180,7 +180,7 @@ export async function checkInputs() {
|
||||
|
||||
default:
|
||||
throw new Error(
|
||||
'This should not happen, please contact the author of this action. (checkInputs.author)'
|
||||
'This should not happen, please contact the author of this action. (checkInputs.author)',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -188,8 +188,8 @@ export async function checkInputs() {
|
||||
setDefault('author_email', email);
|
||||
core.info(
|
||||
`> Using '${getInput('author_name')} <${getInput(
|
||||
'author_email'
|
||||
)}>' as author.`
|
||||
'author_email',
|
||||
)}>' as author.`,
|
||||
);
|
||||
// #endregion
|
||||
|
||||
@@ -202,20 +202,20 @@ export async function checkInputs() {
|
||||
} <${
|
||||
getInput('committer_email') ||
|
||||
getInput('author_email') + ' [from author info]'
|
||||
}>`
|
||||
}>`,
|
||||
);
|
||||
|
||||
setDefault('committer_name', getInput('author_name'));
|
||||
setDefault('committer_email', getInput('author_email'));
|
||||
core.debug(
|
||||
`Committer: ${getInput('committer_name')} <${getInput('committer_email')}>`
|
||||
`Committer: ${getInput('committer_name')} <${getInput('committer_email')}>`,
|
||||
);
|
||||
// #endregion
|
||||
|
||||
// #region message
|
||||
setDefault(
|
||||
'message',
|
||||
`Commit from GitHub Actions (${process.env.GITHUB_WORKFLOW})`
|
||||
`Commit from GitHub Actions (${process.env.GITHUB_WORKFLOW})`,
|
||||
);
|
||||
core.info(`> Using "${getInput('message')}" as commit message.`);
|
||||
// #endregion
|
||||
@@ -225,17 +225,17 @@ export async function checkInputs() {
|
||||
if (!peh_valid.includes(getInput('pathspec_error_handling')))
|
||||
throw new Error(
|
||||
`"${getInput(
|
||||
'pathspec_error_handling'
|
||||
'pathspec_error_handling',
|
||||
)}" is not a valid value for the 'pathspec_error_handling' input. Valid values are: ${peh_valid.join(
|
||||
', '
|
||||
)}`
|
||||
', ',
|
||||
)}`,
|
||||
);
|
||||
// #endregion
|
||||
|
||||
// #region pull
|
||||
if (getInput('pull') === 'NO-PULL')
|
||||
core.warning(
|
||||
"`NO-PULL` is a legacy option for the `pull` input. If you don't want the action to pull the repo, simply remove this input."
|
||||
"`NO-PULL` is a legacy option for the `pull` input. If you don't want the action to pull the repo, simply remove this input.",
|
||||
);
|
||||
// #endregion
|
||||
|
||||
@@ -257,7 +257,7 @@ export async function checkInputs() {
|
||||
// #region github_token
|
||||
if (!getInput('github_token'))
|
||||
core.warning(
|
||||
'No github_token has been detected, the action may fail if it needs to use the API'
|
||||
'No github_token has been detected, the action may fail if it needs to use the API',
|
||||
);
|
||||
// #endregion
|
||||
}
|
||||
|
||||
34
src/main.ts
34
src/main.ts
@@ -39,8 +39,8 @@ core.info(`Running in ${baseDir}`);
|
||||
core.info(`> Found ${changedFiles} changed files.`);
|
||||
core.debug(
|
||||
`--allow-empty argument detected: ${matchGitArgs(
|
||||
getInput('commit') || ''
|
||||
).includes('--allow-empty')}`
|
||||
getInput('commit') || '',
|
||||
).includes('--allow-empty')}`,
|
||||
);
|
||||
|
||||
await git
|
||||
@@ -52,7 +52,7 @@ core.info(`Running in ${baseDir}`);
|
||||
.addConfig('committer.name', getInput('committer_name'), undefined, log);
|
||||
core.debug(
|
||||
'> Current git config\n' +
|
||||
JSON.stringify((await git.listConfig()).all, null, 2)
|
||||
JSON.stringify((await git.listConfig()).all, null, 2),
|
||||
);
|
||||
|
||||
let fetchOption: string | boolean;
|
||||
@@ -65,7 +65,7 @@ core.info(`Running in ${baseDir}`);
|
||||
core.info('> Fetching repo...');
|
||||
await git.fetch(
|
||||
matchGitArgs(fetchOption === true ? '' : fetchOption),
|
||||
log
|
||||
log,
|
||||
);
|
||||
} else core.info('> Not fetching repo.');
|
||||
|
||||
@@ -75,7 +75,7 @@ core.info(`Running in ${baseDir}`);
|
||||
|
||||
if (!fetchOption)
|
||||
core.warning(
|
||||
'Creating a new branch without fetching the repo first could result in an error when pushing to GitHub. Refer to the action README for more info about this topic.'
|
||||
'Creating a new branch without fetching the repo first could result in an error when pushing to GitHub. Refer to the action README for more info about this topic.',
|
||||
);
|
||||
|
||||
await git
|
||||
@@ -109,7 +109,7 @@ core.info(`Running in ${baseDir}`);
|
||||
throw new Error(
|
||||
`There are ${
|
||||
status.conflicted.length
|
||||
} conflicting files: ${status.conflicted.join(', ')}`
|
||||
} conflicting files: ${status.conflicted.join(', ')}`,
|
||||
);
|
||||
} else core.info('> Not pulling from repo.');
|
||||
|
||||
@@ -129,7 +129,7 @@ core.info(`Running in ${baseDir}`);
|
||||
|
||||
if (!fetchOption)
|
||||
core.warning(
|
||||
'Creating a tag without fetching the repo first could result in an error when pushing to GitHub. Refer to the action README for more info about this topic.'
|
||||
'Creating a tag without fetching the repo first could result in an error when pushing to GitHub. Refer to the action README for more info about this topic.',
|
||||
);
|
||||
|
||||
await git
|
||||
@@ -158,7 +158,7 @@ core.info(`Running in ${baseDir}`);
|
||||
core.debug(
|
||||
`Running: git push origin ${
|
||||
getInput('new_branch') || ''
|
||||
} --set-upstream`
|
||||
} --set-upstream`,
|
||||
);
|
||||
await git.push(
|
||||
'origin',
|
||||
@@ -167,7 +167,7 @@ core.info(`Running in ${baseDir}`);
|
||||
(err, data?) => {
|
||||
if (data) setOutput('pushed', 'true');
|
||||
return log(err, data);
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
core.debug(`Running: git push ${pushOption}`);
|
||||
@@ -178,7 +178,7 @@ core.info(`Running in ${baseDir}`);
|
||||
(err, data?) => {
|
||||
if (data) setOutput('pushed', 'true');
|
||||
return log(err, data);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ async function add(ignoreErrors: 'all' | 'pathspec' | 'none' = 'none') {
|
||||
// If any of them fails, the whole function will return a Promise rejection
|
||||
await git
|
||||
.add(matchGitArgs(args), (err, data) =>
|
||||
log(ignoreErrors === 'all' ? null : err, data)
|
||||
log(ignoreErrors === 'all' ? null : err, data),
|
||||
)
|
||||
.catch((e: Error) => {
|
||||
// if I should ignore every error, return
|
||||
@@ -245,12 +245,12 @@ async function add(ignoreErrors: 'all' | 'pathspec' | 'none' = 'none') {
|
||||
|
||||
const peh = getInput('pathspec_error_handling'),
|
||||
err = new Error(
|
||||
`Add command did not match any file: git add ${args}`
|
||||
`Add command did not match any file: git add ${args}`,
|
||||
);
|
||||
if (peh === 'exitImmediately') throw err;
|
||||
if (peh === 'exitAtEnd') exitErrors.push(err);
|
||||
} else throw e;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ async function add(ignoreErrors: 'all' | 'pathspec' | 'none' = 'none') {
|
||||
}
|
||||
|
||||
async function remove(
|
||||
ignoreErrors: 'all' | 'pathspec' | 'none' = 'none'
|
||||
ignoreErrors: 'all' | 'pathspec' | 'none' = 'none',
|
||||
): Promise<(void | Response<void>)[]> {
|
||||
const input = getInput('remove');
|
||||
if (!input) return [];
|
||||
@@ -272,7 +272,7 @@ async function remove(
|
||||
// If any of them fails, the whole function will return a Promise rejection
|
||||
await git
|
||||
.rm(matchGitArgs(args), (e, d) =>
|
||||
log(ignoreErrors === 'all' ? null : e, d)
|
||||
log(ignoreErrors === 'all' ? null : e, d),
|
||||
)
|
||||
.catch((e: Error) => {
|
||||
// if I should ignore every error, return
|
||||
@@ -287,12 +287,12 @@ async function remove(
|
||||
|
||||
const peh = getInput('pathspec_error_handling'),
|
||||
err = new Error(
|
||||
`Remove command did not match any file:\n git rm ${args}`
|
||||
`Remove command did not match any file:\n git rm ${args}`,
|
||||
);
|
||||
if (peh === 'exitImmediately') throw err;
|
||||
if (peh === 'exitAtEnd') exitErrors.push(err);
|
||||
} else throw e;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export async function getUserInfo(username?: string) {
|
||||
const res = await tools.github.users.getByUsername({username});
|
||||
|
||||
core.debug(
|
||||
`Fetched github actor from the API: ${JSON.stringify(res?.data, null, 2)}`
|
||||
`Fetched github actor from the API: ${JSON.stringify(res?.data, null, 2)}`,
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user