@@ -128,39 +128,6 @@ function cliArguments(inputs) {
128
128
}
129
129
130
130
131
- /***/ }),
132
-
133
- /***/ 670:
134
- /***/ ((__unused_webpack_module, exports) => {
135
-
136
- "use strict";
137
-
138
- Object.defineProperty(exports, "__esModule", ({ value: true }));
139
- exports.last = last;
140
- exports.group = group;
141
- exports.groupBy = groupBy;
142
- function last(xs) {
143
- return xs.slice(-1)[0] ?? null;
144
- }
145
- function group(xs) {
146
- return groupBy(xs, (a, b) => a === b);
147
- }
148
- function groupBy(xs, isEqual) {
149
- const go = (acc, x) => {
150
- const prevGroup = last(acc);
151
- if (prevGroup) {
152
- const prevElem = last(prevGroup);
153
- if (prevElem && isEqual(prevElem, x)) {
154
- prevGroup.push(x);
155
- return acc;
156
- }
157
- }
158
- return acc.concat([[x]]);
159
- };
160
- return xs.reduce(go, []);
161
- }
162
-
163
-
164
131
/***/ }),
165
132
166
133
/***/ 5915:
@@ -346,6 +313,8 @@ exports.tail = tail;
346
313
exports.last = last;
347
314
exports.init = init;
348
315
exports.toList = toList;
316
+ exports.group = group;
317
+ exports.groupBy = groupBy;
349
318
function build(x, ...xs) {
350
319
return {
351
320
_head: x,
@@ -378,11 +347,31 @@ function last(ne) {
378
347
return t.length == 0 ? head(ne) : t.slice(-1)[0];
379
348
}
380
349
function init(ne) {
381
- return [head(ne)].concat(tail(ne).slice(-1));
350
+ const t = ne._tail;
351
+ const l = t.length;
352
+ return l === 0 ? [] : [head(ne)].concat(t.slice(0, l - 1));
382
353
}
383
354
function toList(ne) {
384
355
return [head(ne)].concat(tail(ne));
385
356
}
357
+ function group(xs) {
358
+ return groupBy(xs, (a, b) => a === b);
359
+ }
360
+ function groupBy(xs, isEqual) {
361
+ const go = (acc, x) => {
362
+ const neAcc = nonEmpty(acc);
363
+ if (!neAcc) {
364
+ return [singleton(x)];
365
+ }
366
+ const prevGroup = last(neAcc);
367
+ const prevElem = last(prevGroup);
368
+ const updated = isEqual(prevElem, x)
369
+ ? [append(prevGroup, singleton(x))]
370
+ : [prevGroup, singleton(x)];
371
+ return init(neAcc).concat(updated);
372
+ };
373
+ return xs.reduce(go, []);
374
+ }
386
375
387
376
388
377
/***/ }),
@@ -738,7 +727,15 @@ async function getPullRequest(client, paths) {
738
727
return fakePullRequest(base, paths);
739
728
}
740
729
if (base.tag === "known" && base.sha !== pr.head.sha) {
741
- core.warning(`The checked out commit does not match the event PR's head. ${base.sha} != ${pr.head.sha}. Weird things may happen.`);
730
+ core.info([
731
+ "The checked out commit does not match the event PR's head.",
732
+ `${base.sha} != ${pr.head.sha}.`,
733
+ "This usually means you've checked out the merge ref,",
734
+ "which is actions/checkout's default behavior.",
735
+ "This is usually fine, but if you have a very busy default branch,",
736
+ "Restyled could pick up changes you don't expect and do weird things.",
737
+ "Consider using `ref: ${{ github.event.pull_request.head.ref }}` instead.",
738
+ ].join(" "));
742
739
}
743
740
const pullRequestJson = temp.path({ suffix: ".json" });
744
741
fs.writeFileSync(pullRequestJson, JSON.stringify(pr));
@@ -933,7 +930,6 @@ var __importStar = (this && this.__importStar) || (function () {
933
930
})();
934
931
Object.defineProperty(exports, "__esModule", ({ value: true }));
935
932
exports.suggest = suggest;
936
- const list_1 = __nccwpck_require__(670);
937
933
const non_empty_1 = __nccwpck_require__(1571);
938
934
const NE = __importStar(__nccwpck_require__(1571));
939
935
const parse_git_patch_1 = __nccwpck_require__(297);
@@ -942,7 +938,7 @@ function suggest(baseFiles, resolved, patch) {
942
938
const suggestions = [];
943
939
patches.forEach((patch) => {
944
940
patch.files.forEach((file) => {
945
- const groups = (0, list_1 .groupBy) (file.modifiedLines, (a, b) => {
941
+ const groups = NE .groupBy(file.modifiedLines, (a, b) => {
946
942
return a.tag === b.tag || (a.tag === "removed" && b.tag === "added");
947
943
});
948
944
groups.forEach((group) => {
@@ -971,7 +967,7 @@ function suggest(baseFiles, resolved, patch) {
971
967
}
972
968
function getRemoveLineNumbers(lines) {
973
969
const acc = [];
974
- lines.forEach((line) => {
970
+ NE.toList( lines) .forEach((line) => {
975
971
if (line.tag === "removed") {
976
972
acc.push(line.removedLineNumber);
977
973
}
@@ -980,7 +976,7 @@ function getRemoveLineNumbers(lines) {
980
976
}
981
977
function getAddedLines(lines) {
982
978
const acc = [];
983
- lines.forEach((line) => {
979
+ NE.toList( lines) .forEach((line) => {
984
980
if (line.tag === "added") {
985
981
acc.push(line.line);
986
982
}
@@ -992,7 +988,7 @@ function isOnAddedLines(baseFiles, suggestion) {
992
988
const { path, startLine, endLine } = suggestion;
993
989
const suggestionSize = endLine - startLine + 1;
994
990
const lines = getPullRequestDiff(baseFiles, path);
995
- if (lines && lines .length >= suggestionSize) {
991
+ if (lines.length >= suggestionSize) {
996
992
for (let i = startLine; i <= endLine; i++) {
997
993
const line = lines.find((line) => {
998
994
return line.tag === "added" && line.addedLineNumber === i;
0 commit comments