mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-22 08:12:20 +02:00
cleanup lint script
This commit is contained in:
parent
f554633c7a
commit
2a3535c6aa
17
.github/scripts/pr-title.ts
vendored
17
.github/scripts/pr-title.ts
vendored
@ -1,7 +1,7 @@
|
|||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import * as github from "@actions/github";
|
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"];
|
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 = pullRequest.title;
|
||||||
// const title = "poop(asd): asdasdasd";
|
|
||||||
core.info(`Pull Request title: "${title}"`);
|
core.info(`Pull Request title: "${title}"`);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const info = `
|
const info = `
|
||||||
Terminology: feat(ui): Add new feature
|
Terminology: fix(ui): Fix female trainer names
|
||||||
^ ^ ^
|
^ ^ ^
|
||||||
| | |__ Subject
|
| | |__ Subject
|
||||||
| |_______ Scope
|
| |_______ Scope
|
||||||
|____________ Prefix
|
|___________ Prefix
|
||||||
`;
|
`;
|
||||||
|
|
||||||
core.info(info.trim());
|
core.info(info.trim());
|
||||||
@ -47,7 +46,7 @@ Terminology: feat(ui): Add new feature
|
|||||||
// Check if title pass regex
|
// Check if title pass regex
|
||||||
const regex = RegExp(/^[a-zA-Z]+(\([a-zA-Z]+\))?: .+/);
|
const regex = RegExp(/^[a-zA-Z]+(\([a-zA-Z]+\))?: .+/);
|
||||||
if (!regex.test(title)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +58,7 @@ Terminology: feat(ui): Add new feature
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if title has an allowed scope
|
// Check if title has an allowed scope
|
||||||
if (title.startsWith("localize")) {
|
if (title.startsWith("locale")) {
|
||||||
core.info(`Allowed locale scopes: ${LOCALES}`);
|
core.info(`Allowed locale scopes: ${LOCALES}`);
|
||||||
const scope = regex.exec(title);
|
const scope = regex.exec(title);
|
||||||
if (!scope || !LOCALES.includes(scope[1])) {
|
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]
|
types: [opened, edited, synchronize, reopened]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint-pr:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
|
Loading…
Reference in New Issue
Block a user