Skip to content

Adds branch protection and webhook count#8

Merged
pmartindev merged 4 commits into
mainfrom
amenocal/branch-protection
Oct 10, 2025
Merged

Adds branch protection and webhook count#8
pmartindev merged 4 commits into
mainfrom
amenocal/branch-protection

Conversation

@amenocal

@amenocal amenocal commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

Description

This pull request adds support for validating and exporting two new repository metrics: the count of branch protection rules and the count of webhooks. These metrics are now retrieved from both source and target repositories, compared during validation, included in the CSV export, and covered by new and expanded tests. Documentation has also been updated to reflect these additions.

Checklist

  • I have added the appropriate label to this PR according to the type of change
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests

Additional Context

Repository metrics enhancements:

  • Added BranchProtectionRules and Webhooks fields to the RepositoryData struct, and updated both the source and target repository data retrieval methods to fetch and store these new metrics. [1] [2] [3]
  • Implemented GetBranchProtectionRulesCount (GraphQL) and GetWebhookCount (REST) methods in internal/api/api.go to retrieve these metrics from GitHub.

Validation and reporting:

  • Updated the repository validation logic to compare branch protection rules and webhooks between source and target, and included these metrics in the validation results.
  • Updated the expected metrics list and all related tests to cover the new metrics, ensuring correct validation in various scenarios. [1] [2] [3] [4] [5] [6] [7] [8]

Export and documentation:

  • Modified CSV export functionality to include the new metrics in both the header and data rows. [1] [2]
  • Updated the README.md with documentation and example output for the new metrics. [1] [2]

@amenocal amenocal requested review from Copilot and pmartindev October 9, 2025 21:53
@amenocal amenocal added the patch label Oct 9, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request enhances the migration validator tool by adding support for validating two new repository metrics: branch protection rules count and webhooks count. These metrics help ensure that repository security configurations and integrations are properly migrated between source and target repositories.

Key changes include:

  • Added branch protection rules and webhooks fields to the RepositoryData struct
  • Implemented new API methods to fetch these metrics using GraphQL and REST APIs
  • Updated validation logic to compare these metrics between repositories
  • Enhanced CSV export to include the new metrics in output

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/validator/validator.go Added BranchProtectionRules and Webhooks fields to RepositoryData struct and implemented retrieval/validation logic
internal/validator/validator_test.go Updated test data to include the new metrics in all test scenarios
internal/api/api.go Implemented GetBranchProtectionRulesCount and GetWebhookCount methods for fetching metrics
internal/api/api_test.go Added comprehensive tests for the new API methods
internal/export/export.go Updated CSV export to include branch protection rules and webhooks counts
README.md Updated documentation to reflect the new metrics in output examples and feature descriptions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@amenocal amenocal requested a review from Copilot October 9, 2025 22:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@amenocal amenocal marked this pull request as ready for review October 9, 2025 22:25
@amenocal amenocal requested a review from a team as a code owner October 9, 2025 22:25

@pmartindev pmartindev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! 🚀

@pmartindev pmartindev merged commit ef58425 into main Oct 10, 2025
1 check passed
@pmartindev pmartindev deleted the amenocal/branch-protection branch October 10, 2025 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants