We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 62f875d commit 77d7e65Copy full SHA for 77d7e65
1 file changed
scripts/rerun.js
@@ -0,0 +1,27 @@
1
+'use strict'
2
+
3
+// Example to rerun the Serverless workflow 30 times on the current branch:
4
+// GITHUB_TOKEN=$(ddtool auth github token) WORKFLOW=Serverless node scripts/rerun
5
6
+const { execSync } = require('child_process')
7
8
+const {
9
+ ATTEMPTS = 30,
10
+ BRANCH,
11
+ INTERVAL = 600,
12
+ WORKFLOW
13
+} = process.env
14
15
+function rerun (current = 1) {
16
+ const branch = BRANCH || execSync('git rev-parse --abbrev-ref HEAD').toString().trim()
17
+ const result = execSync(`gh run ls -b ${branch} -w ${WORKFLOW}`).toString()
18
+ const id = result.match(/\d{11}/)[0]
19
20
+ execSync(`gh run rerun ${id} --repo DataDog/dd-trace-js || exit 0`)
21
22
+ if (current >= ATTEMPTS) return
23
24
+ setTimeout(() => rerun(current + 1), INTERVAL * 1000)
25
+}
26
27
+rerun()
0 commit comments