Skip to content

Commit

Permalink
run: rebase and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruv committed Dec 14, 2023
1 parent ae5b04b commit f61fc1b
Show file tree
Hide file tree
Showing 6 changed files with 4,847 additions and 5,237 deletions.
97 changes: 48 additions & 49 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,53 @@
const core = require("@actions/core");
const github = require("@actions/github");
const core = require('@actions/core')
const github = require('@actions/github')

// Gets all the required inputs and validates them before proceeding.
function getConfig() {
const mode = core.getInput("mode", { required: true }).toLowerCase();
if (mode !== "validate" && mode !== "bump") {
throw new Error("mode must be either 'validate' or 'bump'");
}

const token = core.getInput("repo-token", { required: true });
core.setSecret(token);

const releaseNotesPrefix = core.getInput("release-notes-prefix");
const releaseNotesSuffix = core.getInput("release-notes-suffix");

let releaseNotesPrefixPattern;
if (releaseNotesPrefix !== undefined && releaseNotesPrefix !== "") {
releaseNotesPrefixPattern = new RegExp(releaseNotesPrefix);
}

let releaseNotesSuffixPattern;
if (releaseNotesSuffix !== undefined && releaseNotesSuffix !== "") {
releaseNotesSuffixPattern = new RegExp(releaseNotesSuffix);
}

const releaseLabels = {};
releaseLabels[core.getInput("major-label") || "major release"] = "major";
releaseLabels[core.getInput("minor-label") || "minor release"] = "minor";
releaseLabels[core.getInput("patch-label") || "patch release"] = "patch";

const noopLabels = {};
const configuredNoopLabels = core.getMultilineInput("noop-labels", {
trimWhitespace: true,
});
for (let i = 0; i < configuredNoopLabels.length; i++)
noopLabels[configuredNoopLabels[i]] = "skip";

return {
mode: mode,
octokit: github.getOctokit(token),
releaseLabels: releaseLabels,
noopLabels: noopLabels,
releaseNotesPrefixPattern: releaseNotesPrefixPattern,
releaseNotesSuffixPattern: releaseNotesSuffixPattern,
requireReleaseNotes:
core.getInput("require-release-notes").toLowerCase() === "true",
baseBranch: core.getInput("base-branch").toLowerCase() === "true",
useSSH: core.getInput("use-ssh").toLowerCase() === "true",
v: core.getInput("with-v").toLowerCase() === "true" ? "v" : "",
};
const mode = core.getInput('mode', { required: true }).toLowerCase()
if (mode !== 'validate' && mode !== 'bump') {
throw new Error("mode must be either 'validate' or 'bump'")
}

const token = core.getInput('repo-token', { required: true })
core.setSecret(token)

const releaseNotesPrefix = core.getInput('release-notes-prefix')
const releaseNotesSuffix = core.getInput('release-notes-suffix')

let releaseNotesPrefixPattern
if (releaseNotesPrefix !== undefined && releaseNotesPrefix !== '') {
releaseNotesPrefixPattern = new RegExp(releaseNotesPrefix)
}

let releaseNotesSuffixPattern
if (releaseNotesSuffix !== undefined && releaseNotesSuffix !== '') {
releaseNotesSuffixPattern = new RegExp(releaseNotesSuffix)
}

const releaseLabels = {}
releaseLabels[core.getInput('major-label') || 'major release'] = 'major'
releaseLabels[core.getInput('minor-label') || 'minor release'] = 'minor'
releaseLabels[core.getInput('patch-label') || 'patch release'] = 'patch'

const noopLabels = {}
const configuredNoopLabels = core.getMultilineInput('noop-labels', {
trimWhitespace: true,
})
for (let i = 0; i < configuredNoopLabels.length; i++) noopLabels[configuredNoopLabels[i]] = 'skip'

return {
mode: mode,
octokit: github.getOctokit(token),
releaseLabels: releaseLabels,
noopLabels: noopLabels,
releaseNotesPrefixPattern: releaseNotesPrefixPattern,
releaseNotesSuffixPattern: releaseNotesSuffixPattern,
requireReleaseNotes:
core.getInput('require-release-notes').toLowerCase() === 'true',
baseBranch: core.getInput('base-branch').toLowerCase() === 'true',
useSSH: core.getInput('use-ssh').toLowerCase() === 'true',
v: core.getInput('with-v').toLowerCase() === 'true' ? 'v' : '',
}
}

exports.getConfig = getConfig;
exports.getConfig = getConfig
Loading

0 comments on commit f61fc1b

Please sign in to comment.