Skip to content

Add receiver-side opt-out for Copilot sync - #40

Open
woksin wants to merge 2 commits into
mainfrom
copilot/add-receive-side-sync-ignore
Open

Add receiver-side opt-out for Copilot sync#40
woksin wants to merge 2 commits into
mainfrom
copilot/add-receive-side-sync-ignore

Conversation

@woksin

@woksin woksin commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Target repositories can now selectively opt out of receiving specific Copilot artifacts during sync/propagation by creating a .github/.copilot-sync-receive-ignore file.

Previously, filtering was only possible on the source side (.copilot-sync-ignore), meaning all target repos received the same set of files with no way to decline. This is problematic for repositories with different tech stacks — a CLI tool repo has no use for EF Core instructions or React skills.

What's new

  • .github/.copilot-sync-receive-ignore — a new file that target repos can place in their repository to exclude specific incoming Copilot artifacts. Uses the same glob pattern syntax as the existing .copilot-sync-ignore (supports *, **, ?, comments with #, optional .github/ prefix).
  • Extracted shared _glob_patterns_to_regex() helper in copilot-sync-ignore-filter.sh to eliminate duplication between the source-side and receive-side filter functions.
  • Receive-side filtering runs after the source-side filter and before the up-to-date SHA check, so changes to ignored files won't trigger unnecessary commits.

Example usage

A CLI repository can create .github/.copilot-sync-receive-ignore:

# We don't need frontend or EF Core instructions
instructions/csharp-efcore.md
instructions/frontend/**
skills/react-*.md

# We maintain our own hooks
hooks/**

Filtering flow

Source files
  → .copilot-sync-ignore (source controls what it sends)
  → .copilot-sync-receive-ignore (target controls what it accepts)
  → SHA comparison → blob creation → direct push to default branch

Fully backward compatible — repos without the file continue to receive all artifacts.

Added

  • .copilot-sync-receive-ignore support: target repos can now opt out of specific incoming Copilot artifacts by placing this file in their .github/ directory.

Changed

  • Receive-side filter (_apply_copilot_sync_receive_ignore) integrated into propagate-copilot-instructions.sh using the direct-push flow introduced in main.

…ore)

Allow target repositories to selectively reject incoming Copilot artifacts
by placing a .github/.copilot-sync-receive-ignore file with glob patterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@woksin

woksin commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix merge issues

Copilot AI commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@copilot fix merge issues

Resolved. The only conflict was in .github/scripts/propagate-copilot-instructions.sh — main had switched propagation from a PR-based flow to a direct push, while the branch had added the receive-side filter (section 2b). The resolution keeps the receive-side filter and adopts main's direct-push approach, dropping the stale PR-creation logic. Merge commit: 5577f66.

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