Files
Bubberstation/tools/pull_request_hooks/autoLabelConfig.js
Bloop 52107b29a0 Redoes the labeler action js backend (#92504)
## About The Pull Request

Redoes the labeler script to work for private or restricted repositories
(both of which need an auth token for using the REST api).

Previous version used `fetch()`, and checked the line diffs which was
inefficient and unnecessary. You only really need to be checking the
filenames when it comes to the diffs.

Now it uses
[octokit.rest.pulls.listFiles](https://octokit.github.io/rest.js/v20/#pulls-list-files)
and pagination. This version is faster and can support a larger amount
of diffs, up to 3000 files changed, and plays nicely with auth tokens
for private or restricted repos. Hooray! Tested the various functions of
it & things should work same as before.

<img width="591" height="171" alt="image"
src="https://github.com/user-attachments/assets/15ff75e2-0335-4b18-b6d7-3aefb312d173"
/>

Also adds support for matching file extensions, so it can find .dmm and
.dmis that might be in directories that do not start with `_maps/` or
`icons/`.

Thanks to @Kocma-san for doing a large part of this and helping figure
out what the issue was.

## Changelog

Not player-facing
2025-08-12 18:37:20 -04:00

127 lines
2.7 KiB
JavaScript

// File Labels
//
// Add a label based on if a file is modified in the diff
//
// You can optionally set add_only to make the label one-way -
// if the edit to the file is removed in a later commit,
// the label will not be removed
export const file_labels = {
GitHub: {
filepaths: [".github/"],
},
SQL: {
filepaths: ["SQL/"],
},
"Map Edit": {
filepaths: ["_maps/"],
file_extensions: [".dmm"],
},
Tools: {
filepaths: ["tools/"],
},
"Config Update": {
filepaths: ["config/", "code/controllers/configuration/entries/"],
add_only: true,
},
Sprites: {
filepaths: ["icons/"],
file_extensions: [".dmi"],
add_only: true,
},
Sound: {
filepaths: ["sound/"],
file_extensions: [".ogg"],
add_only: true,
},
UI: {
filepaths: ["tgui/"],
add_only: true,
},
};
// Title Labels
//
// Add a label based on keywords in the title
export const title_labels = {
Logging: {
keywords: ["log", "logging"],
},
Removal: {
keywords: ["remove", "delete"],
},
Refactor: {
keywords: ["refactor"],
},
"Unit Tests": {
keywords: ["unit test"],
},
"April Fools": {
keywords: ["[april fools]"],
},
"Do Not Merge": {
keywords: ["[dnm]", "[do not merge]"],
},
"GBP: No Update": {
keywords: ["[no gbp]"],
},
"Test Merge Only": {
keywords: ["[tm only]", "[test merge only]"],
},
};
// Changelog Labels
//
// Adds labels based on keywords in the changelog
// TODO use the existing changelog parser
export const changelog_labels = {
Fix: {
default_text: "fixed a few things",
keywords: ["fix", "fixes", "bugfix"],
},
"Quality of Life": {
default_text: "made something easier to use",
keywords: ["qol"],
},
Sound: {
default_text: "added/modified/removed audio or sound effects",
keywords: ["sound"],
},
Feature: {
default_text: "Added new mechanics or gameplay changes",
alt_default_text: "Added more things",
keywords: ["add", "adds", "rscadd"],
},
Removal: {
default_text: "Removed old things",
keywords: ["del", "dels", "rscdel"],
},
Sprites: {
default_text: "added/modified/removed some icons or images",
keywords: ["image"],
},
"Grammar and Formatting": {
default_text: "fixed a few typos",
keywords: ["typo", "spellcheck"],
},
Balance: {
default_text: "rebalanced something",
keywords: ["balance"],
},
"Code Improvement": {
default_text: "changed some code",
keywords: ["code_imp", "code"],
},
Refactor: {
default_text: "refactored some code",
keywords: ["refactor"],
},
"Config Update": {
default_text: "changed some config setting",
keywords: ["config"],
},
Administration: {
default_text: "messed with admin stuff",
keywords: ["admin"],
},
};