diff --git a/services/bots/src/github-webhook/handlers/quality_scale.ts b/services/bots/src/github-webhook/handlers/quality_scale.ts index 8ac3a5b..5bd66cd 100644 --- a/services/bots/src/github-webhook/handlers/quality_scale.ts +++ b/services/bots/src/github-webhook/handlers/quality_scale.ts @@ -1,6 +1,7 @@ import { IssuesLabeledEvent, PullRequestLabeledEvent } from '@octokit/webhooks-types'; import { EventType, HomeAssistantRepository } from '../github-webhook.const'; import { WebhookContext } from '../github-webhook.model'; +import { fetchPullRequestFilesFromContext } from '../utils/pull_request'; import { BaseWebhookHandler } from './base'; import { fetchIntegrationManifest, QualityScale } from '../utils/integration'; @@ -10,6 +11,16 @@ export class QualityScaleLabeler extends BaseWebhookHandler { public allowedRepositories = [HomeAssistantRepository.CORE]; async handle(context: WebhookContext) { + const files = await fetchPullRequestFilesFromContext(context); + const filenames = files.map((file) => { + const parts = file.filename.split('/'); + return parts[parts.length - 1]; + }); + + if (filenames.includes('quality_scale.yaml')) { + context.scheduleIssueLabel('quality-scale'); + } + if (!context.payload.label || !context.payload.label.name.startsWith('integration: ')) { return; }