Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/mcp-inspector.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 2 additions & 15 deletions actions/setup/js/create_discussion.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,8 @@ function resolveCategoryId(categoryConfig, itemCategory, categories) {
}
}

// Fall back to announcement-capable category if available, otherwise first category
// Fall back to first available category
if (categories.length > 0) {
// Try to find an "Announcements" category (case-insensitive)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot keep trying to use announcements first

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored — the fallback now tries "Announcements" first, then falls back to the first available category. The restriction warning is still removed since any category now works. (d1d7492)

const announcementCategory = categories.find(cat => cat.name.toLowerCase() === "announcements" || cat.slug.toLowerCase() === "announcements");

if (announcementCategory) {
return {
id: announcementCategory.id,
matchType: "fallback-announcement",
name: announcementCategory.name,
requestedCategory: categoryToMatch,
};
}

// Otherwise use first category
return {
id: categories[0].id,
matchType: "fallback",
Expand Down Expand Up @@ -261,7 +248,7 @@ function isPermissionsError(errorMessage) {
async function handleFallbackToIssue(createIssueHandler, item, qualifiedItemRepo, resolvedTemporaryIds, contextMessage) {
try {
// Prepare issue message with a note about the fallback
const fallbackNote = `\n\n---\n\n> [!WARNING]\n> This was intended to be a discussion, but discussions could not be created due to permissions issues. This issue was created as a fallback.\n>\n> Discussion creation may fail if the specified category is not announcement-capable. Consider using the "Announcements" category or another announcement-capable category in your workflow configuration.\n`;
const fallbackNote = `\n\n---\n\n> [!WARNING]\n> This was intended to be a discussion, but discussions could not be created due to permissions issues. This issue was created as a fallback.\n`;
const issueMessage = {
...item,
body: (item.body || "") + fallbackNote,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ describe("create_discussion category normalization", () => {
expect(createMutationCall[1].categoryId).toBe("DIC_kwDOGFsHUM4BsUn1"); // General (first)
});

it("should prefer Announcements category when no category specified", async () => {
// Mock categories with Announcements available
it("should fallback to first category when no category specified and Announcements available", async () => {
// Mock categories with Announcements available - but it should NOT be preferred
mockGithub.graphql = vi.fn().mockImplementation((query, variables) => {
if (query.includes("discussionCategories")) {
return Promise.resolve({
Expand Down Expand Up @@ -340,14 +340,14 @@ describe("create_discussion category normalization", () => {
expect(result.success).toBe(true);
expect(result.number).toBe(42);

// Verify Announcements category was used (not General which is first)
// Verify first category (General) was used, not Announcements
const createMutationCall = mockGithub.graphql.mock.calls.find(call => call[0].includes("createDiscussion"));
expect(createMutationCall).toBeDefined();
expect(createMutationCall[1].categoryId).toBe("DIC_kwDOGFsHUM4BsUn4"); // Announcements
expect(createMutationCall[1].categoryId).toBe("DIC_kwDOGFsHUM4BsUn1"); // General (first)
});

it("should prefer Announcements category when non-existent category specified", async () => {
// Mock categories with Announcements available
it("should fallback to first category when non-existent category specified", async () => {
// Mock categories with Announcements available - but first category should be used as fallback
mockGithub.graphql = vi.fn().mockImplementation((query, variables) => {
if (query.includes("discussionCategories")) {
return Promise.resolve({
Expand Down Expand Up @@ -403,9 +403,9 @@ describe("create_discussion category normalization", () => {
expect(result.success).toBe(true);
expect(result.number).toBe(42);

// Verify Announcements category was used (not General which is first)
// Verify first category (General) was used as fallback, not Announcements
const createMutationCall = mockGithub.graphql.mock.calls.find(call => call[0].includes("createDiscussion"));
expect(createMutationCall).toBeDefined();
expect(createMutationCall[1].categoryId).toBe("DIC_kwDOGFsHUM4BsUn4"); // Announcements
expect(createMutationCall[1].categoryId).toBe("DIC_kwDOGFsHUM4BsUn1"); // General (first)
});
});
1 change: 1 addition & 0 deletions docs/src/content/docs/agent-factory-status.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ These are experimental agentic workflows used by the GitHub Next team to learn,
| [Daily Fact About gh-aw](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-fact.md) | codex | [![Daily Fact About gh-aw](https://github.com/github/gh-aw/actions/workflows/daily-fact.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-fact.lock.yml) | `0 11 * * 1-5` | - |
| [Daily File Diet](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-file-diet.md) | copilot | [![Daily File Diet](https://github.com/github/gh-aw/actions/workflows/daily-file-diet.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-file-diet.lock.yml) | `0 13 * * 1-5` | - |
| [Daily Firewall Logs Collector and Reporter](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-firewall-report.md) | copilot | [![Daily Firewall Logs Collector and Reporter](https://github.com/github/gh-aw/actions/workflows/daily-firewall-report.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-firewall-report.lock.yml) | - | - |
| [Daily Go Function Namer](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-function-namer.md) | claude | [![Daily Go Function Namer](https://github.com/github/gh-aw/actions/workflows/daily-function-namer.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-function-namer.lock.yml) | - | - |
| [Daily Issues Report Generator](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-issues-report.md) | codex | [![Daily Issues Report Generator](https://github.com/github/gh-aw/actions/workflows/daily-issues-report.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-issues-report.lock.yml) | - | - |
| [Daily Malicious Code Scan Agent](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-malicious-code-scan.md) | copilot | [![Daily Malicious Code Scan Agent](https://github.com/github/gh-aw/actions/workflows/daily-malicious-code-scan.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-malicious-code-scan.lock.yml) | - | - |
| [Daily MCP Tool Concurrency Analysis](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-mcp-concurrency-analysis.md) | copilot | [![Daily MCP Tool Concurrency Analysis](https://github.com/github/gh-aw/actions/workflows/daily-mcp-concurrency-analysis.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-mcp-concurrency-analysis.lock.yml) | `0 9 * * 1-5` | - |
Expand Down
12 changes: 6 additions & 6 deletions docs/src/content/docs/reference/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,16 @@ Yes! Use [TrialOps](/gh-aw/patterns/trial-ops/) to test workflows in isolated tr

See [Common Issues](/gh-aw/troubleshooting/common-issues/) for detailed troubleshooting guidance including workflow failures, debugging strategies, permission issues, and network problems.

### Why is my create-discussion workflow failing with integration-forbidden?

Discussion creation requires announcement-capable categories. If your workflow fails with an `integration-forbidden` error, ensure the `category` field in your configuration specifies a category that has announcement capabilities enabled in your repository's discussion settings.
### Why is my create-discussion workflow failing?

Common issues:
- **Non-announcement categories**: Only categories configured to support announcements can be used for automated discussion creation. Check your repository's discussion settings to verify which categories have announcement capabilities.
- **Category name typos**: Verify the category name spelling in your workflow configuration matches exactly with your repository's discussion categories. Category names are case-sensitive.

- **Category name typos**: Verify the category name spelling in your workflow configuration matches your repository's discussion categories. Category names are matched case-insensitively, but check for typos.
- **Category slugs**: Use lowercase category slugs (e.g., `general`, `announcements`) rather than display names for better reliability.
- **Discussions not enabled**: Ensure discussions are enabled for your repository in **Settings → Features → Discussions**.
- **Insufficient permissions**: The workflow requires `discussions: write` permission.

If discussions are not enabled or the category lacks announcement capabilities, consider using `fallback-to-issue: true` (the default) to automatically create an issue instead. See [Discussion Creation](/gh-aw/reference/safe-outputs/#discussion-creation-create-discussion) for configuration details.
If discussions are not enabled or the workflow lacks permissions, consider using `fallback-to-issue: true` (the default) to automatically create an issue instead. See [Discussion Creation](/gh-aw/reference/safe-outputs/#discussion-creation-create-discussion) for configuration details.

### Why is my create-pull-request workflow failing with "GitHub Actions is not permitted to create or approve pull requests"?

Expand Down
5 changes: 1 addition & 4 deletions docs/src/content/docs/reference/safe-outputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -945,14 +945,11 @@ Creates discussions with optional `category` (slug, name, or ID; defaults to fir

**Category Naming Standard**: Use lowercase, plural category names (e.g., `audits`, `general`, `reports`) for consistency and better searchability. GitHub Discussion category IDs (starting with `DIC_`) are also supported.

> [!WARNING]
> Only announcement-capable category succeeds; all non-announcement categories fail with integration-forbidden.

```yaml wrap
safe-outputs:
create-discussion:
title-prefix: "[ai] " # prefix for titles
category: "announcements" # category slug, name, or ID (use lowercase, prefer announcement-capable)
category: "general" # category slug, name, or ID (use lowercase)
Comment thread
pelikhan marked this conversation as resolved.
Outdated
expires: 3 # auto-close after 3 days (or false to disable)
max: 3 # max discussions (default: 1)
target-repo: "owner/repo" # cross-repository
Expand Down
27 changes: 6 additions & 21 deletions pkg/workflow/data/action_pins.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,11 @@
"version": "v4.1.0",
"sha": "a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32"
},
"actions/cache/restore@v4": {
"repo": "actions/cache/restore",
"version": "v4",
"sha": "0057852bfaa89a56745cba8c7296529d2fc39830"
},
"actions/cache/restore@v5.0.3": {
"repo": "actions/cache/restore",
"version": "v5.0.3",
"sha": "cdf6c1fa76f9f475f3d7449005a359c84ca0f306"
},
"actions/cache/save@v4": {
"repo": "actions/cache/save",
"version": "v4",
"sha": "0057852bfaa89a56745cba8c7296529d2fc39830"
},
"actions/cache/save@v5.0.3": {
"repo": "actions/cache/save",
"version": "v5.0.3",
Expand All @@ -40,10 +30,10 @@
"version": "v6.0.2",
"sha": "de0fac2e4500dabe0009e67214ff5f5447ce83dd"
},
"actions/create-github-app-token@v3.0.0-beta.2": {
"actions/create-github-app-token@v3.0.0-beta.4": {
"repo": "actions/create-github-app-token",
"version": "v3.0.0-beta.2",
"sha": "bf559f85448f9380bcfa2899dbdc01eb5b37be3a"
"version": "v3.0.0-beta.4",
"sha": "a7f885bf4560200d03183ed941cb6fb072e4b343"
},
"actions/download-artifact@v8.0.1": {
"repo": "actions/download-artifact",
Expand All @@ -70,11 +60,6 @@
"version": "v5.2.0",
"sha": "be666c2fcd27ec809703dec50e508c2fdc7f6654"
},
"actions/setup-node@v4": {
"repo": "actions/setup-node",
"version": "v4",
"sha": "49933ea5288caeca8642d1e84afbd3f7d6820020"
},
"actions/setup-node@v6.3.0": {
"repo": "actions/setup-node",
"version": "v6.3.0",
Expand All @@ -95,10 +80,10 @@
"version": "v0.23.1",
"sha": "57aae528053a48a3f6235f2d9461b05fbcb7366d"
},
"astral-sh/setup-uv@v7.4.0": {
"astral-sh/setup-uv@v7.5.0": {
"repo": "astral-sh/setup-uv",
"version": "v7.4.0",
"sha": "6ee6290f1cbc4156c0bdd66691b2c144ef8df19a"
"version": "v7.5.0",
"sha": "e06108dd0aef18192324c70427afc47652e63a82"
},
"cli/gh-extension-precompile@v2.1.0": {
"repo": "cli/gh-extension-precompile",
Expand Down
Loading