@@ -1505,7 +1505,9 @@ function getCommonGroupIdFromTriggeringRunInfo(triggeringRunInfo, sourceWorkflow
1505
1505
* @returns the unique string id for the group
1506
1506
*/
1507
1507
function getCommonGroupIdFromRunItem(runItem) {
1508
- return `:${retrieveWorkflowIdFromUrl(runItem.workflow_url)}:${runItem.head_repository.full_name}:${runItem.head_branch}:${runItem.event}`;
1508
+ return `:${retrieveWorkflowIdFromUrl(runItem.workflow_url)}:${runItem.head_repository !== null
1509
+ ? runItem.head_repository.full_name
1510
+ : 'UNKNOWN_REPO'}:${runItem.head_branch}:${runItem.event}`;
1509
1511
}
1510
1512
/**
1511
1513
* Creates query parameters selecting all runs that share the same source group as we have. This can
@@ -1755,6 +1757,10 @@ function getWorkflowRuns(repositoryInfo, statusValues, cancelMode, createListRun
1755
1757
* @return true if we determine that the run Id should be cancelled
1756
1758
*/
1757
1759
function checkCandidateForCancellingDuplicate(runItem, cancelFutureDuplicates, triggeringRunInfo, sourceWorkflowId, mapOfWorkflowRunCandidates) {
1760
+ if (runItem.head_repository === null) {
1761
+ core.warning(`\nThe run number: ${runItem.run_number} is weird. It's 'head_repository' is null.\n`);
1762
+ return;
1763
+ }
1758
1764
const runHeadRepo = runItem.head_repository.full_name;
1759
1765
if (triggeringRunInfo.headRepo !== undefined &&
1760
1766
runHeadRepo !== triggeringRunInfo.headRepo) {
@@ -2010,6 +2016,10 @@ function findPullRequest(repositoryInfo, headRepo, headBranch, headSha) {
2010
2016
*/
2011
2017
function findPullRequestForRunItem(repositoryInfo, runItem) {
2012
2018
return __awaiter(this, void 0, void 0, function* () {
2019
+ if (runItem.head_repository === null) {
2020
+ core.warning(`\nThe run number: ${runItem.run_number} is weird. It's 'head_repository' is null.\n`);
2021
+ return undefined;
2022
+ }
2013
2023
const pullRequest = yield findPullRequest(repositoryInfo, runItem.head_repository.owner.login, runItem.head_branch, runItem.head_sha);
2014
2024
if (pullRequest) {
2015
2025
return pullRequest.number;
@@ -2205,6 +2215,19 @@ function getTriggeringRunInfo(repositoryInfo, runId) {
2205
2215
run_id: runId
2206
2216
});
2207
2217
const sourceRun = reply.data;
2218
+ if (sourceRun.head_repository === null) {
2219
+ core.warning(`\nThe run number: ${sourceRun.run_number} is weird. It's 'head_repository' is null.\n`);
2220
+ return {
2221
+ workflowId: retrieveWorkflowIdFromUrl(reply.data.workflow_url),
2222
+ runId,
2223
+ headRepo: 'UNKNOWN_REPO',
2224
+ headBranch: reply.data.head_branch,
2225
+ headSha: reply.data.head_sha,
2226
+ mergeCommitSha: null,
2227
+ pullRequest: null,
2228
+ eventName: reply.data.event
2229
+ };
2230
+ }
2208
2231
core.info(`Source workflow: Head repo: ${sourceRun.head_repository.full_name}, ` +
2209
2232
`Head branch: ${sourceRun.head_branch} ` +
2210
2233
`Event: ${sourceRun.event}, Head sha: ${sourceRun.head_sha}, url: ${sourceRun.url}`);
0 commit comments