Files
Bubberstation/tools/pull_request_hooks/autoLabelConfig.js
MrMelbert a6e33ed6ac Moves PR Labeling from webhook processor to Github actions (#89190)
## About The Pull Request

Strips auto-labeling behavior from the webhook processor to an action.
All that remains in the webhook processor is ingame PR announcements,
"changelog validation" (which is either broken or we have disabled), and
handling for "request review" (which we have disabled)

Keywords have been maintained 1:1, unless I missed something or
accidentally shoved something where it shouldn't be

I wanted to link this to the changelog parser but that seems like a
slightly larger project so I'll just throw this up as-is

Note: I'm not very experienced in writing actions so review with
scrutiny

## Why

Actions are a lot easier to maintain and set up for downstreams

Adding new labels should now be like, 10x easier since all you need to
do is slap it in the config file

Webhook processor is also kinda old an breaks semi-frequently

### (Tested)


![image](https://github.com/user-attachments/assets/7fe50ca7-3b18-4d6c-abcf-58c9195380bd)


![image](https://github.com/user-attachments/assets/c1643a27-27c6-420e-b6e5-355a450b0ab3)
2025-01-27 20:53:31 -07:00

125 lines
2.5 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'],
},
'Tools': {
filepaths: ['tools'],
},
'Config Update': {
filepaths: ['config', 'code/controllers/configuration/entries'],
add_only: true,
},
'Sprites': {
filepaths: ['icons'],
add_only: true,
},
'Sound': {
filepaths: ['sound'],
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'],
},
}