Skip to content

Commit

Permalink
minor: regenerate dist
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Fields committed Dec 10, 2021
1 parent f7cf641 commit bf1736e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -46,7 +46,7 @@ Retries an Action step on failure or timeout. This is currently intended to repl

### `new_command_on_retry`

**Optional** Command to run if the first attempt fails. This command will be called on all subsequent attempts.
**Optional** Command to run if the first attempt fails. This command will be called on all subsequent attempts.

### `continue_on_error`

Expand Down Expand Up @@ -191,7 +191,7 @@ with:
timeout_seconds: 15
max_attempts: 3
command: npx jest
new_command_on_retry: npx jest --onlyFailures
new_command_on_retry: npx jest --onlyFailures
```

### Run multi-line, multi-command script
Expand Down
9 changes: 6 additions & 3 deletions dist/index.js
Expand Up @@ -288,6 +288,7 @@ var RETRY_ON = core_1.getInput('retry_on') || 'any';
var WARNING_ON_RETRY = core_1.getInput('warning_on_retry').toLowerCase() === 'true';
var ON_RETRY_COMMAND = core_1.getInput('on_retry_command');
var CONTINUE_ON_ERROR = getInputBoolean('continue_on_error');
var NEW_COMMAND_ON_RETRY = core_1.getInput('new_command_on_retry');
var OS = process.platform;
var OUTPUT_TOTAL_ATTEMPTS_KEY = 'total_attempts';
var OUTPUT_EXIT_CODE_KEY = 'exit_code';
Expand Down Expand Up @@ -408,7 +409,7 @@ function runRetryCmd() {
});
});
}
function runCmd() {
function runCmd(attempt) {
var _a, _b;
return __awaiter(this, void 0, void 0, function () {
var end_time, executable, child;
Expand All @@ -420,7 +421,9 @@ function runCmd() {
exit = 0;
done = false;
core_1.debug("Running command " + COMMAND + " on " + OS + " using shell " + executable);
child = child_process_1.exec(COMMAND, { 'shell': executable });
child = attempt > 1 && NEW_COMMAND_ON_RETRY
? child_process_1.exec(NEW_COMMAND_ON_RETRY, { 'shell': executable })
: child_process_1.exec(COMMAND, { 'shell': executable });
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on('data', function (data) {
process.stdout.write(data);
});
Expand Down Expand Up @@ -482,7 +485,7 @@ function runAction() {
_a.trys.push([3, 5, , 11]);
// just keep overwriting attempts output
core_1.setOutput(OUTPUT_TOTAL_ATTEMPTS_KEY, attempt);
return [4 /*yield*/, runCmd()];
return [4 /*yield*/, runCmd(attempt)];
case 4:
_a.sent();
core_1.info("Command completed after " + attempt + " attempt(s).");
Expand Down

0 comments on commit bf1736e

Please sign in to comment.