Forgejo-patched claude-code-gitea-action (View-job URL uses per-repo run index)
Some checks failed
Test Custom Executables / test-custom-executables (push) Has been cancelled
CI / test (push) Has been cancelled
CI / prettier (push) Has been cancelled
CI / typecheck (push) Has been cancelled
Sync Base Action to claude-code-base-action / Sync base-action to claude-code-base-action repository (push) Has been cancelled
Test Claude Code Action / test-inline-prompt (push) Has been cancelled
Test Claude Code Action / test-prompt-file (push) Has been cancelled
Test Claude Env Feature / test-claude-env-with-comments (push) Has been cancelled
Test MCP Servers / test-mcp-integration (push) Has been cancelled
Test MCP Servers / test-mcp-config-flag (push) Has been cancelled
Test Settings Feature / test-settings-inline-allow (push) Has been cancelled
Test Settings Feature / test-settings-inline-deny (push) Has been cancelled
Test Settings Feature / test-settings-file-allow (push) Has been cancelled
Test Settings Feature / test-settings-file-deny (push) Has been cancelled
Some checks failed
Test Custom Executables / test-custom-executables (push) Has been cancelled
CI / test (push) Has been cancelled
CI / prettier (push) Has been cancelled
CI / typecheck (push) Has been cancelled
Sync Base Action to claude-code-base-action / Sync base-action to claude-code-base-action repository (push) Has been cancelled
Test Claude Code Action / test-inline-prompt (push) Has been cancelled
Test Claude Code Action / test-prompt-file (push) Has been cancelled
Test Claude Env Feature / test-claude-env-with-comments (push) Has been cancelled
Test MCP Servers / test-mcp-integration (push) Has been cancelled
Test MCP Servers / test-mcp-config-flag (push) Has been cancelled
Test Settings Feature / test-settings-inline-allow (push) Has been cancelled
Test Settings Feature / test-settings-inline-deny (push) Has been cancelled
Test Settings Feature / test-settings-file-allow (push) Has been cancelled
Test Settings Feature / test-settings-file-deny (push) Has been cancelled
Fork of markwylde/claude-code-gitea-action@b744372 (v1.0.21) with the 'View job' link fixed to use GITHUB_RUN_NUMBER (per-repo index) instead of GITHUB_RUN_ID (global id), because Forgejo routes run pages by per-repo index. See VENDOR.txt.
This commit is contained in:
commit
32685a740f
151 changed files with 23555 additions and 0 deletions
63
test/permissions.test.ts
Normal file
63
test/permissions.test.ts
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
import { describe, expect, test, beforeEach, afterEach, spyOn } from "bun:test";
|
||||
import * as core from "@actions/core";
|
||||
import { checkWritePermissions } from "../src/github/validation/permissions";
|
||||
import type { ParsedGitHubContext } from "../src/github/context";
|
||||
|
||||
const baseContext: ParsedGitHubContext = {
|
||||
runId: "123",
|
||||
eventName: "issue_comment",
|
||||
eventAction: "created",
|
||||
repository: {
|
||||
owner: "owner",
|
||||
repo: "repo",
|
||||
full_name: "owner/repo",
|
||||
},
|
||||
actor: "tester",
|
||||
payload: {
|
||||
action: "created",
|
||||
issue: { number: 1, body: "", title: "", user: { login: "owner" } },
|
||||
comment: { id: 1, body: "@claude ping", user: { login: "tester" } },
|
||||
} as any,
|
||||
entityNumber: 1,
|
||||
isPR: false,
|
||||
inputs: {
|
||||
mode: "tag",
|
||||
triggerPhrase: "@claude",
|
||||
assigneeTrigger: "",
|
||||
labelTrigger: "",
|
||||
allowedTools: [],
|
||||
disallowedTools: [],
|
||||
customInstructions: "",
|
||||
directPrompt: "",
|
||||
overridePrompt: "",
|
||||
branchPrefix: "claude/",
|
||||
useStickyComment: false,
|
||||
additionalPermissions: new Map(),
|
||||
useCommitSigning: false,
|
||||
},
|
||||
};
|
||||
|
||||
describe("checkWritePermissions", () => {
|
||||
let infoSpy: any;
|
||||
const originalEnv = { ...process.env };
|
||||
|
||||
beforeEach(() => {
|
||||
infoSpy = spyOn(core, "info").mockImplementation(() => {});
|
||||
process.env.GITEA_API_URL = "https://gitea.example.com/api/v1";
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
infoSpy.mockRestore();
|
||||
process.env = { ...originalEnv };
|
||||
});
|
||||
|
||||
test("returns true immediately in Gitea environments", async () => {
|
||||
const client = { api: { getBaseUrl: () => "https://gitea.example.com/api/v1" } } as any;
|
||||
const result = await checkWritePermissions(client, baseContext);
|
||||
|
||||
expect(result).toBe(true);
|
||||
expect(infoSpy).toHaveBeenCalledWith(
|
||||
"Detected Gitea environment (https://gitea.example.com/api/v1), assuming actor has permissions",
|
||||
);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue