@@ -100956,7 +100956,7 @@ if (process.env.NODE_ENV === "development") {
100956100956 // eslint-disable-next-line @typescript-eslint/no-for-in-array, no-restricted-syntax, guard-for-in
100957100957 for (const key in actionYaml.inputs) {
100958100958 const envKey = `INPUT_${key.toUpperCase()}`;
100959- const envValue = actionYaml.inputs[key].default;
100959+ const envValue = actionYaml.inputs[key]? .default;
100960100960 if (envValue && !Object.keys(process.env).includes(envKey)) {
100961100961 process.env[envKey] = envValue;
100962100962 }
@@ -116618,46 +116618,53 @@ function resolveHunkReferencesInComments(comments, files) {
116618116618 }
116619116619 else {
116620116620 const hunkChangeMap = currentFile.chunks.flatMap(hunk => hunk.changes.map(change => ({ change, hunk })));
116621- let { change: startChange, hunk: startHunk } = hunkChangeMap[comment.start - 1]; // eslint-disable-line prefer-const
116622- let { change: endChange, hunk: endHunk } = hunkChangeMap[comment.end - 1]; // eslint-disable-line prefer-const
116623- if (!startHunk ) {
116624- lib_core.warning (`Could not find hunk for comment on ${comment.path}, start ${comment.start}, end ${comment.end}, ${comment.comment}, skipping.`);
116621+ const startEntry = hunkChangeMap[comment.start - 1];
116622+ const endEntry = hunkChangeMap[comment.end - 1];
116623+ if (!startEntry || !endEntry ) {
116624+ lib_core.error (`Could not find hunk for comment on ${comment.path}, start ${comment.start}, end ${comment.end}, ${comment.comment}, skipping.`);
116625116625 }
116626116626 else {
116627- if (startHunk !== endHunk)
116628- endChange = startHunk.changes.at(-1);
116629- const startSide = startChange.type !== "del" ? "RIGHT" : "LEFT";
116630- const endSide = endChange.type !== "del" ? "RIGHT" : "LEFT";
116631- // get start line of the actual comment
116632- let start;
116633- if (startChange.type === "normal") {
116634- start = startChange.ln2;
116627+ const { change: startChange, hunk: startHunk } = startEntry;
116628+ let { change: endChange, hunk: endHunk } = endEntry; // eslint-disable-line prefer-const
116629+ if (!startHunk) {
116630+ lib_core.warning(`Could not find hunk for comment on ${comment.path}, start ${comment.start}, end ${comment.end}, ${comment.comment}, skipping.`);
116635116631 }
116636- else if (startChange.type === "add" || startChange.type === "del") {
116637- start = startChange.ln;
116638- }
116639- else
116640- throw new Error(`Unknown change type.`);
116641- // get end line of the actual comment
116642- let end;
116643- if (endChange.type === "normal") {
116644- end = endChange.ln2;
116645- }
116646- else if (endChange.type === "add" || endChange.type === "del") {
116647- end = endChange.ln;
116632+ else {
116633+ if (startHunk !== endHunk)
116634+ endChange = startHunk.changes.at(-1);
116635+ const startSide = startChange.type !== "del" ? "RIGHT" : "LEFT";
116636+ const endSide = endChange.type !== "del" ? "RIGHT" : "LEFT";
116637+ // get start line of the actual comment
116638+ let start;
116639+ if (startChange.type === "normal") {
116640+ start = startChange.ln2;
116641+ }
116642+ else if (startChange.type === "add" || startChange.type === "del") {
116643+ start = startChange.ln;
116644+ }
116645+ else
116646+ throw new Error(`Unknown change type.`);
116647+ // get end line of the actual comment
116648+ let end;
116649+ if (endChange.type === "normal") {
116650+ end = endChange.ln2;
116651+ }
116652+ else if (endChange.type === "add" || endChange.type === "del") {
116653+ end = endChange.ln;
116654+ }
116655+ else
116656+ throw new Error(`Unknown change type.`);
116657+ // make sure start and end are within the hunk
116658+ end = Math.min(end, endSide === "RIGHT" ? startHunk.newStart + startHunk.newLines - 1 : startHunk.oldStart + startHunk.oldLines - 1);
116659+ result.push({
116660+ path: comment.path,
116661+ start_side: startSide !== endSide ? startSide : undefined, // only set start_side if it is a multi-line comment
116662+ side: startSide !== endSide ? endSide : startSide,
116663+ start_line: start !== end && start < end ? start : undefined, // only set start_line if it is a multi-line comment, start must be less than end
116664+ line: start !== end && start < end ? end : start,
116665+ body: comment.comment,
116666+ });
116648116667 }
116649- else
116650- throw new Error(`Unknown change type.`);
116651- // make sure start and end are within the hunk
116652- end = Math.min(end, endSide === "RIGHT" ? startHunk.newStart + startHunk.newLines - 1 : startHunk.oldStart + startHunk.oldLines - 1);
116653- result.push({
116654- path: comment.path,
116655- start_side: startSide !== endSide ? startSide : undefined, // only set start_side if it is a multi-line comment
116656- side: startSide !== endSide ? endSide : startSide,
116657- start_line: start !== end && start < end ? start : undefined, // only set start_line if it is a multi-line comment, start must be less than end
116658- line: start !== end && start < end ? end : start,
116659- body: comment.comment,
116660- });
116661116668 }
116662116669 }
116663116670 });
0 commit comments