Skip to content

Commit

Permalink
Add an editorconfig and use 4 spaces indent
Browse files Browse the repository at this point in the history
  • Loading branch information
sandhose committed Jul 8, 2024
1 parent a32ba96 commit a299da3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 23 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
charset = utf-8
insert_final_newline = true
end_of_line = lf
indent_style = space
max_line_length = 80

[*.ts]
indent_size = 4
46 changes: 23 additions & 23 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import { getInput, getMultilineInput, setFailed } from "@actions/core";

function parseJsonInput(param_name: string) {
const param_val = getInput(param_name);
try {
return JSON.parse(param_val);
} catch (error) {
throw new Error(
`Invalid '${param_name}' input ${param_val}: ${(error as Error).message}`,
);
}
const param_val = getInput(param_name);
try {
return JSON.parse(param_val);
} catch (error) {
throw new Error(
`Invalid '${param_name}' input ${param_val}: ${(error as Error).message}`,
);
}
}

function main() {
const needs = parseJsonInput("needs");
const skippable = getMultilineInput("skippable");
const needs = parseJsonInput("needs");
const skippable = getMultilineInput("skippable");

console.debug(`needs: ${JSON.stringify(needs)}`);
console.debug(`skippable: ${JSON.stringify(skippable)}`);
for (const job_id of Object.keys(needs)) {
const result = needs[job_id].result;
console.log(`Job ${job_id} returned ${result}`);
if (result == "skipped" && skippable.includes(job_id)) {
continue;
}
if (result != "success") {
throw new Error(`Job ${job_id} returned ${result}`);
console.debug(`needs: ${JSON.stringify(needs)}`);
console.debug(`skippable: ${JSON.stringify(skippable)}`);
for (const job_id of Object.keys(needs)) {
const result = needs[job_id].result;
console.log(`Job ${job_id} returned ${result}`);
if (result == "skipped" && skippable.includes(job_id)) {
continue;
}
if (result != "success") {
throw new Error(`Job ${job_id} returned ${result}`);
}
}
}
}

try {
main();
main();
} catch (error) {
setFailed((error as Error).message);
setFailed((error as Error).message);
}

0 comments on commit a299da3

Please sign in to comment.