fix: update bot name format to include [bot] suffix in tests and docs

- Update test cases to use correct bot actor names with [bot] suffix
- Update documentation example to show correct bot name format
- Align with GitHub's actual bot naming convention

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Yuku Kotani
2025-08-06 14:19:37 +09:00
parent 15f62ad7ce
commit 28cc702619
2 changed files with 9 additions and 9 deletions

View File

@@ -43,7 +43,7 @@ jobs:
# additional_permissions: | # additional_permissions: |
# actions: read # actions: read
# Optional: allow bot users to trigger the action # Optional: allow bot users to trigger the action
# allowed_bots: "dependabot,renovate" # allowed_bots: "dependabot[bot],renovate[bot]"
``` ```
## Inputs ## Inputs

View File

@@ -31,18 +31,18 @@ describe("checkHumanActor", () => {
test("should throw error for bot actor when not allowed", async () => { test("should throw error for bot actor when not allowed", async () => {
const mockOctokit = createMockOctokit("Bot"); const mockOctokit = createMockOctokit("Bot");
const context = createMockContext(); const context = createMockContext();
context.actor = "test-bot"; context.actor = "test-bot[bot]";
context.inputs.allowedBots = ""; context.inputs.allowedBots = "";
await expect(checkHumanActor(mockOctokit, context)).rejects.toThrow( await expect(checkHumanActor(mockOctokit, context)).rejects.toThrow(
"Workflow initiated by non-human actor: test-bot (type: Bot). Add bot to allowed_bots list or use '*' to allow all bots.", "Workflow initiated by non-human actor: test-bot[bot] (type: Bot). Add bot to allowed_bots list or use '*' to allow all bots.",
); );
}); });
test("should pass for bot actor when all bots allowed", async () => { test("should pass for bot actor when all bots allowed", async () => {
const mockOctokit = createMockOctokit("Bot"); const mockOctokit = createMockOctokit("Bot");
const context = createMockContext(); const context = createMockContext();
context.actor = "test-bot"; context.actor = "test-bot[bot]";
context.inputs.allowedBots = "*"; context.inputs.allowedBots = "*";
await expect( await expect(
@@ -53,8 +53,8 @@ describe("checkHumanActor", () => {
test("should pass for specific bot when in allowed list", async () => { test("should pass for specific bot when in allowed list", async () => {
const mockOctokit = createMockOctokit("Bot"); const mockOctokit = createMockOctokit("Bot");
const context = createMockContext(); const context = createMockContext();
context.actor = "dependabot"; context.actor = "dependabot[bot]";
context.inputs.allowedBots = "dependabot,renovate"; context.inputs.allowedBots = "dependabot[bot],renovate[bot]";
await expect( await expect(
checkHumanActor(mockOctokit, context), checkHumanActor(mockOctokit, context),
@@ -64,11 +64,11 @@ describe("checkHumanActor", () => {
test("should throw error for bot not in allowed list", async () => { test("should throw error for bot not in allowed list", async () => {
const mockOctokit = createMockOctokit("Bot"); const mockOctokit = createMockOctokit("Bot");
const context = createMockContext(); const context = createMockContext();
context.actor = "other-bot"; context.actor = "other-bot[bot]";
context.inputs.allowedBots = "dependabot,renovate"; context.inputs.allowedBots = "dependabot[bot],renovate[bot]";
await expect(checkHumanActor(mockOctokit, context)).rejects.toThrow( await expect(checkHumanActor(mockOctokit, context)).rejects.toThrow(
"Workflow initiated by non-human actor: other-bot (type: Bot). Add bot to allowed_bots list or use '*' to allow all bots.", "Workflow initiated by non-human actor: other-bot[bot] (type: Bot). Add bot to allowed_bots list or use '*' to allow all bots.",
); );
}); });
}); });