Skip to content

Commit

Permalink
feat(createPackage): sort label files (#8892)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
almeidx and kodiakhq[bot] committed Dec 1, 2022
1 parent 5e43310 commit f13ff5c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion .github/labeler.yml
Expand Up @@ -4,7 +4,6 @@ apps:guide:
apps:website:
- apps/website/*
- apps/website/**/*

packages:brokers:
- packages/brokers/*
- packages/brokers/**/*
Expand Down
8 changes: 4 additions & 4 deletions .github/labels.yml
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion packages/scripts/src/createPackage.ts
Expand Up @@ -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('..');
Expand Down

0 comments on commit f13ff5c

Please sign in to comment.