diff --git a/.changeset/patch-sort-mermaid-nodes.md b/.changeset/patch-sort-mermaid-nodes.md new file mode 100644 index 00000000000..7935f171740 --- /dev/null +++ b/.changeset/patch-sort-mermaid-nodes.md @@ -0,0 +1,5 @@ +--- +"gh-aw": patch +--- + +Sort mermaid graph nodes alphabetically for stable code generation diff --git a/.github/workflows/artifacts-summary.lock.yml b/.github/workflows/artifacts-summary.lock.yml index a70fd44f2ea..bfc4cac7c8c 100644 --- a/.github/workflows/artifacts-summary.lock.yml +++ b/.github/workflows/artifacts-summary.lock.yml @@ -6,17 +6,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_discussion["create_discussion"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_discussion # detection --> create_discussion +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/audit-workflows.lock.yml b/.github/workflows/audit-workflows.lock.yml index 98f4aedc185..92cfc29ab8d 100644 --- a/.github/workflows/audit-workflows.lock.yml +++ b/.github/workflows/audit-workflows.lock.yml @@ -10,17 +10,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_discussion["create_discussion"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_discussion # detection --> create_discussion +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/brave.lock.yml b/.github/workflows/brave.lock.yml index 40569cc205a..181dacd1221 100644 --- a/.github/workflows/brave.lock.yml +++ b/.github/workflows/brave.lock.yml @@ -10,18 +10,18 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] +# add_comment["add_comment"] # agent["agent"] # detection["detection"] -# add_comment["add_comment"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # update_reaction["update_reaction"] # pre_activation --> activation -# activation --> agent -# agent --> detection # agent --> add_comment # detection --> add_comment +# activation --> agent +# agent --> detection # agent --> missing_tool # detection --> missing_tool # agent --> update_reaction diff --git a/.github/workflows/changeset-generator.lock.yml b/.github/workflows/changeset-generator.lock.yml index 6dc2e5497c0..c7f3c7d41a6 100644 --- a/.github/workflows/changeset-generator.lock.yml +++ b/.github/workflows/changeset-generator.lock.yml @@ -10,19 +10,19 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] # detection["detection"] -# push_to_pull_request_branch["push_to_pull_request_branch"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] +# push_to_pull_request_branch["push_to_pull_request_branch"] # pre_activation --> activation # activation --> agent # agent --> detection -# agent --> push_to_pull_request_branch -# detection --> push_to_pull_request_branch # agent --> missing_tool # detection --> missing_tool +# agent --> push_to_pull_request_branch +# detection --> push_to_pull_request_branch # ``` name: "Changeset Generator" diff --git a/.github/workflows/ci-doctor.lock.yml b/.github/workflows/ci-doctor.lock.yml index 019be52cb49..b42bb032865 100644 --- a/.github/workflows/ci-doctor.lock.yml +++ b/.github/workflows/ci-doctor.lock.yml @@ -9,18 +9,18 @@ # ```mermaid # graph LR # activation["activation"] +# add_comment["add_comment"] # agent["agent"] -# detection["detection"] # create_issue["create_issue"] -# add_comment["add_comment"] +# detection["detection"] # missing_tool["missing_tool"] # update_reaction["update_reaction"] +# agent --> add_comment +# detection --> add_comment # activation --> agent -# agent --> detection # agent --> create_issue # detection --> create_issue -# agent --> add_comment -# detection --> add_comment +# agent --> detection # agent --> missing_tool # detection --> missing_tool # agent --> update_reaction diff --git a/.github/workflows/cli-version-checker.lock.yml b/.github/workflows/cli-version-checker.lock.yml index b92a947836f..d661d898f75 100644 --- a/.github/workflows/cli-version-checker.lock.yml +++ b/.github/workflows/cli-version-checker.lock.yml @@ -6,17 +6,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_pull_request["create_pull_request"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_pull_request # detection --> create_pull_request +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/daily-doc-updater.lock.yml b/.github/workflows/daily-doc-updater.lock.yml index 50ec1e8c739..0feb950662c 100644 --- a/.github/workflows/daily-doc-updater.lock.yml +++ b/.github/workflows/daily-doc-updater.lock.yml @@ -6,17 +6,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_pull_request["create_pull_request"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_pull_request # detection --> create_pull_request +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/daily-news.lock.yml b/.github/workflows/daily-news.lock.yml index 8d727e74bbe..b687efacaea 100644 --- a/.github/workflows/daily-news.lock.yml +++ b/.github/workflows/daily-news.lock.yml @@ -10,17 +10,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_discussion["create_discussion"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_discussion # detection --> create_discussion +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/dev.lock.yml b/.github/workflows/dev.lock.yml index f47a97e37d7..f5424e81d6c 100644 --- a/.github/workflows/dev.lock.yml +++ b/.github/workflows/dev.lock.yml @@ -8,17 +8,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_issue["create_issue"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_issue # detection --> create_issue +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/duplicate-code-detector.lock.yml b/.github/workflows/duplicate-code-detector.lock.yml index 0274e8e4934..cd151f14a43 100644 --- a/.github/workflows/duplicate-code-detector.lock.yml +++ b/.github/workflows/duplicate-code-detector.lock.yml @@ -10,17 +10,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_issue["create_issue"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_issue # detection --> create_issue +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/example-workflow-analyzer.lock.yml b/.github/workflows/example-workflow-analyzer.lock.yml index 35f5e68f98c..e7ad75cea59 100644 --- a/.github/workflows/example-workflow-analyzer.lock.yml +++ b/.github/workflows/example-workflow-analyzer.lock.yml @@ -6,17 +6,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_issue["create_issue"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_issue # detection --> create_issue +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/github-mcp-tools-report.lock.yml b/.github/workflows/github-mcp-tools-report.lock.yml index 76da1a7035c..dd8b39c55d4 100644 --- a/.github/workflows/github-mcp-tools-report.lock.yml +++ b/.github/workflows/github-mcp-tools-report.lock.yml @@ -6,20 +6,20 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_discussion["create_discussion"] # create_pull_request["create_pull_request"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_discussion # detection --> create_discussion # agent --> create_pull_request # detection --> create_pull_request +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/go-pattern-detector.lock.yml b/.github/workflows/go-pattern-detector.lock.yml index a3d1fc0c259..e30c58a0c3f 100644 --- a/.github/workflows/go-pattern-detector.lock.yml +++ b/.github/workflows/go-pattern-detector.lock.yml @@ -10,17 +10,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_issue["create_issue"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_issue # detection --> create_issue +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/issue-classifier.lock.yml b/.github/workflows/issue-classifier.lock.yml index eaabc0cf687..b3a42870bae 100644 --- a/.github/workflows/issue-classifier.lock.yml +++ b/.github/workflows/issue-classifier.lock.yml @@ -10,17 +10,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] +# add_labels["add_labels"] # agent["agent"] # detection["detection"] -# add_labels["add_labels"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation -# activation --> agent -# agent --> detection # agent --> add_labels # detection --> add_labels +# activation --> agent +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/lockfile-stats.lock.yml b/.github/workflows/lockfile-stats.lock.yml index f8e868f8679..b01136c5c37 100644 --- a/.github/workflows/lockfile-stats.lock.yml +++ b/.github/workflows/lockfile-stats.lock.yml @@ -6,17 +6,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_discussion["create_discussion"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_discussion # detection --> create_discussion +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/mcp-inspector.lock.yml b/.github/workflows/mcp-inspector.lock.yml index 9451b1eb7fa..1f21cc85174 100644 --- a/.github/workflows/mcp-inspector.lock.yml +++ b/.github/workflows/mcp-inspector.lock.yml @@ -25,25 +25,25 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_discussion["create_discussion"] +# detection["detection"] # missing_tool["missing_tool"] -# post_to_slack_channel["post_to_slack_channel"] # notion_add_comment["notion_add_comment"] +# post_to_slack_channel["post_to_slack_channel"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_discussion # detection --> create_discussion +# agent --> detection # agent --> missing_tool # detection --> missing_tool -# agent --> post_to_slack_channel -# detection --> post_to_slack_channel # agent --> notion_add_comment # detection --> notion_add_comment +# agent --> post_to_slack_channel +# detection --> post_to_slack_channel # ``` name: "MCP Inspector Agent" @@ -4716,11 +4716,11 @@ jobs: core.setFailed(`Error processing missing-tool reports: ${error}`); }); - post_to_slack_channel: + notion_add_comment: needs: - agent - detection - if: (always()) && (contains(needs.agent.outputs.output_types, 'post_to_slack_channel')) + if: (always()) && (contains(needs.agent.outputs.output_types, 'notion_add_comment')) runs-on: ubuntu-latest permissions: contents: read @@ -4735,27 +4735,25 @@ jobs: run: | find /tmp/gh-aw/safe-jobs/ -type f -print echo "GITHUB_AW_AGENT_OUTPUT=/tmp/gh-aw/safe-jobs/agent_output.json" >> $GITHUB_ENV - - name: Post message to Slack + - name: Add comment to Notion page uses: actions/github-script@v8 env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - SLACK_CHANNEL_ID: ${{ env.GH_AW_SLACK_CHANNEL_ID }} + NOTION_API_TOKEN: ${{ secrets.NOTION_API_TOKEN }} + NOTION_PAGE_ID: ${{ vars.NOTION_PAGE_ID }} with: script: |- const fs = require('fs'); - const slackBotToken = process.env.SLACK_BOT_TOKEN; - const slackChannelId = process.env.SLACK_CHANNEL_ID; + const notionToken = process.env.NOTION_API_TOKEN; + const pageId = process.env.NOTION_PAGE_ID; const isStaged = process.env.GITHUB_AW_SAFE_OUTPUTS_STAGED === 'true'; const outputContent = process.env.GITHUB_AW_AGENT_OUTPUT; - // Validate required environment variables - if (!slackBotToken) { - core.setFailed('SLACK_BOT_TOKEN secret is not configured. Please add it to your repository secrets.'); + if (!notionToken) { + core.setFailed('NOTION_API_TOKEN secret is not configured'); return; } - - if (!slackChannelId) { - core.setFailed('GH_AW_SLACK_CHANNEL_ID environment variable is required'); + if (!pageId) { + core.setFailed('NOTION_PAGE_ID variable is not set'); return; } @@ -4779,91 +4777,79 @@ jobs: return; } - // Filter for post_to_slack_channel items - const slackMessageItems = agentOutputData.items.filter(item => item.type === 'post_to_slack_channel'); + // Filter for notion_add_comment items + const notionCommentItems = agentOutputData.items.filter(item => item.type === 'notion_add_comment'); - if (slackMessageItems.length === 0) { - core.info('No post_to_slack_channel items found in agent output'); + if (notionCommentItems.length === 0) { + core.info('No notion_add_comment items found in agent output'); return; } - core.info(`Found ${slackMessageItems.length} post_to_slack_channel item(s)`); - - // Process each message item - for (let i = 0; i < slackMessageItems.length; i++) { - const item = slackMessageItems[i]; - const message = item.message; + core.info(`Found ${notionCommentItems.length} notion_add_comment item(s)`); - if (!message) { - core.warning(`Item ${i + 1}: Missing message field, skipping`); - continue; - } + // Process each comment item + for (let i = 0; i < notionCommentItems.length; i++) { + const item = notionCommentItems[i]; + const comment = item.comment; - // Validate message length (max 200 characters) - const maxLength = 200; - if (message.length > maxLength) { - core.warning(`Item ${i + 1}: Message length (${message.length} characters) exceeds maximum allowed length of ${maxLength} characters, skipping`); + if (!comment) { + core.warning(`Item ${i + 1}: Missing comment field, skipping`); continue; } if (isStaged) { - let summaryContent = "## 🎭 Staged Mode: Slack Message Preview\n\n"; - summaryContent += "The following message would be posted to Slack if staged mode was disabled:\n\n"; - summaryContent += `**Channel ID:** ${slackChannelId}\n\n`; - summaryContent += `**Message:** ${message}\n\n`; - summaryContent += `**Message Length:** ${message.length} characters\n\n`; + let summaryContent = "## 🎭 Staged Mode: Notion Comment Preview\n\n"; + summaryContent += "The following comment would be added to Notion if staged mode was disabled:\n\n"; + summaryContent += `**Page ID:** ${pageId}\n\n`; + summaryContent += `**Comment:**\n${comment}\n\n`; await core.summary.addRaw(summaryContent).write(); - core.info("📝 Slack message preview written to step summary"); + core.info("📝 Notion comment preview written to step summary"); continue; } - core.info(`Posting message ${i + 1}/${slackMessageItems.length} to Slack channel: ${slackChannelId}`); - core.info(`Message length: ${message.length} characters`); + core.info(`Adding comment ${i + 1}/${notionCommentItems.length} to Notion page: ${pageId}`); try { - const response = await fetch('https://slack.com/api/chat.postMessage', { + const response = await fetch('https://api.notion.com/v1/comments', { method: 'POST', headers: { - 'Content-Type': 'application/json; charset=utf-8', - 'Authorization': `Bearer ${slackBotToken}` + 'Authorization': `Bearer ${notionToken}`, + 'Notion-Version': '2022-06-28', + 'Content-Type': 'application/json' }, body: JSON.stringify({ - channel: slackChannelId, - text: message + parent: { + page_id: pageId + }, + rich_text: [{ + type: 'text', + text: { + content: comment + } + }] }) }); - const data = await response.json(); - if (!response.ok) { - core.setFailed(`Slack API HTTP error (${response.status}): ${response.statusText}`); - return; - } - - if (!data.ok) { - core.setFailed(`Slack API error: ${data.error || 'Unknown error'}`); - if (data.error === 'invalid_auth') { - core.error('Authentication failed. Please verify your SLACK_BOT_TOKEN is correct.'); - } else if (data.error === 'channel_not_found') { - core.error('Channel not found. Please verify the GH_AW_SLACK_CHANNEL_ID environment variable is correct and the bot has access to it.'); - } + const errorData = await response.text(); + core.setFailed(`Notion API error (${response.status}): ${errorData}`); return; } - core.info(`✅ Message ${i + 1} posted successfully to Slack`); - core.info(`Message timestamp: ${data.ts}`); - core.info(`Channel: ${data.channel}`); + const data = await response.json(); + core.info(`✅ Comment ${i + 1} added successfully`); + core.info(`Comment ID: ${data.id}`); } catch (error) { - core.setFailed(`Failed to post message ${i + 1} to Slack: ${error instanceof Error ? error.message : String(error)}`); + core.setFailed(`Failed to add comment ${i + 1}: ${error instanceof Error ? error.message : String(error)}`); return; } } - notion_add_comment: + post_to_slack_channel: needs: - agent - detection - if: (always()) && (contains(needs.agent.outputs.output_types, 'notion_add_comment')) + if: (always()) && (contains(needs.agent.outputs.output_types, 'post_to_slack_channel')) runs-on: ubuntu-latest permissions: contents: read @@ -4878,25 +4864,27 @@ jobs: run: | find /tmp/gh-aw/safe-jobs/ -type f -print echo "GITHUB_AW_AGENT_OUTPUT=/tmp/gh-aw/safe-jobs/agent_output.json" >> $GITHUB_ENV - - name: Add comment to Notion page + - name: Post message to Slack uses: actions/github-script@v8 env: - NOTION_API_TOKEN: ${{ secrets.NOTION_API_TOKEN }} - NOTION_PAGE_ID: ${{ vars.NOTION_PAGE_ID }} + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + SLACK_CHANNEL_ID: ${{ env.GH_AW_SLACK_CHANNEL_ID }} with: script: |- const fs = require('fs'); - const notionToken = process.env.NOTION_API_TOKEN; - const pageId = process.env.NOTION_PAGE_ID; + const slackBotToken = process.env.SLACK_BOT_TOKEN; + const slackChannelId = process.env.SLACK_CHANNEL_ID; const isStaged = process.env.GITHUB_AW_SAFE_OUTPUTS_STAGED === 'true'; const outputContent = process.env.GITHUB_AW_AGENT_OUTPUT; - if (!notionToken) { - core.setFailed('NOTION_API_TOKEN secret is not configured'); + // Validate required environment variables + if (!slackBotToken) { + core.setFailed('SLACK_BOT_TOKEN secret is not configured. Please add it to your repository secrets.'); return; } - if (!pageId) { - core.setFailed('NOTION_PAGE_ID variable is not set'); + + if (!slackChannelId) { + core.setFailed('GH_AW_SLACK_CHANNEL_ID environment variable is required'); return; } @@ -4920,70 +4908,82 @@ jobs: return; } - // Filter for notion_add_comment items - const notionCommentItems = agentOutputData.items.filter(item => item.type === 'notion_add_comment'); + // Filter for post_to_slack_channel items + const slackMessageItems = agentOutputData.items.filter(item => item.type === 'post_to_slack_channel'); - if (notionCommentItems.length === 0) { - core.info('No notion_add_comment items found in agent output'); + if (slackMessageItems.length === 0) { + core.info('No post_to_slack_channel items found in agent output'); return; } - core.info(`Found ${notionCommentItems.length} notion_add_comment item(s)`); + core.info(`Found ${slackMessageItems.length} post_to_slack_channel item(s)`); - // Process each comment item - for (let i = 0; i < notionCommentItems.length; i++) { - const item = notionCommentItems[i]; - const comment = item.comment; + // Process each message item + for (let i = 0; i < slackMessageItems.length; i++) { + const item = slackMessageItems[i]; + const message = item.message; - if (!comment) { - core.warning(`Item ${i + 1}: Missing comment field, skipping`); + if (!message) { + core.warning(`Item ${i + 1}: Missing message field, skipping`); + continue; + } + + // Validate message length (max 200 characters) + const maxLength = 200; + if (message.length > maxLength) { + core.warning(`Item ${i + 1}: Message length (${message.length} characters) exceeds maximum allowed length of ${maxLength} characters, skipping`); continue; } if (isStaged) { - let summaryContent = "## 🎭 Staged Mode: Notion Comment Preview\n\n"; - summaryContent += "The following comment would be added to Notion if staged mode was disabled:\n\n"; - summaryContent += `**Page ID:** ${pageId}\n\n`; - summaryContent += `**Comment:**\n${comment}\n\n`; + let summaryContent = "## 🎭 Staged Mode: Slack Message Preview\n\n"; + summaryContent += "The following message would be posted to Slack if staged mode was disabled:\n\n"; + summaryContent += `**Channel ID:** ${slackChannelId}\n\n`; + summaryContent += `**Message:** ${message}\n\n`; + summaryContent += `**Message Length:** ${message.length} characters\n\n`; await core.summary.addRaw(summaryContent).write(); - core.info("📝 Notion comment preview written to step summary"); + core.info("📝 Slack message preview written to step summary"); continue; } - core.info(`Adding comment ${i + 1}/${notionCommentItems.length} to Notion page: ${pageId}`); + core.info(`Posting message ${i + 1}/${slackMessageItems.length} to Slack channel: ${slackChannelId}`); + core.info(`Message length: ${message.length} characters`); try { - const response = await fetch('https://api.notion.com/v1/comments', { + const response = await fetch('https://slack.com/api/chat.postMessage', { method: 'POST', headers: { - 'Authorization': `Bearer ${notionToken}`, - 'Notion-Version': '2022-06-28', - 'Content-Type': 'application/json' + 'Content-Type': 'application/json; charset=utf-8', + 'Authorization': `Bearer ${slackBotToken}` }, body: JSON.stringify({ - parent: { - page_id: pageId - }, - rich_text: [{ - type: 'text', - text: { - content: comment - } - }] + channel: slackChannelId, + text: message }) }); + const data = await response.json(); + if (!response.ok) { - const errorData = await response.text(); - core.setFailed(`Notion API error (${response.status}): ${errorData}`); + core.setFailed(`Slack API HTTP error (${response.status}): ${response.statusText}`); return; } - const data = await response.json(); - core.info(`✅ Comment ${i + 1} added successfully`); - core.info(`Comment ID: ${data.id}`); + if (!data.ok) { + core.setFailed(`Slack API error: ${data.error || 'Unknown error'}`); + if (data.error === 'invalid_auth') { + core.error('Authentication failed. Please verify your SLACK_BOT_TOKEN is correct.'); + } else if (data.error === 'channel_not_found') { + core.error('Channel not found. Please verify the GH_AW_SLACK_CHANNEL_ID environment variable is correct and the bot has access to it.'); + } + return; + } + + core.info(`✅ Message ${i + 1} posted successfully to Slack`); + core.info(`Message timestamp: ${data.ts}`); + core.info(`Channel: ${data.channel}`); } catch (error) { - core.setFailed(`Failed to add comment ${i + 1}: ${error instanceof Error ? error.message : String(error)}`); + core.setFailed(`Failed to post message ${i + 1} to Slack: ${error instanceof Error ? error.message : String(error)}`); return; } } diff --git a/.github/workflows/notion-issue-summary.lock.yml b/.github/workflows/notion-issue-summary.lock.yml index 7f2b1e7eb87..3c2602cf4ad 100644 --- a/.github/workflows/notion-issue-summary.lock.yml +++ b/.github/workflows/notion-issue-summary.lock.yml @@ -10,10 +10,10 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] # notion_add_comment["notion_add_comment"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent # agent --> notion_add_comment diff --git a/.github/workflows/pdf-summary.lock.yml b/.github/workflows/pdf-summary.lock.yml index e3aae89b387..e876a57161d 100644 --- a/.github/workflows/pdf-summary.lock.yml +++ b/.github/workflows/pdf-summary.lock.yml @@ -10,18 +10,18 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] +# add_comment["add_comment"] # agent["agent"] # detection["detection"] -# add_comment["add_comment"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # update_reaction["update_reaction"] # pre_activation --> activation -# activation --> agent -# agent --> detection # agent --> add_comment # detection --> add_comment +# activation --> agent +# agent --> detection # agent --> missing_tool # detection --> missing_tool # agent --> update_reaction diff --git a/.github/workflows/plan.lock.yml b/.github/workflows/plan.lock.yml index b80b74cf831..f087bebafc5 100644 --- a/.github/workflows/plan.lock.yml +++ b/.github/workflows/plan.lock.yml @@ -6,17 +6,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_issue["create_issue"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_issue # detection --> create_issue +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/poem-bot.lock.yml b/.github/workflows/poem-bot.lock.yml index 90a0673ef7d..2780fc524c5 100644 --- a/.github/workflows/poem-bot.lock.yml +++ b/.github/workflows/poem-bot.lock.yml @@ -6,41 +6,39 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] +# add_comment["add_comment"] +# add_labels["add_labels"] # agent["agent"] -# detection["detection"] # create_issue["create_issue"] -# add_comment["add_comment"] # create_pr_review_comment["create_pr_review_comment"] # create_pull_request["create_pull_request"] -# add_labels["add_labels"] -# update_issue["update_issue"] -# push_to_pull_request_branch["push_to_pull_request_branch"] +# detection["detection"] # missing_tool["missing_tool"] -# upload_assets["upload_assets"] +# pre_activation["pre_activation"] +# push_to_pull_request_branch["push_to_pull_request_branch"] +# update_issue["update_issue"] # update_reaction["update_reaction"] +# upload_assets["upload_assets"] # pre_activation --> activation +# agent --> add_comment +# detection --> add_comment +# agent --> add_labels +# detection --> add_labels # activation --> agent -# agent --> detection # agent --> create_issue # detection --> create_issue -# agent --> add_comment -# detection --> add_comment # agent --> create_pr_review_comment # detection --> create_pr_review_comment # agent --> create_pull_request # detection --> create_pull_request -# agent --> add_labels -# detection --> add_labels -# agent --> update_issue -# detection --> update_issue -# agent --> push_to_pull_request_branch -# detection --> push_to_pull_request_branch +# agent --> detection # agent --> missing_tool # detection --> missing_tool -# agent --> upload_assets -# detection --> upload_assets +# agent --> push_to_pull_request_branch +# detection --> push_to_pull_request_branch +# agent --> update_issue +# detection --> update_issue # agent --> update_reaction # activation --> update_reaction # create_issue --> update_reaction @@ -52,6 +50,8 @@ # push_to_pull_request_branch --> update_reaction # missing_tool --> update_reaction # upload_assets --> update_reaction +# agent --> upload_assets +# detection --> upload_assets # ``` name: "Poem Bot - A Creative Agentic Workflow" diff --git a/.github/workflows/q.lock.yml b/.github/workflows/q.lock.yml index e496cb262e8..680baca46ab 100644 --- a/.github/workflows/q.lock.yml +++ b/.github/workflows/q.lock.yml @@ -12,21 +12,21 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] -# agent["agent"] -# detection["detection"] # add_comment["add_comment"] +# agent["agent"] # create_pull_request["create_pull_request"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # update_reaction["update_reaction"] # pre_activation --> activation -# activation --> agent -# agent --> detection # agent --> add_comment # detection --> add_comment +# activation --> agent # agent --> create_pull_request # detection --> create_pull_request +# agent --> detection # agent --> missing_tool # detection --> missing_tool # agent --> update_reaction diff --git a/.github/workflows/repo-tree-map.lock.yml b/.github/workflows/repo-tree-map.lock.yml index 8b99245ee58..092e55ae0da 100644 --- a/.github/workflows/repo-tree-map.lock.yml +++ b/.github/workflows/repo-tree-map.lock.yml @@ -6,17 +6,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_discussion["create_discussion"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_discussion # detection --> create_discussion +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/research.lock.yml b/.github/workflows/research.lock.yml index ed6dcd9024c..fb20c0dd3a0 100644 --- a/.github/workflows/research.lock.yml +++ b/.github/workflows/research.lock.yml @@ -10,17 +10,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_discussion["create_discussion"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_discussion # detection --> create_discussion +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/scout.lock.yml b/.github/workflows/scout.lock.yml index 665a5ee6ecd..649460d412e 100644 --- a/.github/workflows/scout.lock.yml +++ b/.github/workflows/scout.lock.yml @@ -15,18 +15,18 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] +# add_comment["add_comment"] # agent["agent"] # detection["detection"] -# add_comment["add_comment"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # update_reaction["update_reaction"] # pre_activation --> activation -# activation --> agent -# agent --> detection # agent --> add_comment # detection --> add_comment +# activation --> agent +# agent --> detection # agent --> missing_tool # detection --> missing_tool # agent --> update_reaction diff --git a/.github/workflows/security-fix-pr.lock.yml b/.github/workflows/security-fix-pr.lock.yml index 1604a4d1dee..1003025fd27 100644 --- a/.github/workflows/security-fix-pr.lock.yml +++ b/.github/workflows/security-fix-pr.lock.yml @@ -6,17 +6,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_pull_request["create_pull_request"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_pull_request # detection --> create_pull_request +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/smoke-claude.lock.yml b/.github/workflows/smoke-claude.lock.yml index d42a328650b..f85133750e9 100644 --- a/.github/workflows/smoke-claude.lock.yml +++ b/.github/workflows/smoke-claude.lock.yml @@ -6,17 +6,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_issue["create_issue"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_issue # detection --> create_issue +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/smoke-codex.lock.yml b/.github/workflows/smoke-codex.lock.yml index ae9b5376df5..7a13a3b4731 100644 --- a/.github/workflows/smoke-codex.lock.yml +++ b/.github/workflows/smoke-codex.lock.yml @@ -6,17 +6,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_issue["create_issue"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_issue # detection --> create_issue +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/smoke-copilot.lock.yml b/.github/workflows/smoke-copilot.lock.yml index d93ddacb49e..91dba6d4c1f 100644 --- a/.github/workflows/smoke-copilot.lock.yml +++ b/.github/workflows/smoke-copilot.lock.yml @@ -6,17 +6,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_issue["create_issue"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_issue # detection --> create_issue +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/smoke-genaiscript.lock.yml b/.github/workflows/smoke-genaiscript.lock.yml index 279dd30dac6..e0050fc5515 100644 --- a/.github/workflows/smoke-genaiscript.lock.yml +++ b/.github/workflows/smoke-genaiscript.lock.yml @@ -10,17 +10,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_issue["create_issue"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_issue # detection --> create_issue +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/smoke-opencode.lock.yml b/.github/workflows/smoke-opencode.lock.yml index 3167dc7caf8..d6bb2177e8e 100644 --- a/.github/workflows/smoke-opencode.lock.yml +++ b/.github/workflows/smoke-opencode.lock.yml @@ -10,17 +10,17 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_issue["create_issue"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_issue # detection --> create_issue +# agent --> detection # agent --> missing_tool # detection --> missing_tool # ``` diff --git a/.github/workflows/technical-doc-writer.lock.yml b/.github/workflows/technical-doc-writer.lock.yml index 058f4616382..d6671842613 100644 --- a/.github/workflows/technical-doc-writer.lock.yml +++ b/.github/workflows/technical-doc-writer.lock.yml @@ -6,32 +6,32 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] -# agent["agent"] -# detection["detection"] # add_comment["add_comment"] +# agent["agent"] # create_pull_request["create_pull_request"] +# detection["detection"] # missing_tool["missing_tool"] -# upload_assets["upload_assets"] +# pre_activation["pre_activation"] # update_reaction["update_reaction"] +# upload_assets["upload_assets"] # pre_activation --> activation -# activation --> agent -# agent --> detection # agent --> add_comment # detection --> add_comment +# activation --> agent # agent --> create_pull_request # detection --> create_pull_request +# agent --> detection # agent --> missing_tool # detection --> missing_tool -# agent --> upload_assets -# detection --> upload_assets # agent --> update_reaction # activation --> update_reaction # add_comment --> update_reaction # create_pull_request --> update_reaction # missing_tool --> update_reaction # upload_assets --> update_reaction +# agent --> upload_assets +# detection --> upload_assets # ``` name: "Technical Documentation Writer for GitHub Actions" diff --git a/.github/workflows/tidy.lock.yml b/.github/workflows/tidy.lock.yml index 629bc3ac64f..6636b715d75 100644 --- a/.github/workflows/tidy.lock.yml +++ b/.github/workflows/tidy.lock.yml @@ -6,22 +6,22 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] # agent["agent"] -# detection["detection"] # create_pull_request["create_pull_request"] -# push_to_pull_request_branch["push_to_pull_request_branch"] +# detection["detection"] # missing_tool["missing_tool"] +# pre_activation["pre_activation"] +# push_to_pull_request_branch["push_to_pull_request_branch"] # pre_activation --> activation # activation --> agent -# agent --> detection # agent --> create_pull_request # detection --> create_pull_request -# agent --> push_to_pull_request_branch -# detection --> push_to_pull_request_branch +# agent --> detection # agent --> missing_tool # detection --> missing_tool +# agent --> push_to_pull_request_branch +# detection --> push_to_pull_request_branch # ``` name: "Tidy" diff --git a/.github/workflows/unbloat-docs.lock.yml b/.github/workflows/unbloat-docs.lock.yml index b3cafe24410..858adb57231 100644 --- a/.github/workflows/unbloat-docs.lock.yml +++ b/.github/workflows/unbloat-docs.lock.yml @@ -6,32 +6,32 @@ # Job Dependency Graph: # ```mermaid # graph LR -# pre_activation["pre_activation"] # activation["activation"] -# agent["agent"] -# detection["detection"] # add_comment["add_comment"] +# agent["agent"] # create_pull_request["create_pull_request"] +# detection["detection"] # missing_tool["missing_tool"] -# upload_assets["upload_assets"] +# pre_activation["pre_activation"] # update_reaction["update_reaction"] +# upload_assets["upload_assets"] # pre_activation --> activation -# activation --> agent -# agent --> detection # agent --> add_comment # detection --> add_comment +# activation --> agent # agent --> create_pull_request # detection --> create_pull_request +# agent --> detection # agent --> missing_tool # detection --> missing_tool -# agent --> upload_assets -# detection --> upload_assets # agent --> update_reaction # activation --> update_reaction # add_comment --> update_reaction # create_pull_request --> update_reaction # missing_tool --> update_reaction # upload_assets --> update_reaction +# agent --> upload_assets +# detection --> upload_assets # ``` name: "Documentation Unbloat" diff --git a/pkg/workflow/jobs.go b/pkg/workflow/jobs.go index b7dcbae4839..051f0dd7859 100644 --- a/pkg/workflow/jobs.go +++ b/pkg/workflow/jobs.go @@ -342,8 +342,13 @@ func (jm *JobManager) GenerateMermaidGraph() string { mermaid.WriteString("```mermaid\n") mermaid.WriteString("graph LR\n") - // Add nodes for each job in the order they were added - for _, jobName := range jm.jobOrder { + // Sort job names alphabetically for stable output + sortedJobNames := make([]string, len(jm.jobOrder)) + copy(sortedJobNames, jm.jobOrder) + sort.Strings(sortedJobNames) + + // Add nodes for each job in alphabetical order + for _, jobName := range sortedJobNames { job := jm.jobs[jobName] displayName := job.DisplayName if displayName == "" { @@ -354,8 +359,8 @@ func (jm *JobManager) GenerateMermaidGraph() string { mermaid.WriteString(fmt.Sprintf(" %s[\"%s\"]\n", jobName, displayName)) } - // Add edges for dependencies - for _, jobName := range jm.jobOrder { + // Add edges for dependencies in alphabetical order of job names + for _, jobName := range sortedJobNames { job := jm.jobs[jobName] for _, dep := range job.Needs { mermaid.WriteString(fmt.Sprintf(" %s --> %s\n", dep, jobName)) diff --git a/pkg/workflow/jobs_test.go b/pkg/workflow/jobs_test.go index 68896883dbb..5c8270d4636 100644 --- a/pkg/workflow/jobs_test.go +++ b/pkg/workflow/jobs_test.go @@ -535,6 +535,23 @@ func TestJobManager_GenerateMermaidGraph(t *testing.T) { "```", }, }, + { + name: "nodes sorted alphabetically regardless of insertion order", + jobs: []*Job{ + {Name: "zebra", DisplayName: "Zebra Job", RunsOn: "ubuntu-latest"}, + {Name: "apple", DisplayName: "Apple Job", RunsOn: "ubuntu-latest"}, + {Name: "banana", DisplayName: "Banana Job", RunsOn: "ubuntu-latest", Needs: []string{"apple"}}, + }, + expected: []string{ + "```mermaid", + "graph LR", + " apple[\"Apple Job\"]", + " banana[\"Banana Job\"]", + " zebra[\"Zebra Job\"]", + " apple --> banana", + "```", + }, + }, } for _, tt := range tests {