Skip to content

Add GitHub Actions workflow for Notion issue sync with manual testing#28

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/add-integration-test-issue
Draft

Add GitHub Actions workflow for Notion issue sync with manual testing#28
Copilot wants to merge 4 commits intomainfrom
copilot/add-integration-test-issue

Conversation

Copy link
Contributor

Copilot AI commented Nov 2, 2025

  • Understand user request (alternative Implement secure webhook service with Notion integration, rate limiting, and comprehensive tests #2: workflow_dispatch)
  • Create GitHub Actions workflow for Notion issue sync
  • Add workflow_dispatch trigger for manual testing
  • Add proper Notion API integration
  • Document workflow usage
  • Review and complete the workflow with improvements:
    • Added comprehensive error handling with try-catch blocks
    • Fixed assignee null reference bug
    • Enhanced state synchronization (close before sync when needed)
    • Added input validation for required secrets
    • Improved logging with more details
    • Streamlined test issue creation flow
  • Fix workflow issues:
    • Removed trailing whitespace
    • Added labels and assignee outputs when syncing existing issues via workflow_dispatch
    • Fixed labels/assignee handling for manual sync with issue_number
Original prompt

Review this and assure setup Confirmed. Secrets are set on your side. I cannot open a GitHub issue from this Zap connector due to a tool bug (repo flagged as missing on github_create_issue). Proceed with this quick test:

  1. Open a new issue in stevenschling13/Notion-Grow-Ops with title:
    Integration test: Notion sync

  2. In Notion, check database Issues (id 8f678468c26a465292a8204e5a4ba7f7) for a new page with the same title and the correct Issue Number.

  3. Close the GitHub issue. Verify the Notion State property updates to closed.

Send me the issue number. I will query the Notion database and confirm the page and state.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 2, 2025
Copilot AI changed the title [WIP] Add integration test for Notion sync with GitHub Unable to create GitHub issue due to agent limitations Nov 2, 2025
Copilot AI requested a review from stevenschling13 November 2, 2025 04:04
@stevenschling13
Copy link
Owner

@copilot 2

Co-authored-by: stevenschling13 <176538646+stevenschling13@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 2, 2025

@copilot 2

Implemented alternative #2: Added GitHub Actions workflow with workflow_dispatch trigger for manual testing.

What was added (commit 8875dce):

  1. .github/workflows/notion-issues-sync.yml - Workflow that:

    • Automatically syncs issues on open/edit/close events
    • Supports manual trigger via workflow_dispatch
    • Can create test issues or sync existing ones
    • Uses @notionhq/client to update Notion database
  2. docs/notion-sync-workflow.md - Complete documentation on usage

To test:

  1. Go to Actions → "Notion Issues Sync" → "Run workflow"
  2. Leave issue_number empty, set title to "Integration test: Notion sync"
  3. Click "Run workflow"
  4. The workflow will create the issue and sync to Notion
  5. Check workflow summary for the issue number
  6. Verify the page appears in your Notion database (ID: 8f678468c26a465292a8204e5a4ba7f7)

Required secrets: Ensure NOTION_TOKEN and NOTION_ISSUES_DB_ID are configured in repository settings.

Copilot AI changed the title Unable to create GitHub issue due to agent limitations Add GitHub Actions workflow for Notion issue sync with manual testing Nov 2, 2025
@stevenschling13
Copy link
Owner

@copilot Do this too Review and help complete the GitHub Actions workflow that would automatically sync issues to Notion when they're created/updated/closed

@stevenschling13
Copy link
Owner

@copilot fix issues

…tate sync

Co-authored-by: stevenschling13 <176538646+stevenschling13@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 2, 2025

@copilot Do this too Review and help complete the GitHub Actions workflow that would automatically sync issues to Notion when they're created/updated/closed

Reviewed and completed the workflow with key improvements (commit 3f20352):

Error Handling:

  • Added try-catch blocks with detailed error messages
  • Validates required environment variables before syncing
  • Displays Notion API error details for troubleshooting

Bug Fixes:

  • Fixed assignee null reference that would crash on unassigned issues
  • Now properly handles github.event.issue.assignee being null

State Synchronization:

  • When creating test issues with state "closed", the issue is now closed immediately after creation before syncing
  • Ensures Notion receives correct state from the start (no intermediate "open" state)

Enhanced Logging:

  • Displays labels and assignee during sync
  • More detailed console output for debugging
  • Clear success/failure messages

The workflow now automatically syncs all issue events (opened, edited, closed, reopened) to your Notion database with proper error handling and state management.

…manual sync

Co-authored-by: stevenschling13 <176538646+stevenschling13@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 2, 2025

@copilot fix issues

Fixed workflow issues (commit a993c46):

Code Quality:

  • Removed trailing whitespace from workflow file

Bug Fix:

  • Added missing labels and assignee outputs when syncing existing issues via workflow_dispatch with issue_number
  • Previously, when manually syncing an existing issue by number, labels and assignee weren't captured, causing those fields to be empty in Notion
  • Now properly captures and passes labels and assignee for all sync scenarios

The workflow now correctly handles labels and assignee for all three sync modes: automatic (issue events), manual test issue creation, and manual existing issue sync.

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