-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an editorconfig and use 4 spaces indent
- Loading branch information
Showing
2 changed files
with
34 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |