Skip to content

Add Notion agentic workflow integration with safe-outputs and custom safe-jobs#1294

Merged
pelikhan merged 15 commits intomainfrom
copilot/add-agentic-workflow-summary
Oct 7, 2025
Merged

Add Notion agentic workflow integration with safe-outputs and custom safe-jobs#1294
pelikhan merged 15 commits intomainfrom
copilot/add-agentic-workflow-summary

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 7, 2025

  • Explore repository structure and understand safe-outputs system
  • Understand MCP server integration and safe-jobs mechanism
  • Build and test the project successfully
  • Create shared Notion workflow configuration file with MCP server setup
  • Update included file schema to allow safe-outputs.jobs
  • Add parser functions to extract safe-outputs from includes
  • Modify extractToolsFromContent to also extract MCP servers
  • Update compiler to merge safe-jobs from included configurations
  • Create test workflow demonstrating the feature
  • Run unit tests to validate changes
  • Format and recompile all workflows
  • Add comprehensive tests for new functionality
  • Address code review feedback
  • Test and validate the complete integration
  • Address PR comments: use frontmatter imports, add description field, use JavaScript
  • Refactor frontmatter.go to eliminate duplicate code
  • Add dedicated documentation page for custom safe outputs
  • Merge main, format, lint, and recompile

Summary - All Tasks Complete ✅

Merge, Format, Lint, Recompile Complete

Successfully merged main branch and performed all requested maintenance tasks:

Merge Main:

  • Fetched and merged latest changes from main branch
  • Resolved merge conflict in pkg/parser/frontmatter.go by combining:
    • MergedSafeOutputs field (from this branch)
    • MergedSteps field (from main)
    • Both fields now coexist in ImportsResult struct
  • All new workflows and features from main are included (duplicate-code-detector, go-pattern-detector, pdf-summary)

Format:

  • Ran make fmt successfully
  • Fixed indentation in pkg/workflow/safe_jobs_test.go
  • All Go code now follows standard formatting

Lint:

  • Installed prettier and golangci-lint
  • Ran make lint - all checks pass
  • JavaScript/TypeScript formatting validated
  • Go code linting completed with no issues

Recompile:

  • Ran make recompile successfully
  • All 59 workflow files compiled without errors
  • Workflow files updated with latest changes including description field support

Testing:

  • All unit tests pass (5.117s)
  • All integration tests pass
  • No regressions introduced

The branch is now up-to-date with main, fully formatted, linted, and all workflows are recompiled.

Original prompt

Add an agentic workflow that summarize an issue and adds a comment in notion about it.

  • uses the notion docker MCP server (see GitHub MCP registry) with readonly tools only!

  • defines a custom safe output "notion_add_message" type in the front matter

  • add extra jobs in the safe-output section to handle the "notion_add_comment" message using notion APIs

  • make sure the safe output MCP is able to process the new message type and pass it to the custom jobs

  • store notion workflow stuff in shared workflow file and make sure safe-outputs are imported


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits October 7, 2025 06:22
- Add notion.md shared workflow configuration file with Notion Docker MCP server (read-only tools)
- Define notion-add-comment custom safe-job for adding comments via Notion API
- Update included_file_schema.json to support safe-outputs.jobs in shared files
- Add ExpandIncludesForSafeOutputs and ProcessIncludesForSafeOutputs functions
- Modify extractToolsFromContent to extract both tools and mcp-servers as merged JSON
- Add mergeSafeJobsFromIncludedConfigs function to merge safe-jobs from includes
- Create notion-issue-summary.md example workflow demonstrating the feature

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add agentic workflow for summarizing issues in Notion Add Notion agentic workflow integration with safe-outputs and custom safe-jobs Oct 7, 2025
Copilot AI requested a review from pelikhan October 7, 2025 06:32
Comment thread .github/workflows/notion-issue-summary.md Outdated
Comment thread .github/workflows/shared/notion.md
Comment thread .github/workflows/shared/notion.md Outdated
…use JavaScript

- Change notion-issue-summary.md to use frontmatter imports instead of {{#import}}
- Add description field to safe-job configuration and schema
- Update safe-outputs MCP server to use description if provided
- Replace curl with JavaScript using actions/github-script@v8 in notion safe-job
- Add support for safe-outputs in imports (ImportsResult.MergedSafeOutputs)
- Update parseSafeJobsConfig to parse name and description fields

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan October 7, 2025 11:53
Copy link
Copy Markdown
Collaborator

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

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

@copilot review frontmatter.gi and imports.go for duplicate code and simplify if needed

- Create generic extractFrontmatterField function to replace duplicate extract* functions
- Create generic processIncludesForField to replace ProcessIncludesForEngines and ProcessIncludesForSafeOutputs
- Create generic expandIncludesForField to replace ExpandIncludesForEngines and ExpandIncludesForSafeOutputs
- Reduce code by 98 net lines while maintaining all functionality
- All tests pass and workflows compile successfully

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 7, 2025

@copilot review frontmatter.gi and imports.go for duplicate code and simplify if needed

Refactored frontmatter.go to eliminate duplicate code. Created generic functions extractFrontmatterField, processIncludesForField, and expandIncludesForField to replace duplicate implementations. Reduced code by 98 net lines while maintaining all functionality. All tests pass and workflows compile successfully. Changes in commit 3a5ef27.

Copilot AI requested a review from pelikhan October 7, 2025 12:11
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Oct 7, 2025

@copilot add dedicated documentation page to custom safe outputs

- Create docs/src/content/docs/reference/custom-safe-outputs.md
- Document architecture and best practices for third-party integrations
- Include complete Notion and Slack integration examples
- Cover security, error handling, input validation, and logging
- Add troubleshooting section for common issues
- All tests pass

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 7, 2025

@copilot add dedicated documentation page to custom safe outputs

Created dedicated documentation page for custom safe outputs at docs/src/content/docs/reference/custom-safe-outputs.md. The page includes architecture overview, step-by-step guide, complete Notion and Slack examples, best practices for security and error handling, common patterns, and troubleshooting section. Changes in commit 9f8b1e3.

@pelikhan pelikhan marked this pull request as ready for review October 7, 2025 12:30
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Oct 7, 2025

@copilot merge main, format, lint, recompile

Resolved conflicts in pkg/parser/frontmatter.go by combining:
- MergedSafeOutputs (from this branch)
- MergedSteps (from main)
Both fields are now included in ImportsResult.
- Merged main branch into copilot/add-agentic-workflow-summary
- Resolved conflicts in pkg/parser/frontmatter.go by combining MergedSafeOutputs and MergedSteps
- Ran make fmt to format code
- Ran make lint - all checks pass
- Ran make recompile - all 59 workflows compiled successfully
- Ran make test-unit - all tests pass (5.117s)
- Updated workflow files with description field support from merged changes

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 7, 2025

@copilot merge main, format, lint, recompile

Completed merge, format, lint, and recompile. Merged main successfully with conflict resolution in frontmatter.go (combined MergedSafeOutputs and MergedSteps). All formatting applied, linting passes, all 59 workflows recompiled successfully, and all tests pass. Changes in commit a02d9f7 and 7c8e5f4.

---
on:
issues:
types: [opened]
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 add workflow_dispatch with input text

Comment thread pkg/parser/frontmatter.go
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Oct 7, 2025

@copilot review changes and fix tests

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 7, 2025

@copilot review changes and fix tests

Reviewed all changes and verified tests pass. Both requested changes are already in the HEAD commit (1d1d4fc):

  1. workflow_dispatch with input text - Added to .github/workflows/notion-issue-summary.md with text input (description: "Issue text to analyze", required, type: string)

  2. Reuse frontmatter helpers - Refactored extractToolsFromContent() in pkg/parser/frontmatter.go to use a mergeField helper function, eliminating duplicate code for extracting tools and mcp-servers

All tests pass (100% success rate):

  • Unit tests: PASS (5.578s)
  • Integration tests: PASS (3.465s)
  • Linting: ✓ All validations passed
  • Workflow compilation: ✓ notion-issue-summary.md (130.2 KB)

No additional fixes needed.

@pelikhan pelikhan merged commit 21eb5c2 into main Oct 7, 2025
13 checks passed
@pelikhan pelikhan deleted the copilot/add-agentic-workflow-summary branch October 7, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants