fix: downgrade @actions/artifact to v1 for Gitea compatibility
Lint / pre-commit Linting (push) Successful in 51s
Test / Run Tests (push) Successful in 1m19s

This commit is contained in:
2026-05-16 22:21:45 +02:00
parent 05fe8a3dcd
commit 1874e823e3
5 changed files with 59 additions and 1927 deletions
+14 -24
View File
@@ -12,19 +12,19 @@ vi.mock("@actions/core", () => ({
}));
import * as artifact from "@actions/artifact";
vi.mock("@actions/artifact", () => ({
DefaultArtifactClient: class {
uploadArtifact() {
return Promise.resolve({});
}
},
}));
vi.mock("@actions/artifact", () => {
const mockClient = {
uploadArtifact: vi.fn().mockResolvedValue({}),
};
return {
create: vi.fn(() => mockClient),
};
});
import * as core from "@actions/core";
import fs from "fs";
import os from "os";
import path from "path";
import { DefaultArtifactClient } from "@actions/artifact";
import {
isOfficialServer,
@@ -178,29 +178,22 @@ describe("uploadLogArtifacts", () => {
vi.clearAllMocks();
});
it("instantiates DefaultArtifactClient and calls uploadArtifact", async () => {
const spy = vi.spyOn(
artifact.DefaultArtifactClient.prototype,
"uploadArtifact",
);
it("instantiates client and calls uploadArtifact", async () => {
await uploadLogArtifacts(
["/path/to/shard0_console_log.txt"],
"custom-name",
);
expect(spy).toHaveBeenCalledWith(
expect(artifact.create().uploadArtifact).toHaveBeenCalledWith(
"custom-name",
["/path/to/shard0_console_log.txt"],
"/path/to",
{ continueOnError: true },
);
});
it("does nothing if filePaths is empty", async () => {
const spy = vi.spyOn(
artifact.DefaultArtifactClient.prototype,
"uploadArtifact",
);
await uploadLogArtifacts([]);
expect(spy).not.toHaveBeenCalled();
expect(artifact.create().uploadArtifact).not.toHaveBeenCalled();
});
});
@@ -622,22 +615,19 @@ describe("monitorConsole", () => {
}, 50);
// Verify uploadArtifact was called with two files
const spy = vi.spyOn(
artifact.DefaultArtifactClient.prototype,
"uploadArtifact",
);
await monitorConsole(api, {
...BASE_OPTS,
logToFile: true,
});
expect(spy).toHaveBeenCalledWith(
expect(artifact.create().uploadArtifact).toHaveBeenCalledWith(
"screeps-console-log",
expect.arrayContaining([
expect.stringContaining("shard0_console_log.txt"),
expect.stringContaining("shard1_console_log.txt"),
]),
expect.any(String),
{ continueOnError: true },
);
});
});