mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-20 23:32:19 +02:00
cleanup lint script
This commit is contained in:
parent
f554633c7a
commit
2a3535c6aa
11
.github/scripts/pr-title.ts
vendored
11
.github/scripts/pr-title.ts
vendored
@ -1,7 +1,7 @@
|
||||
import * as core from "@actions/core";
|
||||
import * as github from "@actions/github";
|
||||
|
||||
const PREFIXES = ["ability", "balance", "bug", "docs", "feature", "item", "localize", "move", "other"] as const;
|
||||
const PREFIXES = ["ability", "balance", "bug", "docs", "feature", "item", "locale", "move", "other"] as const;
|
||||
|
||||
const LOCALES = ["es", "fr", "de", "it", "zh_CN", "zh_TW", "pt_BR", "ko"];
|
||||
|
||||
@ -29,17 +29,16 @@ async function run() {
|
||||
});
|
||||
|
||||
const title = pullRequest.title;
|
||||
// const title = "poop(asd): asdasdasd";
|
||||
core.info(`Pull Request title: "${title}"`);
|
||||
|
||||
|
||||
|
||||
const info = `
|
||||
Terminology: feat(ui): Add new feature
|
||||
Terminology: fix(ui): Fix female trainer names
|
||||
^ ^ ^
|
||||
| | |__ Subject
|
||||
| |_______ Scope
|
||||
|____________ Prefix
|
||||
|___________ Prefix
|
||||
`;
|
||||
|
||||
core.info(info.trim());
|
||||
@ -47,7 +46,7 @@ Terminology: feat(ui): Add new feature
|
||||
// Check if title pass regex
|
||||
const regex = RegExp(/^[a-zA-Z]+(\([a-zA-Z]+\))?: .+/);
|
||||
if (!regex.test(title)) {
|
||||
core.setFailed(`Pull Request title "${title}" failed to match - 'Prefix(Scrope): Subject'`);
|
||||
core.setFailed(`Pull Request title "${title}" failed to match - 'Prefix(Scope): Subject'`);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -59,7 +58,7 @@ Terminology: feat(ui): Add new feature
|
||||
}
|
||||
|
||||
// Check if title has an allowed scope
|
||||
if (title.startsWith("localize")) {
|
||||
if (title.startsWith("locale")) {
|
||||
core.info(`Allowed locale scopes: ${LOCALES}`);
|
||||
const scope = regex.exec(title);
|
||||
if (!scope || !LOCALES.includes(scope[1])) {
|
||||
|
2
.github/workflows/pr-title.yml
vendored
2
.github/workflows/pr-title.yml
vendored
@ -4,7 +4,7 @@ on:
|
||||
types: [opened, edited, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
lint-pr:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
|
Loading…
Reference in New Issue
Block a user