Skip to content

Commit

Permalink
better syntax
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Panayil <[email protected]>
  • Loading branch information
sachin-panayil committed Dec 23, 2024
1 parent 9eb347b commit 9f49893
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ inputs:
This option will be ignored if output_type != "issue".
default: '[Repolinter] Open Source Policy Issues'
label_name:
issue_label_name:
required: false
description: >
The name to use for the issue label created by repolinter-action. This name
Expand All @@ -100,7 +100,7 @@ inputs:
This option will be ignored if output_type != "issue".
default: 'repolinter'
label_color:
issue_label_color:
required: false
description: >
The color to use for the issue label created by repolinter-action. The value
Expand Down Expand Up @@ -133,8 +133,8 @@ runs:
INPUT_REPOSITORY: ${{ inputs.repository }}
INPUT_OUTPUT_TYPE: ${{ inputs.output_type }}
INPUT_OUTPUT_NAME: ${{ inputs.output_name }}
INPUT_LABEL_NAME: ${{ inputs.label_name }}
INPUT_LABEL_COLOR: ${{ inputs.label_color }}
INPUT_ISSUE_LABEL_NAME: ${{ inputs.issue_label_name }}
INPUT_ISSUE_LABEL_COLOR: ${{ inputs.issue_label_color }}
INPUT_PULL_REQUEST_LABELS: ${{ inputs.pull_request_labels }}
branding:
color: green
Expand Down
18 changes: 9 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,8 @@ function getInputs() {
REPO: core.getInput("repository" /* REPO */, { required: true }),
OUTPUT_TYPE: core.getInput("output_type" /* OUTPUT_TYPE */, { required: true }),
OUTPUT_NAME: core.getInput("output_name" /* OUTPUT_NAME */, { required: true }),
LABEL_NAME: core.getInput("label_name" /* LABEL_NAME */, { required: true }),
LABEL_COLOR: core.getInput("label_color" /* LABEL_COLOR */, { required: true }),
ISSUE_LABEL_NAME: core.getInput("issue_label_name" /* ISSUE_LABEL_NAME */, { required: true }),
ISSUE_LABEL_COLOR: core.getInput("issue_label_color" /* ISSUE_LABEL_COLOR */, { required: true }),
BASE_BRANCH: core.getInput("base_branch" /* BASE_BRANCH */, { required: true }),
PULL_REQUEST_LABELS: core.getInput("pull_request_labels" /* PULL_REQUEST_LABELS */, { required: true })
};
Expand Down Expand Up @@ -631,7 +631,7 @@ function run(disableRetry) {
// load the configuration from file or url, depending on which one is configured
try {
// get all inputs
const { DIRECTORY, TOKEN, USERNAME, CONFIG_FILE, CONFIG_URL, REPO, OUTPUT_TYPE, OUTPUT_NAME, LABEL_NAME, LABEL_COLOR, BASE_BRANCH, PULL_REQUEST_LABELS } = getInputs();
const { DIRECTORY, TOKEN, USERNAME, CONFIG_FILE, CONFIG_URL, REPO, OUTPUT_TYPE, OUTPUT_NAME, ISSUE_LABEL_NAME, ISSUE_LABEL_COLOR, BASE_BRANCH, PULL_REQUEST_LABELS } = getInputs();
const RUN_NUMBER = getRunNumber();
// verify the directory exists and is a directory
try {
Expand All @@ -646,11 +646,11 @@ function run(disableRetry) {
if (OUTPUT_TYPE !== 'exit-code' && OUTPUT_TYPE !== 'issue' && OUTPUT_TYPE !== "pull-request")
throw new Error(`Invalid output paramter value ${OUTPUT_TYPE} There is another error here`);
// verify the label name is a string
if (!LABEL_NAME)
throw new Error(`Invalid label name value ${LABEL_NAME}`);
if (!ISSUE_LABEL_NAME)
throw new Error(`Invalid label name value ${ISSUE_LABEL_NAME}`);
// verify the label color is a color
if (!/[0-9a-fA-F]{6}/.test(LABEL_COLOR))
throw new Error(`Invalid label color ${LABEL_COLOR}`);
if (!/[0-9a-fA-F]{6}/.test(ISSUE_LABEL_COLOR))
throw new Error(`Invalid label color ${ISSUE_LABEL_COLOR}`);
// override GITHUB_TOKEN and INPUT_GITHUB_TOKEN if INPUT_TOKEN is present
if (TOKEN) {
delete process.env['INPUT_TOKEN'];
Expand Down Expand Up @@ -700,8 +700,8 @@ function run(disableRetry) {
username: USERNAME,
issueName: OUTPUT_NAME,
issueContent,
labelName: LABEL_NAME,
labelColor: LABEL_COLOR,
labelName: ISSUE_LABEL_NAME,
labelColor: ISSUE_LABEL_COLOR,
shouldClose: result.passed === true,
runNumber: RUN_NUMBER
});
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const enum ActionInputs {
REPO = 'repository',
OUTPUT_TYPE = 'output_type',
OUTPUT_NAME = 'output_name',
LABEL_NAME = 'label_name',
LABEL_COLOR = 'label_color',
ISSUE_LABEL_NAME = 'issue_label_name',
ISSUE_LABEL_COLOR = 'issue_label_color',
BASE_BRANCH = "base_branch",
PULL_REQUEST_LABELS = 'pull_request_labels'
}
Expand Down
18 changes: 9 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ function getInputs(): {[key: string]: string} {
REPO: core.getInput(ActionInputs.REPO, {required: true}),
OUTPUT_TYPE: core.getInput(ActionInputs.OUTPUT_TYPE, {required: true}),
OUTPUT_NAME: core.getInput(ActionInputs.OUTPUT_NAME, {required: true}),
LABEL_NAME: core.getInput(ActionInputs.LABEL_NAME, {required: true}),
LABEL_COLOR: core.getInput(ActionInputs.LABEL_COLOR, {required: true}),
ISSUE_LABEL_NAME: core.getInput(ActionInputs.ISSUE_LABEL_NAME, {required: true}),
ISSUE_LABEL_COLOR: core.getInput(ActionInputs.ISSUE_LABEL_COLOR, {required: true}),
BASE_BRANCH: core.getInput(ActionInputs.BASE_BRANCH, {required: true}),
PULL_REQUEST_LABELS: core.getInput(ActionInputs.PULL_REQUEST_LABELS, {required: true})
}
Expand Down Expand Up @@ -86,8 +86,8 @@ export default async function run(disableRetry?: boolean): Promise<void> {
REPO,
OUTPUT_TYPE,
OUTPUT_NAME,
LABEL_NAME,
LABEL_COLOR,
ISSUE_LABEL_NAME,
ISSUE_LABEL_COLOR,
BASE_BRANCH,
PULL_REQUEST_LABELS
} = getInputs()
Expand All @@ -106,10 +106,10 @@ export default async function run(disableRetry?: boolean): Promise<void> {
if (OUTPUT_TYPE!== 'exit-code' && OUTPUT_TYPE !== 'issue' && OUTPUT_TYPE !== "pull-request")
throw new Error(`Invalid output paramter value ${ OUTPUT_TYPE} There is another error here`)
// verify the label name is a string
if (!LABEL_NAME) throw new Error(`Invalid label name value ${LABEL_NAME}`)
if (!ISSUE_LABEL_NAME) throw new Error(`Invalid label name value ${ISSUE_LABEL_NAME}`)
// verify the label color is a color
if (!/[0-9a-fA-F]{6}/.test(LABEL_COLOR))
throw new Error(`Invalid label color ${LABEL_COLOR}`)
if (!/[0-9a-fA-F]{6}/.test(ISSUE_LABEL_COLOR))
throw new Error(`Invalid label color ${ISSUE_LABEL_COLOR}`)
// override GITHUB_TOKEN and INPUT_GITHUB_TOKEN if INPUT_TOKEN is present
if (TOKEN) {
delete process.env['INPUT_TOKEN']
Expand Down Expand Up @@ -157,8 +157,8 @@ export default async function run(disableRetry?: boolean): Promise<void> {
username: USERNAME,
issueName: OUTPUT_NAME,
issueContent,
labelName: LABEL_NAME,
labelColor: LABEL_COLOR,
labelName: ISSUE_LABEL_NAME,
labelColor: ISSUE_LABEL_COLOR,
shouldClose: result.passed === true,
runNumber: RUN_NUMBER
})
Expand Down

0 comments on commit 9f49893

Please sign in to comment.