Add actions-util.getAutomationID()
This commit is contained in:
parent
c6e734ccc5
commit
519d0771c7
6 changed files with 102 additions and 2 deletions
20
lib/actions-util.js
generated
20
lib/actions-util.js
generated
|
|
@ -354,6 +354,26 @@ async function getAnalysisKey() {
|
|||
return analysisKey;
|
||||
}
|
||||
exports.getAnalysisKey = getAnalysisKey;
|
||||
async function getAutomationID() {
|
||||
let automationID = `${await getAnalysisKey()}/`;
|
||||
const environment = getOptionalInput("matrix");
|
||||
// the id has to be deterministic so we sort the fields
|
||||
if (environment !== undefined && environment !== "null") {
|
||||
const environmentObject = JSON.parse(environment);
|
||||
for (const entry of Object.entries(environmentObject).sort()) {
|
||||
if (typeof entry[1] === "string") {
|
||||
automationID += `${entry[0]}:${entry[1]}/`;
|
||||
}
|
||||
else {
|
||||
// In code scanning we just handle the string values,
|
||||
// the rest get converted to the empty string
|
||||
automationID += `${entry[0]}:/`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return automationID;
|
||||
}
|
||||
exports.getAutomationID = getAutomationID;
|
||||
/**
|
||||
* Get the ref currently being analyzed.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue