-
Notifications
You must be signed in to change notification settings - Fork 192
Handle multiple config changes in a PR or Push event and process them as a batch #888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main-enterprise
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this 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.
params = Object.assign(context.repo(), { pull_number: pull_request.number }) | ||
|
||
const changes = await context.octokit.pulls.listFiles(params) |
There was a problem hiding this comment.
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.
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.