mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 13:11:43 +00:00
* ci: add auto PR label workflow and script Signed-off-by: Andy Lee <andy.lee@suse.com> * fix: bug fix prefix Signed-off-by: Andy Lee <andy.lee@suse.com> * refactor: update label mapping Signed-off-by: Andy Lee <andy.lee@suse.com> * refactor: read commitlint prefix from commitlint.config.js Signed-off-by: Andy Lee <andy.lee@suse.com> * refactor: rename to scripts/extract-release-label.mjs Signed-off-by: Andy Lee <andy.lee@suse.com> --------- Signed-off-by: Andy Lee <andy.lee@suse.com>
17 lines
470 B
JavaScript
17 lines
470 B
JavaScript
/* eslint-disable no-console */
|
|
import load from "@commitlint/load";
|
|
|
|
if (process.argv.length < 3) {
|
|
console.error('No PR title as first argument');
|
|
process.exit(1);
|
|
}
|
|
|
|
const prTitle = process.argv[2];
|
|
const prLabel = prTitle.split(':')[0].trim();
|
|
|
|
const config = await load({ extends: ["./commitlint.config.js"] });
|
|
const commitPrefix = config?.rules?.['type-enum']?.[2] || [];
|
|
const label = commitPrefix.includes(prLabel) ? prLabel : 'other';
|
|
|
|
console.log(label);
|