Skip to content

Commit 2df6e14

Browse files
committed
fix: add tests
1 parent 41c6ec5 commit 2df6e14

8 files changed

Lines changed: 396 additions & 43 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"dot-github": patch
3+
---
4+
5+
Modernize runtime and toolchain: Node 26.10.0, pnpm 12.9.1, Nx 23.3, TypeScript 6, ESLint 9 flat config migration, Vitest 5, and latest `@actions/*` SDKs across all actions and apps. Hardens `signed-commits` `commitAll` against unreadable paths (directories/symlinks) in git status.

‎actions/signed-commits/dist/index.js‎

Lines changed: 24 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎actions/signed-commits/src/git/github-git/repo-status.ts‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { execWithOutput } from "../../utils";
22
import { join } from "path";
3-
import { readFileSync } from "fs";
3+
import { readFileSync, statSync } from "fs";
44
import {
55
FileChanges,
66
FileAddition,
@@ -23,10 +23,14 @@ interface GitFileStatus {
2323
}
2424

2525
export async function getGitStatusPorcelainV1(cwd?: string) {
26-
const stdout = await execWithOutput("git", ["status", "--porcelain=v1"], {
27-
cwd,
28-
notrim: true,
29-
});
26+
const stdout = await execWithOutput(
27+
"git",
28+
["status", "--porcelain=v1", "--untracked-files=all"],
29+
{
30+
cwd,
31+
notrim: true,
32+
},
33+
);
3034

3135
return stdout;
3236
}
@@ -111,13 +115,16 @@ export async function calculateFileChanges(
111115
changes: FilesToAddOrDelete,
112116
cwd = "",
113117
): Promise<FileChanges> {
114-
const additions: FileAddition[] = changes.additions.map((path) => {
118+
const additions: FileAddition[] = changes.additions.flatMap((path) => {
115119
const fullPath = join(cwd, path);
120+
if (!statSync(fullPath, { throwIfNoEntry: false })?.isFile()) return [];
116121
const contents = readFileSync(fullPath).toString("base64");
117-
return {
118-
path,
119-
contents,
120-
};
122+
return [
123+
{
124+
path,
125+
contents,
126+
},
127+
];
121128
});
122129

123130
const deletions: FileDeletion[] = changes.deletions.map((path) => {

‎apps/actions-dependencies-updater/src/caches.mts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class Cache<T extends Record<string, any>> {
110110
private load(): T {
111111
try {
112112
const cache = fs.readFileSync(this.filePath, "utf-8");
113-
return cache ? JSON.parse(cache) : {};
113+
return cache ? (JSON.parse(cache) as T) : ({} as T);
114114
} catch (e: any) {
115115
if (e.code === "ENOENT") {
116116
log.warn("No cache found - continuing without");

0 commit comments

Comments
 (0)