chore(catalog): rename includeArchived to allowArchived
Signed-off-by: Benjamin Janssens <benji.janssens@gmail.com>
This commit is contained in:
@@ -168,7 +168,7 @@ If you do so, `default` will be used as provider ID.
|
||||
If configured, all repositories _except_ those with one (or more) topics(s) present in the exclusion filter will be ingested.
|
||||
- **`visibility`** _(optional)_:
|
||||
An array of strings used to filter results based on their visibility. Available options are `private`, `internal`, `public`. If configured (non empty), only repositories with visibility present in the filter will be ingested
|
||||
- **`includeArchived`** _(optional)_:
|
||||
- **`allowArchived`** _(optional)_:
|
||||
Whether to include archived repositories. Defaults to `false`.
|
||||
- **`host`** _(optional)_:
|
||||
The hostname of your GitHub Enterprise instance. It must match a host defined in [integrations.github](locations.md).
|
||||
|
||||
+2
-2
@@ -121,7 +121,7 @@ export interface Config {
|
||||
* (Optional) Whether to include archived repositories.
|
||||
* Default: `false`.
|
||||
*/
|
||||
includeArchived?: boolean;
|
||||
allowArchived?: boolean;
|
||||
};
|
||||
/**
|
||||
* (Optional) TaskScheduleDefinition for the refresh.
|
||||
@@ -195,7 +195,7 @@ export interface Config {
|
||||
* (Optional) Whether to include archived repositories.
|
||||
* Default: `false`.
|
||||
*/
|
||||
includeArchived?: boolean;
|
||||
allowArchived?: boolean;
|
||||
};
|
||||
/**
|
||||
* (Optional) TaskScheduleDefinition for the refresh.
|
||||
|
||||
@@ -260,12 +260,12 @@ export class GithubEntityProvider implements EntityProvider, EventSubscriber {
|
||||
const topicFilters = this.config.filters.topic;
|
||||
const allowForks = this.config.filters.allowForks;
|
||||
const visibilities = this.config.filters.visibility ?? [];
|
||||
const includeArchived = this.config.filters.includeArchived;
|
||||
const allowArchived = this.config.filters.allowArchived;
|
||||
|
||||
return repositories.filter(r => {
|
||||
const repoTopics: string[] = r.repositoryTopics;
|
||||
return (
|
||||
(includeArchived || !r.isArchived) &&
|
||||
(allowArchived || !r.isArchived) &&
|
||||
(!repositoryFilter || repositoryFilter.test(r.name)) &&
|
||||
satisfiesTopicFilter(repoTopics, topicFilters) &&
|
||||
satisfiesForkFilter(allowForks, r.isFork) &&
|
||||
@@ -469,7 +469,7 @@ export class GithubEntityProvider implements EntityProvider, EventSubscriber {
|
||||
* @param event - The repository archived event.
|
||||
*/
|
||||
private async onRepoArchived(event: RepositoryArchivedEvent) {
|
||||
if (this.config.filters.includeArchived) return;
|
||||
if (this.config.filters.allowArchived) return;
|
||||
|
||||
const repository = this.createRepoFromEvent(event);
|
||||
await this.removeEntitiesForRepo(repository);
|
||||
|
||||
+11
-11
@@ -95,7 +95,7 @@ describe('readProviderConfigs', () => {
|
||||
providerWithArchiveFilter: {
|
||||
organization: 'test-org6',
|
||||
filters: {
|
||||
includeArchived: true,
|
||||
allowArchived: true,
|
||||
},
|
||||
},
|
||||
providerWithHost: {
|
||||
@@ -132,7 +132,7 @@ describe('readProviderConfigs', () => {
|
||||
exclude: undefined,
|
||||
},
|
||||
visibility: undefined,
|
||||
includeArchived: false,
|
||||
allowArchived: false,
|
||||
},
|
||||
schedule: DEFAULT_GITHUB_ENTITY_PROVIDER_CONFIG_SCHEDULE,
|
||||
validateLocationsExist: false,
|
||||
@@ -151,7 +151,7 @@ describe('readProviderConfigs', () => {
|
||||
exclude: undefined,
|
||||
},
|
||||
visibility: undefined,
|
||||
includeArchived: false,
|
||||
allowArchived: false,
|
||||
},
|
||||
schedule: DEFAULT_GITHUB_ENTITY_PROVIDER_CONFIG_SCHEDULE,
|
||||
validateLocationsExist: false,
|
||||
@@ -170,7 +170,7 @@ describe('readProviderConfigs', () => {
|
||||
exclude: undefined,
|
||||
},
|
||||
visibility: undefined,
|
||||
includeArchived: false,
|
||||
allowArchived: false,
|
||||
},
|
||||
schedule: DEFAULT_GITHUB_ENTITY_PROVIDER_CONFIG_SCHEDULE,
|
||||
validateLocationsExist: false,
|
||||
@@ -189,7 +189,7 @@ describe('readProviderConfigs', () => {
|
||||
exclude: undefined,
|
||||
},
|
||||
visibility: undefined,
|
||||
includeArchived: false,
|
||||
allowArchived: false,
|
||||
},
|
||||
schedule: DEFAULT_GITHUB_ENTITY_PROVIDER_CONFIG_SCHEDULE,
|
||||
validateLocationsExist: false,
|
||||
@@ -208,7 +208,7 @@ describe('readProviderConfigs', () => {
|
||||
exclude: ['backstage-exclude'],
|
||||
},
|
||||
visibility: undefined,
|
||||
includeArchived: false,
|
||||
allowArchived: false,
|
||||
},
|
||||
schedule: DEFAULT_GITHUB_ENTITY_PROVIDER_CONFIG_SCHEDULE,
|
||||
validateLocationsExist: false,
|
||||
@@ -227,7 +227,7 @@ describe('readProviderConfigs', () => {
|
||||
exclude: undefined,
|
||||
},
|
||||
visibility: undefined,
|
||||
includeArchived: false,
|
||||
allowArchived: false,
|
||||
},
|
||||
schedule: DEFAULT_GITHUB_ENTITY_PROVIDER_CONFIG_SCHEDULE,
|
||||
validateLocationsExist: false,
|
||||
@@ -246,7 +246,7 @@ describe('readProviderConfigs', () => {
|
||||
exclude: undefined,
|
||||
},
|
||||
visibility: ['public', 'internal'],
|
||||
includeArchived: false,
|
||||
allowArchived: false,
|
||||
},
|
||||
schedule: DEFAULT_GITHUB_ENTITY_PROVIDER_CONFIG_SCHEDULE,
|
||||
validateLocationsExist: false,
|
||||
@@ -265,7 +265,7 @@ describe('readProviderConfigs', () => {
|
||||
exclude: undefined,
|
||||
},
|
||||
visibility: undefined,
|
||||
includeArchived: true,
|
||||
allowArchived: true,
|
||||
},
|
||||
schedule: DEFAULT_GITHUB_ENTITY_PROVIDER_CONFIG_SCHEDULE,
|
||||
validateLocationsExist: false,
|
||||
@@ -284,7 +284,7 @@ describe('readProviderConfigs', () => {
|
||||
exclude: undefined,
|
||||
},
|
||||
visibility: undefined,
|
||||
includeArchived: false,
|
||||
allowArchived: false,
|
||||
},
|
||||
validateLocationsExist: false,
|
||||
schedule: DEFAULT_GITHUB_ENTITY_PROVIDER_CONFIG_SCHEDULE,
|
||||
@@ -303,7 +303,7 @@ describe('readProviderConfigs', () => {
|
||||
exclude: undefined,
|
||||
},
|
||||
visibility: undefined,
|
||||
includeArchived: false,
|
||||
allowArchived: false,
|
||||
},
|
||||
schedule: {
|
||||
frequency: { minutes: 30 },
|
||||
|
||||
@@ -43,7 +43,7 @@ export type GithubEntityProviderConfig = {
|
||||
topic?: GithubTopicFilters;
|
||||
allowForks: boolean;
|
||||
visibility?: string[];
|
||||
includeArchived: boolean;
|
||||
allowArchived: boolean;
|
||||
};
|
||||
validateLocationsExist: boolean;
|
||||
schedule?: SchedulerServiceTaskScheduleDefinition;
|
||||
@@ -91,8 +91,8 @@ function readProviderConfig(
|
||||
const topicFilterExclude = config?.getOptionalStringArray(
|
||||
'filters.topic.exclude',
|
||||
);
|
||||
const includeArchived =
|
||||
config.getOptionalBoolean('filters.includeArchived') ?? false;
|
||||
const allowArchived =
|
||||
config.getOptionalBoolean('filters.allowArchived') ?? false;
|
||||
const validateLocationsExist =
|
||||
config?.getOptionalBoolean('validateLocationsExist') ?? false;
|
||||
|
||||
@@ -135,7 +135,7 @@ function readProviderConfig(
|
||||
exclude: topicFilterExclude,
|
||||
},
|
||||
visibility: visibilityFilterInclude,
|
||||
includeArchived,
|
||||
allowArchived,
|
||||
},
|
||||
schedule,
|
||||
validateLocationsExist,
|
||||
|
||||
Reference in New Issue
Block a user