Skip to content
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

feat: add enabled flag to sync-repo-settings #4626

Merged
merged 3 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/sync-repo-settings/src/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"description": "Whether or not the sync-repo-settings bot is enabled.",
"type": "boolean"
},
"squashMergeAllowed": {
"description": "Whether or not squash-merging is enabled on this repository.",
"type": "boolean"
Expand Down
5 changes: 5 additions & 0 deletions packages/sync-repo-settings/src/sync-repo-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function deepFreeze(object: any) {
const languageConfig: LanguageConfig = deepFreeze(checks);

const repoConfigDefaults: RepoConfig = deepFreeze({
enabled: true,
mergeCommitAllowed: false,
squashMergeAllowed: true,
rebaseMergeAllowed: true,
Expand Down Expand Up @@ -82,6 +83,10 @@ export class SyncRepoSettings {
const logger = this.logger;
const repo = options.repo;
const [owner, name] = repo.split('/');
if (config?.enabled === false) {
logger.info(`config is not enabled for repository ${repo}`);
return;
}
if (!config) {
logger.info(`no local config found for ${repo}, checking global config`);
// Fetch the list of languages used in this repository
Expand Down
4 changes: 4 additions & 0 deletions packages/sync-repo-settings/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
// limitations under the License.

export interface RepoConfig {
/**
* Whether or not the sync-repo-settings bot is enabled.
*/
enabled?: boolean;
/**
* Whether or not squash-merging is enabled on this repository.
*/
Expand Down