Fix workflow name extraction for policy store API
Use GITHUB_WORKFLOW_REF to extract the workflow filename instead of GITHUB_WORKFLOW which gives the workflow display name. The policy store API expects the filename (e.g. ci.yml) to match workflow-level policies.
This commit is contained in:
parent
74e0b3a07e
commit
8e8c444a73
3 changed files with 5 additions and 3 deletions
3
dist/pre/index.js
vendored
3
dist/pre/index.js
vendored
|
|
@ -85740,7 +85740,8 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
|
|||
else {
|
||||
try {
|
||||
const repoName = (process.env["GITHUB_REPOSITORY"] || "").split("/")[1] || "";
|
||||
const workflow = process.env["GITHUB_WORKFLOW"] || "";
|
||||
const workflowRef = process.env["GITHUB_WORKFLOW_REF"] || "";
|
||||
const workflow = workflowRef.replace(/.*\.github\/workflows\//, "").replace(/@.*/, "");
|
||||
let result = yield fetchPolicyFromStore(github.context.repo.owner, repoName, confg.api_key, workflow, confg.run_id, confg.correlation_id);
|
||||
if (result !== null) {
|
||||
lib_core.info(`Policy found: ${result.policy_name || "unnamed"}`);
|
||||
|
|
|
|||
2
dist/pre/index.js.map
vendored
2
dist/pre/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -103,7 +103,8 @@ interface MonitorResponse {
|
|||
} else {
|
||||
try {
|
||||
const repoName = (process.env["GITHUB_REPOSITORY"] || "").split("/")[1] || "";
|
||||
const workflow = process.env["GITHUB_WORKFLOW"] || "";
|
||||
const workflowRef = process.env["GITHUB_WORKFLOW_REF"] || "";
|
||||
const workflow = workflowRef.replace(/.*\.github\/workflows\//, "").replace(/@.*/, "");
|
||||
let result: PolicyResponse | null = await fetchPolicyFromStore(
|
||||
context.repo.owner,
|
||||
repoName,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue