-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from gacts/add-error-handling
v1.2.0
- Loading branch information
Showing
13 changed files
with
779 additions
and
54 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
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
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
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
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,28 @@ | ||
const core = require("@actions/core"); // https://github.com/actions/toolkit/tree/main/packages/core | ||
const exec = require("@actions/exec"); // https://github.com/actions/toolkit/tree/main/packages/exec | ||
|
||
// read action inputs | ||
const input = { | ||
run: core.getMultilineInput('run'), | ||
post: core.getMultilineInput('post', {required: true}), | ||
workingDirectory: core.getInput('working-directory'), | ||
}; | ||
|
||
export async function run() { | ||
return runCommands(input.run) | ||
} | ||
|
||
export async function post() { | ||
return runCommands(input.post) | ||
} | ||
|
||
async function runCommands(commands) { | ||
return (async () => { | ||
for (const command of commands) { | ||
if (command !== "") { | ||
await exec.exec(command, [], {cwd: input.workingDirectory}); | ||
} | ||
} | ||
})().catch(error => core.error(error.message)) | ||
} | ||
|
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,16 +1,5 @@ | ||
const core = require("@actions/core"); // https://github.com/actions/toolkit/tree/main/packages/core | ||
const exec = require("@actions/exec"); // https://github.com/actions/toolkit/tree/main/packages/exec | ||
|
||
// read action inputs | ||
const input = { | ||
run: core.getInput('run'), | ||
workingDirectory: core.getInput('working-directory'), | ||
}; | ||
const {run} = require("./common"); | ||
|
||
(async () => { | ||
const command = input.run | ||
|
||
if (command !== "") { | ||
await exec.exec(command, [], {cwd: input.workingDirectory}); | ||
} | ||
await run() | ||
})(); |
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,16 +1,5 @@ | ||
const core = require("@actions/core"); // https://github.com/actions/toolkit/tree/main/packages/core | ||
const exec = require("@actions/exec"); // https://github.com/actions/toolkit/tree/main/packages/exec | ||
|
||
// read action inputs | ||
const input = { | ||
post: core.getInput('post', {required: true}), | ||
workingDirectory: core.getInput('working-directory'), | ||
}; | ||
const {post} = require("./common"); | ||
|
||
(async () => { | ||
const command = input.post | ||
|
||
if (command !== "") { | ||
await exec.exec(command, [], {cwd: input.workingDirectory}); | ||
} | ||
await post() | ||
})(); |
Oops, something went wrong.