Skip to content

Commit

Permalink
make this a lot easier on myself
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Jun 28, 2023
1 parent 0c2c4b8 commit 962f8a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ inputs:
description: Attempts to automatically merge the default branch into the requested ref, if it's behind the default branch. Defaults to `false`
required_contexts:
required: false
description: The status contexts to verify against commit status checks, separated by newlines. An empty string will run all checks; to bypass checking entirely, pass a `<<EMPTY>>` string. Defaults to `<<EMPTY>>`.
description: The status contexts to verify against commit status checks, separated by commas. If this argument is `"*"`, all checks are run. If this argument is omitted, or if it's set to `""`, checking is bypassed entirely. Defaults to `""`.

debug:
required: false
Expand Down
19 changes: 8 additions & 11 deletions src/lib/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,16 @@ export function getOptionalInput(key: string): string | undefined {
return getInput(key, { required: false, trimWhitespace: true }) || undefined;
}

export function parseOptionalStringArrayInput(
export function parseOptionalRequiredContexts(
key: string
): string[] | undefined {
const input = getOptionalInput(key);
const required_contexts = getOptionalInput(key);

if (input === undefined || input === "<<EMPTY>>") {
return [];
if (required_contexts !== '*') {
if (required_contexts == undefined || required_contexts === '') {
return [];
} else {
return required_contexts.split(',');
}
}

const strings: string[] = [];
for (const line of input.split(/\r|\n/)) {
strings.push(line);
}

return strings;
}
8 changes: 2 additions & 6 deletions src/steps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getBooleanInput,
getOptionalInput,
getRequiredInput,
parseOptionalStringArrayInput,
parseOptionalRequiredContexts,
} from "../lib/input";

import createStart, { StartArgs } from "./start";
Expand Down Expand Up @@ -41,18 +41,14 @@ export async function run(
deploymentID: getOptionalInput("deployment_id"),
override: getBooleanInput("override", false), // default to false on start
auto_merge: getBooleanInput("auto_merge", false),
required_contexts: parseOptionalRequiredContexts("required_contexts"),
payload,
};
const required_contexts = parseOptionalStringArrayInput("required_contexts")
// if (required_contexts !== undefined) {
// start_args["required_contexts"] = required_contexts;
// };
const stepArgs: StartArgs = start_args;
log.debug(`'${step}' arguments`, {
stepArgs,
coreArgs,
});
log.debug(`and required_contexts: ${required_contexts}`)
const { deploymentID, statusID } = await createStart(
github,
context,
Expand Down

0 comments on commit 962f8a1

Please sign in to comment.