diff --git a/.github/workflows/pdf-summary.lock.yml b/.github/workflows/pdf-summary.lock.yml index be18377ea9e..afbea29ef02 100644 --- a/.github/workflows/pdf-summary.lock.yml +++ b/.github/workflows/pdf-summary.lock.yml @@ -19,7 +19,7 @@ # gh aw compile # For more information: https://github.com/githubnext/gh-aw/blob/main/.github/aw/github-agentic-workflows.md # -# Summarizes PDF and other documents by analyzing URLs provided via /summarize command or workflow dispatch +# pdf summarizer # # Resolved workflow manifest: # Imports: @@ -124,6 +124,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + discussions: read issues: read pull-requests: read env: @@ -232,10 +233,36 @@ jobs: mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs cat > /opt/gh-aw/safeoutputs/config.json << 'EOF' - {"add_comment":{"max":1},"missing_data":{},"missing_tool":{},"noop":{"max":1}} + {"add_comment":{"max":1},"create_discussion":{"max":1},"missing_data":{},"missing_tool":{},"noop":{"max":1}} EOF cat > /opt/gh-aw/safeoutputs/tools.json << 'EOF' [ + { + "description": "Create a GitHub discussion for announcements, Q\u0026A, reports, status updates, or community conversations. Use this for content that benefits from threaded replies, doesn't require task tracking, or serves as documentation. For actionable work items that need assignment and status tracking, use create_issue instead. CONSTRAINTS: Maximum 1 discussion(s) can be created.", + "inputSchema": { + "additionalProperties": false, + "properties": { + "body": { + "description": "Discussion content in Markdown. Do NOT repeat the title as a heading since it already appears as the discussion's h1. Include all relevant context, findings, or questions.", + "type": "string" + }, + "category": { + "description": "Discussion category by name (e.g., 'General'), slug (e.g., 'general'), or ID. If omitted, uses the first available category. Category must exist in the repository.", + "type": "string" + }, + "title": { + "description": "Concise discussion title summarizing the topic. The title appears as the main heading, so keep it brief and descriptive.", + "type": "string" + } + }, + "required": [ + "title", + "body" + ], + "type": "object" + }, + "name": "create_discussion" + }, { "description": "Add a comment to an existing GitHub issue, pull request, or discussion. Use this to provide feedback, answer questions, or add information to an existing conversation. For creating new items, use create_issue, create_discussion, or create_pull_request instead. CONSTRAINTS: Maximum 1 comment(s) can be added.", "inputSchema": { @@ -344,6 +371,32 @@ jobs: } } }, + "create_discussion": { + "defaultMax": 1, + "fields": { + "body": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "category": { + "type": "string", + "sanitize": true, + "maxLength": 128 + }, + "repo": { + "type": "string", + "maxLength": 256 + }, + "title": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 128 + } + } + }, "missing_tool": { "defaultMax": 20, "fields": { @@ -573,7 +626,7 @@ jobs: To create or modify GitHub resources (issues, discussions, pull requests, etc.), you MUST call the appropriate safe output tool. Simply writing content will NOT work - the workflow requires actual tool calls. - **Available tools**: add_comment, missing_tool, noop + **Available tools**: add_comment, create_discussion, missing_tool, noop **Critical**: Tool calls write structured data that downstream jobs process. Without tool calls, follow-up actions will be skipped. @@ -688,6 +741,10 @@ jobs: - Post your analysis as a comment on the triggering issue/PR - Format the response clearly with headers and bullet points - Include references to the analyzed URLs + - Create a discussion in the repository with the result of the summarization using safe-outputs: + - Create a discussion with the title format: "Summary: [Brief description of resource]" + - Include the full analysis as the discussion body + - The discussion will be automatically created through the safe-outputs system ## Response Format @@ -1128,7 +1185,7 @@ jobs: uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: WORKFLOW_NAME: "Resource Summarizer Agent" - WORKFLOW_DESCRIPTION: "Summarizes PDF and other documents by analyzing URLs provided via /summarize command or workflow dispatch" + WORKFLOW_DESCRIPTION: "pdf summarizer" HAS_PATCH: ${{ needs.agent.outputs.has_patch }} with: script: | @@ -1356,7 +1413,7 @@ jobs: uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }} - GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":1},\"missing_data\":{},\"missing_tool\":{}}" + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":1},\"create_discussion\":{\"expires\":168,\"max\":1},\"missing_data\":{},\"missing_tool\":{}}" with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/pdf-summary.md b/.github/workflows/pdf-summary.md index 0b52604a6c2..b1d8cb8b7c1 100644 --- a/.github/workflows/pdf-summary.md +++ b/.github/workflows/pdf-summary.md @@ -1,5 +1,5 @@ --- -description: Summarizes PDF and other documents by analyzing URLs provided via /summarize command or workflow dispatch +description: pdf summarizer on: # Command trigger - responds to /summarize mentions slash_command: @@ -23,6 +23,7 @@ permissions: contents: read issues: read pull-requests: read + discussions: read engine: copilot @@ -35,6 +36,8 @@ tools: safe-outputs: add-comment: max: 1 + create-discussion: + max: 1 messages: footer: "> 📄 *Summary compiled by [{workflow_name}]({run_url})*" run-started: "📖 Page by page! [{workflow_name}]({run_url}) is reading through this {event_type}..." @@ -117,6 +120,10 @@ For each identified URL: - Post your analysis as a comment on the triggering issue/PR - Format the response clearly with headers and bullet points - Include references to the analyzed URLs +- Create a discussion in the repository with the result of the summarization using safe-outputs: + - Create a discussion with the title format: "Summary: [Brief description of resource]" + - Include the full analysis as the discussion body + - The discussion will be automatically created through the safe-outputs system ## Response Format