harvester-ui-extension/scripts/extract-release-label.mjs
Andy Lee 65f4405d29
ci: add PR label workflow (backport multiple PRs) (#485)
* ci: add PR title lint (#458)

Signed-off-by: Andy Lee <andy.lee@suse.com>

* ci: only run PR lint in PR stage (#471)

Signed-off-by: Andy Lee <andy.lee@suse.com>

* ci: auto add  PR label workflow and script (#466)

* 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>

* ci: add .github/release.yml (#468)

* ci: add release.yml

Signed-off-by: Andy Lee <andy.lee@suse.com>

* refactor: update release.yml

Signed-off-by: Andy Lee <andy.lee@suse.com>

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>

* ci: correct set PR label script name (#476)

* fix: set label script name

Signed-off-by: Andy Lee <andy.lee@suse.com>

* ci: rerun PR label after PR edited

Signed-off-by: Andy Lee <andy.lee@suse.com>

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>

* ci: setup env using actions/setup (#478)

* ci: setup env using actions/setup

Signed-off-by: Andy Lee <andy.lee@suse.com>

* ci: rerun lint if PR force push

Signed-off-by: Andy Lee <andy.lee@suse.com>

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>
2025-08-27 16:20:07 +08:00

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);