Skip to content

Commit f10ce6b

Browse files
committed
Run git add
1 parent 9a0b274 commit f10ce6b

File tree

5 files changed

+95
-94
lines changed

5 files changed

+95
-94
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
key: v2-${{ hashFiles('repositories.json') }}
1717
- uses: actions/setup-node@v6
1818
with:
19-
node-version: '24'
19+
node-version: "24"
2020
- name: configure git
2121
run: |
2222
git config --global user.email "[email protected]"

src/prepare-repository.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ async function preparePrettierIgnoreFile(
2929

3030
const prettierIgnoreFile = path.join(directory, ".prettierignore");
3131
await writeFile(prettierIgnoreFile, content);
32+
await spawn("git", ["add", "."], { cwd: directory });
3233
}
3334

3435
export async function prepareRepository(

src/report-on-github-issue.ts

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
1-
import {
2-
IS_GITHUB_ACTION,
3-
MAXIMUM_GITHUB_COMMENT_LENGTH,
4-
GITHUB_ACTION_RUN_URL,
5-
} from "./constants.ts";
6-
import { stringifyReport, type Report } from "./report.ts";
7-
import * as logger from "./logger.ts";
8-
import assert from "node:assert";
9-
10-
export async function reportOnGithubIssue(report: {
11-
title: string;
12-
reports: Report[];
13-
}) {
14-
if (!IS_GITHUB_ACTION) {
15-
return;
16-
}
17-
18-
await Promise.all(
19-
[...getComments(report)].map((comment) => logger.report(comment)),
20-
);
21-
}
22-
23-
function* getComments({
24-
title,
25-
reports,
26-
}: {
27-
title: string;
28-
reports: Report[];
29-
}) {
30-
let pending: Report[] = [];
31-
32-
const canFit = (reports: Report[]) =>
33-
stringifyReport({ title, reports }).length < MAXIMUM_GITHUB_COMMENT_LENGTH;
34-
35-
for (const report of reports) {
36-
if (canFit([...pending, report])) {
37-
pending.push(report);
38-
continue;
39-
}
40-
41-
if (canFit([report])) {
42-
yield stringifyReport({ title, reports: pending });
43-
pending = [report];
44-
continue;
45-
}
46-
47-
const shortReport = {
48-
head: report.head,
49-
body: `**Visit [this link](${GITHUB_ACTION_RUN_URL}) to download**`,
50-
};
51-
52-
assert.ok(canFit([shortReport]));
53-
54-
if (canFit([...pending, shortReport])) {
55-
pending.push(shortReport);
56-
continue;
57-
}
58-
59-
yield stringifyReport({ title, reports: pending });
60-
pending = [shortReport];
61-
}
62-
63-
if (pending.length > 0) {
64-
yield stringifyReport({ title, reports: pending });
65-
}
66-
}
1+
import {
2+
IS_GITHUB_ACTION,
3+
MAXIMUM_GITHUB_COMMENT_LENGTH,
4+
GITHUB_ACTION_RUN_URL,
5+
} from "./constants.ts";
6+
import { stringifyReport, type Report } from "./report.ts";
7+
import * as logger from "./logger.ts";
8+
import assert from "node:assert";
9+
10+
export async function reportOnGithubIssue(report: {
11+
title: string;
12+
reports: Report[];
13+
}) {
14+
if (!IS_GITHUB_ACTION) {
15+
return;
16+
}
17+
18+
await Promise.all(
19+
[...getComments(report)].map((comment) => logger.report(comment)),
20+
);
21+
}
22+
23+
function* getComments({
24+
title,
25+
reports,
26+
}: {
27+
title: string;
28+
reports: Report[];
29+
}) {
30+
let pending: Report[] = [];
31+
32+
const canFit = (reports: Report[]) =>
33+
stringifyReport({ title, reports }).length < MAXIMUM_GITHUB_COMMENT_LENGTH;
34+
35+
for (const report of reports) {
36+
if (canFit([...pending, report])) {
37+
pending.push(report);
38+
continue;
39+
}
40+
41+
if (canFit([report])) {
42+
yield stringifyReport({ title, reports: pending });
43+
pending = [report];
44+
continue;
45+
}
46+
47+
const shortReport = {
48+
head: report.head,
49+
body: `**Visit [this link](${GITHUB_ACTION_RUN_URL}) to download**`,
50+
};
51+
52+
assert.ok(canFit([shortReport]));
53+
54+
if (canFit([...pending, shortReport])) {
55+
pending.push(shortReport);
56+
continue;
57+
}
58+
59+
yield stringifyReport({ title, reports: pending });
60+
pending = [shortReport];
61+
}
62+
63+
if (pending.length > 0) {
64+
yield stringifyReport({ title, reports: pending });
65+
}
66+
}

src/run-prettier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async function runPrettierWithVersion({
5050
return commitHash;
5151
}
5252

53-
async function installDependencies(cwd) {
53+
async function installDependencies(cwd: string) {
5454
await spawn("yarn", ["install"], {
5555
cwd,
5656
env: { YARN_ENABLE_IMMUTABLE_INSTALLS: "false" },

src/timing.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
import prettyMilliseconds from "pretty-ms";
2-
import styleText from "node-style-text";
3-
4-
const START_PREFIX = styleText.bgGray("[START]");
5-
const END_PREFIX = styleText.bgGreen("[ END ]");
6-
7-
class Timing {
8-
#message;
9-
#startMark: PerformanceMark | undefined;
10-
11-
constructor(message: string) {
12-
this.#message = message;
13-
this.#startMark = performance.mark("start");
14-
console.log(`${START_PREFIX}: ${message}`);
15-
}
16-
17-
end(message?: string) {
18-
const { duration } = performance.measure(this.#message, this.#startMark);
19-
console.log(
20-
(message ?? `${END_PREFIX}: ${this.#message}`) +
21-
` (${styleText.blue.underline(prettyMilliseconds(duration))})`,
22-
);
23-
}
24-
}
25-
26-
export { Timing };
1+
import prettyMilliseconds from "pretty-ms";
2+
import styleText from "node-style-text";
3+
4+
const START_PREFIX = styleText.bgGray("[START]");
5+
const END_PREFIX = styleText.bgGreen("[ END ]");
6+
7+
class Timing {
8+
#message;
9+
#startMark: PerformanceMark | undefined;
10+
11+
constructor(message: string) {
12+
this.#message = message;
13+
this.#startMark = performance.mark("start");
14+
console.log(`${START_PREFIX}: ${message}`);
15+
}
16+
17+
end(message?: string) {
18+
const { duration } = performance.measure(this.#message, this.#startMark);
19+
console.log(
20+
(message ?? `${END_PREFIX}: ${this.#message}`) +
21+
` (${styleText.blue.underline(prettyMilliseconds(duration))})`,
22+
);
23+
}
24+
}
25+
26+
export { Timing };

0 commit comments

Comments
 (0)