Better handling for required workflows
Return the workflow path from the run rather than trying to fetch the workflow information when the workflow information is missing or refers to a required workflow.
This commit is contained in:
parent
9b7c22c3b3
commit
37b6ead477
3 changed files with 16 additions and 1 deletions
7
lib/api-client.js
generated
7
lib/api-client.js
generated
|
|
@ -123,6 +123,13 @@ async function getWorkflowRelativePath() {
|
||||||
run_id,
|
run_id,
|
||||||
});
|
});
|
||||||
const workflowUrl = runsResponse.data.workflow_url;
|
const workflowUrl = runsResponse.data.workflow_url;
|
||||||
|
const requiredWorkflowRegex = /\/repos\/[^/]+\/[^/]+\/actions\/required_workflows\/[^/]+/;
|
||||||
|
if (!workflowUrl || workflowUrl === "" || requiredWorkflowRegex.test(workflowUrl)) {
|
||||||
|
// For required workflows, the workflowUrl is invalid so we cannot fetch more informations
|
||||||
|
// about the workflow.
|
||||||
|
// However, the path is available in the original response.
|
||||||
|
return runsResponse.data.path;
|
||||||
|
}
|
||||||
const workflowResponse = await apiClient.request(`GET ${workflowUrl}`);
|
const workflowResponse = await apiClient.request(`GET ${workflowUrl}`);
|
||||||
return workflowResponse.data.path;
|
return workflowResponse.data.path;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -139,6 +139,14 @@ export async function getWorkflowRelativePath(): Promise<string> {
|
||||||
);
|
);
|
||||||
const workflowUrl = runsResponse.data.workflow_url;
|
const workflowUrl = runsResponse.data.workflow_url;
|
||||||
|
|
||||||
|
const requiredWorkflowRegex = /\/repos\/[^/]+\/[^/]+\/actions\/required_workflows\/[^/]+/;
|
||||||
|
if (!workflowUrl || workflowUrl === "" || requiredWorkflowRegex.test(workflowUrl)) {
|
||||||
|
// For required workflows, the workflowUrl is invalid so we cannot fetch more informations
|
||||||
|
// about the workflow.
|
||||||
|
// However, the path is available in the original response.
|
||||||
|
return runsResponse.data.path as string;
|
||||||
|
}
|
||||||
|
|
||||||
const workflowResponse = await apiClient.request(`GET ${workflowUrl}`);
|
const workflowResponse = await apiClient.request(`GET ${workflowUrl}`);
|
||||||
|
|
||||||
return workflowResponse.data.path as string;
|
return workflowResponse.data.path as string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue