Skip to content

Conversation

decyjphr
Copy link
Collaborator

@decyjphr decyjphr commented Oct 3, 2025

This pull request refactors the way repository and sub-organization settings are synchronized, improving clarity and maintainability by consolidating logic and introducing a new method for handling multiple changes at once. The changes also update how file changes are detected in pull requests, aligning with GitHub's API best practices.

@Copilot Copilot AI review requested due to automatic review settings October 3, 2025 21:05
Copy link
Contributor

@Copilot Copilot AI left a comment

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 refactors the synchronization logic for repository and sub-organization settings by consolidating duplicate code into batch processing functions. The main goal is to handle multiple configuration changes from PR or push events more efficiently by processing them as a batch rather than individually.

Key changes:

  • Introduced syncSelectedRepos method to handle batching of repository and sub-organization synchronization
  • Consolidated duplicate sync logic by creating a unified syncSelectedSettings function
  • Updated pull request file change detection to use GitHub's pull request files API instead of commit comparison

Reviewed Changes

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

File Description
lib/settings.js Added new syncSelectedRepos batch processing method and extracted checkAndProcessRepo helper
index.js Refactored sync functions to use batch processing and updated PR file detection logic

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

decyjphr and others added 2 commits October 3, 2025 17:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@decyjphr decyjphr requested a review from Copilot October 3, 2025 21:16
Copy link
Contributor

@Copilot Copilot AI left a comment

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 2 out of 2 changed files in this pull request and generated 1 comment.


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

Comment on lines +569 to +571
params = Object.assign(context.repo(), { pull_number: pull_request.number })

const changes = await context.octokit.pulls.listFiles(params)
Copy link

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

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

[nitpick] The variable params is being reused for different purposes. Consider using a more descriptive variable name like pullRequestParams to improve code clarity and avoid confusion with the previous check run parameters.

Copilot uses AI. Check for mistakes.

@decyjphr decyjphr requested a review from Copilot October 5, 2025 00:48
Copy link
Contributor

@Copilot Copilot AI left a comment

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 2 out of 2 changed files in this pull request and generated 2 comments.


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

}))
}

const subOrgChanges = getChangedSubOrgConfigName(files)
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

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

Inconsistent property naming: getChangedSubOrgConfigName returns objects with name property while getAllChangedSubOrgConfigs returns objects with repo property. This inconsistency will cause issues when both are processed by the same batch method.

Copilot uses AI. Check for mistakes.

decyjphr and others added 2 commits October 4, 2025 20:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@decyjphr decyjphr requested a review from Copilot October 5, 2025 13:12
Copy link
Contributor

@Copilot Copilot AI left a comment

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 2 out of 2 changed files in this pull request and generated 1 comment.


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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
// guarding against null value from upstream libary that is
// causing a 404 and the check to stall
// from issue: https://github.com/github/safe-settings/issues/185#issuecomment-1075240374
if (check_suite.before === '0000000000000000000000000000000000000000') {
Copy link

Choose a reason for hiding this comment

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

this seems like it would cause a regression of #185

why remove it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because we have changed the API call to a different one which does not require the before and after commits.

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.

Handle Push and Pull Request events having multiple config file changes.

2 participants