Compare commits
2 Commits
aeb0368508
...
8bdab1f9db
| Author | SHA1 | Date | |
|---|---|---|---|
| 8bdab1f9db | |||
| 1863239c06 |
@@ -25,7 +25,7 @@ async function ghActionBot() {
|
|||||||
PULL_LABEL_FILTER,
|
PULL_LABEL_FILTER,
|
||||||
PULL_AUTHOR_FILTER,
|
PULL_AUTHOR_FILTER,
|
||||||
PULL_RETEST_BODY,
|
PULL_RETEST_BODY,
|
||||||
ACTION_CHECK_DELAY = 3000,
|
ACTION_RETRY_DELAY = 3000,
|
||||||
} = process.env;
|
} = process.env;
|
||||||
|
|
||||||
// load the history module
|
// load the history module
|
||||||
@@ -100,7 +100,7 @@ async function ghActionBot() {
|
|||||||
logger.debug(`CHECK #${record.pull.number}: verify state change`);
|
logger.debug(`CHECK #${record.pull.number}: verify state change`);
|
||||||
|
|
||||||
// wait for the ci to restart
|
// wait for the ci to restart
|
||||||
await sleep(ACTION_CHECK_DELAY);
|
await sleep(ACTION_RETRY_DELAY);
|
||||||
|
|
||||||
// check that the commit status is now pending
|
// check that the commit status is now pending
|
||||||
const buildStatus = await getCommitStatus(repo, record.commit.sha);
|
const buildStatus = await getCommitStatus(repo, record.commit.sha);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export default async function execAndCheck(fn, test, onFailure = () => {}, opts = { tries: 3 }) {
|
export default async function execAndCheck(fn, test, onFailure = () => {}) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
const tryExec = async () => {
|
const tryExec = async () => {
|
||||||
@@ -9,9 +9,11 @@ export default async function execAndCheck(fn, test, onFailure = () => {}, opts
|
|||||||
const res = await test();
|
const res = await test();
|
||||||
if (res) return;
|
if (res) return;
|
||||||
|
|
||||||
|
const { ACTION_RETRY_COUNT = 3 } = process.env;
|
||||||
|
|
||||||
// if retry limit is hit, call failure function
|
// if retry limit is hit, call failure function
|
||||||
count += 1;
|
count += 1;
|
||||||
if (count >= opts.tries) return onFailure(); // eslint-disable-line consistent-return
|
if (count >= ACTION_RETRY_COUNT) return onFailure(); // eslint-disable-line consistent-return
|
||||||
|
|
||||||
// retry the function and retest the results
|
// retry the function and retest the results
|
||||||
return tryExec(); // eslint-disable-line consistent-return
|
return tryExec(); // eslint-disable-line consistent-return
|
||||||
|
|||||||
Reference in New Issue
Block a user