Skip to content

Commit ee4ad8b

Browse files
authored
Merge pull request #2356 from github/marcogario/require_workflows_path
Better handling for required workflows
2 parents 79e9a50 + ddd849e commit ee4ad8b

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

lib/api-client.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/api-client.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api-client.ts

+9
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ export async function getWorkflowRelativePath(): Promise<string> {
139139
);
140140
const workflowUrl = runsResponse.data.workflow_url;
141141

142+
const requiredWorkflowRegex =
143+
/\/repos\/[^/]+\/[^/]+\/actions\/required_workflows\/[^/]+/;
144+
if (!workflowUrl || requiredWorkflowRegex.test(workflowUrl as string)) {
145+
// For required workflows, the workflowUrl is invalid so we cannot fetch more informations
146+
// about the workflow.
147+
// However, the path is available in the original response.
148+
return runsResponse.data.path as string;
149+
}
150+
142151
const workflowResponse = await apiClient.request(`GET ${workflowUrl}`);
143152

144153
return workflowResponse.data.path as string;

0 commit comments

Comments
 (0)