feat(createPackage): sort label files (#8892)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Almeida 2022-12-01 10:02:44 +00:00 committed by GitHub
parent 5e4331062b
commit f13ff5c6d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

1
.github/labeler.yml vendored
View file

@ -4,7 +4,6 @@ apps:guide:
apps:website:
- apps/website/*
- apps/website/**/*
packages:brokers:
- packages/brokers/*
- packages/brokers/**/*

8
.github/labels.yml vendored
View file

@ -20,10 +20,10 @@
color: 0075ca
- name: dependencies
color: 276bd1
- name: discussion
color: b6b1f9
- name: discord
color: '5663e9'
- name: discussion
color: b6b1f9
- name: documentation
color: 0075ca
- name: duplicate
@ -40,12 +40,12 @@
color: 4b1f8e
- name: help wanted
color: '008672'
- name: interactions
color: 80c042
- name: in progress
color: ffccd7
- name: in review
color: aed5fc
- name: interactions
color: 80c042
- name: invalid
color: e4e669
- name: need repro

View file

@ -58,12 +58,19 @@ export async function createPackage(packageName: string, packageDescription?: st
const labelsYAML = parseYAML(await readFile('labels.yml', 'utf8')) as LabelerData[];
labelsYAML.push({ name: `packages:${packageName}`, color: 'fbca04' });
labelsYAML.sort((a, b) => a.name.localeCompare(b.name));
await writeFile('labels.yml', stringifyYAML(labelsYAML));
const labelerYAML = parseYAML(await readFile('labeler.yml', 'utf8')) as Record<string, string[]>;
labelerYAML[`packages:${packageName}`] = [`packages/${packageName}/*`, `packages/${packageName}/**/*`];
await writeFile('labeler.yml', stringifyYAML(labelerYAML));
const sortedLabelerYAML: Record<string, string[]> = {};
for (const key of Object.keys(labelerYAML).sort((a, b) => a.localeCompare(b))) {
sortedLabelerYAML[key] = labelerYAML[key]!;
}
await writeFile('labeler.yml', stringifyYAML(sortedLabelerYAML));
// Move back to root
chdir('..');