@@ -12,6 +12,14 @@ const fs = require('fs').promises;
1212const SPAM_LIST_PATH = '.github/spam-list.txt' ;
1313const dryRun = ( process . env . DRY_RUN || 'false' ) . toString ( ) . toLowerCase ( ) === 'true' ;
1414
15+ /**
16+ * These constants control the GitHub label names used by the spam automation.
17+ * To rename labels, update only the constant values here.
18+ * Ensure corresponding labels exist in the GitHub repository settings.
19+ */
20+ const LABEL_SPAM = 'notes: spam' ;
21+ const LABEL_SPAM_LIST_UPDATE = 'notes: spam-list-update' ;
22+
1523// Load current spam list and compute updates based on spam vs rehabilitated users
1624
1725async function computeSpamListUpdates ( spamUsers , rehabilitatedUsers ) {
@@ -121,7 +129,7 @@ module.exports = async ({github, context, core}) => {
121129 const searches = [
122130 {
123131 name : 'spam PRs' ,
124- query : `repo:${ owner } /${ repo } is:pr is:closed -is:merged label:spam ` ,
132+ query : `repo:${ owner } /${ repo } is:pr is:closed -is:merged label:" ${ LABEL_SPAM } " ` ,
125133 process : async ( pr ) => {
126134 if ( ! pr . user ?. login ) {
127135 console . log ( `Skipping PR #${ pr . number } : user account unavailable` ) ;
@@ -208,7 +216,7 @@ module.exports = async ({github, context, core}) => {
208216 const { data : existing } = await github . rest . issues . listForRepo ( {
209217 owner,
210218 repo,
211- labels : 'spam-list-update' ,
219+ labels : LABEL_SPAM_LIST_UPDATE ,
212220 state : 'open' ,
213221 per_page : 1
214222 } ) ;
@@ -221,7 +229,7 @@ module.exports = async ({github, context, core}) => {
221229 repo,
222230 title,
223231 body,
224- labels : [ 'spam-list-update' , 'automated' ]
232+ labels : [ LABEL_SPAM_LIST_UPDATE , 'automated' ]
225233 } ) ;
226234 console . log ( 'Issue created successfully' ) ;
227235 }
0 commit comments