Skip to content

Commit

Permalink
Merge pull request #20 from DavidS/unique-trace-id
Browse files Browse the repository at this point in the history
Make the TRACE_ID unique across repos and re-runs
  • Loading branch information
Koenraad Verheyden authored Dec 15, 2020
2 parents 5be4636 + 3db32e1 commit 2041175
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2175,10 +2175,13 @@ function run() {
}
const buildStart = util.getTimestamp();
const traceComponents = [
util.getEnv('GITHUB_REPOSITORY'),
util.getEnv('GITHUB_WORKFLOW'),
util.getEnv('GITHUB_JOB'),
util.getEnv('GITHUB_RUN_NUMBER'),
core.getInput('matrix-key')
core.getInput('matrix-key'),
// append a random number to ensure traceId is unique when the workflow is re-run
util.randomInt(Math.pow(2, 32)).toString()
];
const traceId = util.replaceSpaces(traceComponents.filter(value => value).join('-'));
// save buildStart to be used in the post section
Expand Down
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ async function run(): Promise<void> {

const buildStart = util.getTimestamp()
const traceComponents = [
util.getEnv('GITHUB_REPOSITORY'),
util.getEnv('GITHUB_WORKFLOW'),
util.getEnv('GITHUB_JOB'),
util.getEnv('GITHUB_RUN_NUMBER'),
core.getInput('matrix-key')
core.getInput('matrix-key'),
// append a random number to ensure traceId is unique when the workflow is re-run
util.randomInt(2 ** 32).toString()
]
const traceId = util.replaceSpaces(traceComponents.filter(value => value).join('-'))

Expand Down

0 comments on commit 2041175

Please sign in to comment.