Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 8, 2025

Renaming a ruleset leaves both old and new rulesets in the repository. The sync creates/updates by name but never removes orphaned rulesets.

Changes

  • New input: force-sync-rulesets (default: false) deletes rulesets not matching the synced ruleset name
  • Implementation: After create/update/unchanged operations, filters existing rulesets by name and deletes non-matches
  • Error handling: Deletion failures log warnings but don't fail the sync
  • Dry-run support: Shows which rulesets would be deleted without removing them

Usage

- uses: joshjohanning/bulk-github-repo-settings-sync-action@v1
  with:
    rulesets-file: './ci-ruleset.json'
    force-sync-rulesets: true  # Removes 'ci2' when syncing 'ci'

Before: Repository has ci and ci2 rulesets after rename
After: Repository has only ci ruleset

Testing

Added 4 test cases covering deletion, dry-run, disabled mode, and error handling.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add option to force sync rulesets (delete other rulesets that don't match)</issue_title>
<issue_description>I ran the sync with a renamed ruleset and now both rulesets exist (ci and ci2) - which some people may want.

Image

But in my case, I wanted to force sync (match only the ruleset coming in).

So a new parameter for this might be needed? </issue_description>

Comments on the Issue (you are @copilot in this section)


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

Copilot AI and others added 2 commits November 8, 2025 14:57
Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option to force sync rulesets for deletion of unmatched rulesets Add force-sync-rulesets option to delete non-matching rulesets Nov 8, 2025
Copilot AI requested a review from joshjohanning November 8, 2025 15:11
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.

Add option to force sync rulesets (delete other rulesets that don't match)

2 participants