Skip to content

Commit bd7c546

Browse files
committed
Build
1 parent af563a6 commit bd7c546

File tree

1 file changed

+36
-40
lines changed

1 file changed

+36
-40
lines changed

Diff for: run/dist/index.js

+36-40
Original file line numberDiff line numberDiff line change
@@ -128,39 +128,6 @@ function cliArguments(inputs) {
128128
}
129129

130130

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-
164131
/***/ }),
165132

166133
/***/ 5915:
@@ -346,6 +313,8 @@ exports.tail = tail;
346313
exports.last = last;
347314
exports.init = init;
348315
exports.toList = toList;
316+
exports.group = group;
317+
exports.groupBy = groupBy;
349318
function build(x, ...xs) {
350319
return {
351320
_head: x,
@@ -378,11 +347,31 @@ function last(ne) {
378347
return t.length == 0 ? head(ne) : t.slice(-1)[0];
379348
}
380349
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));
382353
}
383354
function toList(ne) {
384355
return [head(ne)].concat(tail(ne));
385356
}
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+
}
386375

387376

388377
/***/ }),
@@ -738,7 +727,15 @@ async function getPullRequest(client, paths) {
738727
return fakePullRequest(base, paths);
739728
}
740729
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(" "));
742739
}
743740
const pullRequestJson = temp.path({ suffix: ".json" });
744741
fs.writeFileSync(pullRequestJson, JSON.stringify(pr));
@@ -933,7 +930,6 @@ var __importStar = (this && this.__importStar) || (function () {
933930
})();
934931
Object.defineProperty(exports, "__esModule", ({ value: true }));
935932
exports.suggest = suggest;
936-
const list_1 = __nccwpck_require__(670);
937933
const non_empty_1 = __nccwpck_require__(1571);
938934
const NE = __importStar(__nccwpck_require__(1571));
939935
const parse_git_patch_1 = __nccwpck_require__(297);
@@ -942,7 +938,7 @@ function suggest(baseFiles, resolved, patch) {
942938
const suggestions = [];
943939
patches.forEach((patch) => {
944940
patch.files.forEach((file) => {
945-
const groups = (0, list_1.groupBy)(file.modifiedLines, (a, b) => {
941+
const groups = NE.groupBy(file.modifiedLines, (a, b) => {
946942
return a.tag === b.tag || (a.tag === "removed" && b.tag === "added");
947943
});
948944
groups.forEach((group) => {
@@ -971,7 +967,7 @@ function suggest(baseFiles, resolved, patch) {
971967
}
972968
function getRemoveLineNumbers(lines) {
973969
const acc = [];
974-
lines.forEach((line) => {
970+
NE.toList(lines).forEach((line) => {
975971
if (line.tag === "removed") {
976972
acc.push(line.removedLineNumber);
977973
}
@@ -980,7 +976,7 @@ function getRemoveLineNumbers(lines) {
980976
}
981977
function getAddedLines(lines) {
982978
const acc = [];
983-
lines.forEach((line) => {
979+
NE.toList(lines).forEach((line) => {
984980
if (line.tag === "added") {
985981
acc.push(line.line);
986982
}
@@ -992,7 +988,7 @@ function isOnAddedLines(baseFiles, suggestion) {
992988
const { path, startLine, endLine } = suggestion;
993989
const suggestionSize = endLine - startLine + 1;
994990
const lines = getPullRequestDiff(baseFiles, path);
995-
if (lines && lines.length >= suggestionSize) {
991+
if (lines.length >= suggestionSize) {
996992
for (let i = startLine; i <= endLine; i++) {
997993
const line = lines.find((line) => {
998994
return line.tag === "added" && line.addedLineNumber === i;

0 commit comments

Comments
 (0)