From 5973508f803393d8f97df81f10a422c658722671 Mon Sep 17 00:00:00 2001 From: Aetherinox Date: Sat, 3 May 2025 04:13:41 -0700 Subject: [PATCH] ci: update `issues` workflow --- .github/workflows/issues-new.yml | 166 +++++++++++++++++++++++------ .github/workflows/issues-stale.yml | 154 ++++++++++++++++++++++---- 2 files changed, 268 insertions(+), 52 deletions(-) diff --git a/.github/workflows/issues-new.yml b/.github/workflows/issues-new.yml index b5c59f30..63ffe8e6 100755 --- a/.github/workflows/issues-new.yml +++ b/.github/workflows/issues-new.yml @@ -394,19 +394,45 @@ jobs: if ( iss_author === `${{ env.BOT_NAME_RENOVATE }}` ) core.info( `Skipping: Detected ${ iss_author }` ) - // Rename title to contain Bug: - // Make sure issue / pr title doesnt already contain a beginning title tag + /* + Rename title to contain Bug: + if bug title or body contains keyword hinting at the issue being about a bug; change the title of the issue + Make sure issue / pr title doesnt already contain a beginning title tag + + @ref https://jsfiddle.net/aetherinox/wj17x8mp/2/ + */ if ( iss_author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !bug_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ) ) ) { console.log( "Renaming Title" ) console.log( `Old Title: .................. ${ iss_title }` ) - const title = context.payload.issue.title - let title_new = title.replace( /^\s?bug\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?fail\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?issue\s*(.*?)\b/gi, '' ); - iss_title = `${ bug_tag } ${ title_new }`; + /* + If a user creates an issue starting with our tag; strip it and add ours with the emoji instead + original: Bug: CMD windows opens then closes, can't run the script. + new: πŸ› Bug: CMD windows opens then closes, can't run the script. + */ + + const removeBeginning1 = bug_tag.substring(3); // "Bug:" + let removeBeginning2 = bug_tag.substring(0); // "πŸ› Bug:" + removeBeginning2 = removeBeginning2.replace(/\s/g, '') // "Bug:" + + if ( iss_title.startsWith(removeBeginning1) ) // "Bug:" + { + iss_title = iss_title.slice(removeBeginning1.length); + iss_title = iss_title.trim(); + } + else if ( iss_title.startsWith(removeBeginning2) ) // "πŸ›Bug:" + { + iss_title = iss_title.slice(removeBeginning2.length); + iss_title = iss_title.trim(); + } + + const title = iss_title; + let title_new = title.replace( /^\s?bug\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?fail\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?issue\s*(.*?)\b/gi, '' ); + iss_title = `${ bug_tag } ${ title_new }`; } console.log( `New Title: ...................... ${ iss_title }` ) @@ -540,20 +566,46 @@ jobs: if ( iss_author === `${{ env.BOT_NAME_RENOVATE }}` ) core.info( `Skipping: Detected ${ iss_author }` ) - // Rename title to contain Feature: - // Make sure issue / pr title doesnt already contain a beginning title tag + /* + Rename title to contain Feature: + if feature title or body contains keyword hinting at the issue being about a feature; change the title of the issue + Make sure issue / pr title doesnt already contain a beginning title tag + + @ref https://jsfiddle.net/aetherinox/wj17x8mp/2/ + */ if ( iss_author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !feat_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ) ) ) { console.log( "Renaming Title" ) console.log( `Old Title: .................. ${ iss_title }` ) - const title = context.payload.issue.title - let title_new = title.replace( /^\s?feature\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?request\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?add(.*?)\s?feature\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?add(.*?)\s?support\s*(.*?)\b/gi, '' ); - iss_title = `${ feat_tag } ${ title_new }`; // change TAG per category + /* + If a user creates an issue starting with our tag; strip it and add ours with the emoji instead + original: Feature: CMD windows opens then closes, can't run the script. + new: πŸ’‘ Feature: CMD windows opens then closes, can't run the script. + */ + + const removeBeginning1 = feat_tag.substring(3); // "Feature:" + let removeBeginning2 = feat_tag.substring(0); // "πŸ’‘ Feature:" + removeBeginning2 = removeBeginning2.replace(/\s/g, '') // "Feature:" + + if ( iss_title.startsWith(removeBeginning1) ) // "Feature:" + { + iss_title = iss_title.slice(removeBeginning1.length); + iss_title = iss_title.trim(); + } + else if ( iss_title.startsWith(removeBeginning2) ) // "πŸ’‘ Feature:" + { + iss_title = iss_title.slice(removeBeginning2.length); + iss_title = iss_title.trim(); + } + + const title = iss_title; + let title_new = title.replace( /^\s?feature\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?request\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?add(.*?)\s?feature\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?add(.*?)\s?support\s*(.*?)\b/gi, '' ); + iss_title = `${ feat_tag } ${ title_new }`; // change TAG per category } console.log( `New Title: ...................... ${ iss_title }` ) @@ -688,19 +740,45 @@ jobs: if ( iss_author === `${{ env.BOT_NAME_RENOVATE }}` ) core.info( `Skipping: Detected ${ iss_author }` ) - // Rename title to contain Roadmap: - // Make sure issue / pr title doesnt already contain a beginning title tag + /* + Rename title to contain Roadmap: + if roadmap title or body contains keyword hinting at the issue being about roadmap; change the title of the issue + Make sure issue / pr title doesnt already contain a beginning title tag + + @ref https://jsfiddle.net/aetherinox/wj17x8mp/2/ + */ if ( iss_author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !road_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ) ) ) { console.log( "Renaming Title" ) console.log( `Old Title: .................. ${ iss_title }` ) - const title = context.payload.issue.title - let title_new = title.replace( /^\s?broad(.*?)\s?map\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?planned\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?broadmap\s*(.*?)\b/gi, '' ); - iss_title = `${ road_tag } ${ title_new }`; // change TAG per category + /* + If a user creates an issue starting with our tag; strip it and add ours with the emoji instead + original: Roadmap: CMD windows opens then closes, can't run the script. + new: πŸ—ΊοΈ Roadmap: CMD windows opens then closes, can't run the script. + */ + + const removeBeginning1 = road_tag.substring(3); // "Roadmap:" + let removeBeginning2 = road_tag.substring(0); // "πŸ—ΊοΈ Roadmap:" + removeBeginning2 = removeBeginning2.replace(/\s/g, '') // "Roadmap:" + + if ( iss_title.startsWith(removeBeginning1) ) // "Roadmap:" + { + iss_title = iss_title.slice(removeBeginning1.length); + iss_title = iss_title.trim(); + } + else if ( iss_title.startsWith(removeBeginning2) ) // "πŸ—ΊοΈ Roadmap:" + { + iss_title = iss_title.slice(removeBeginning2.length); + iss_title = iss_title.trim(); + } + + const title = iss_title; + let title_new = title.replace( /^\s?broad(.*?)\s?map\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?planned\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?broadmap\s*(.*?)\b/gi, '' ); + iss_title = `${ road_tag } ${ title_new }`; // change TAG per category } console.log( `New Title: .................... ${ iss_title }` ) @@ -840,21 +918,47 @@ jobs: if ( iss_author === `${{ env.BOT_NAME_RENOVATE }}` ) core.info( `Skipping: Detected ${ iss_author }` ) - // Rename title to contain Urgent: - // Make sure issue / pr title doesnt already contain a beginning title tag + /* + Rename title to contain Urgent: + if urgent title or body contains keyword hinting at the issue being about urgent; change the title of the issue + Make sure issue / pr title doesnt already contain a beginning title tag + + @ref https://jsfiddle.net/aetherinox/wj17x8mp/2/ + */ if ( iss_author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !urgn_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ) ) ) { console.log( "Renaming Title" ) console.log( `Old Title: .................. ${ iss_title }` ) - const title = context.payload.issue.title - let title_new = title.replace( /^\s?emergency\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?urgent\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?urgency\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?important\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?critical\s*(.*?)\b/gi, '' ); - iss_title = `${ urgn_tag } ${ title_new }`; // change TAG per category + /* + If a user creates an issue starting with our tag; strip it and add ours with the emoji instead + original: Urgent: CMD windows opens then closes, can't run the script. + new: ⚠ Urgent: CMD windows opens then closes, can't run the script. + */ + + const removeBeginning1 = urgn_tag.substring(3); // "Urgent:" + let removeBeginning2 = urgn_tag.substring(0); // "⚠ Urgent:" + removeBeginning2 = removeBeginning2.replace(/\s/g, '') // "Urgent:" + + if ( iss_title.startsWith(removeBeginning1) ) // "Urgent:" + { + iss_title = iss_title.slice(removeBeginning1.length); + iss_title = iss_title.trim(); + } + else if ( iss_title.startsWith(removeBeginning2) ) // "⚠ Urgent:" + { + iss_title = iss_title.slice(removeBeginning2.length); + iss_title = iss_title.trim(); + } + + const title = context.payload.issue.title; + let title_new = title.replace( /^\s?emergency\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?urgent\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?urgency\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?important\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?critical\s*(.*?)\b/gi, '' ); + iss_title = `${ urgn_tag } ${ title_new }`; } console.log( `New Title: ...................... ${ iss_title }` ) diff --git a/.github/workflows/issues-stale.yml b/.github/workflows/issues-stale.yml index e65e30d2..4f4d92cb 100755 --- a/.github/workflows/issues-stale.yml +++ b/.github/workflows/issues-stale.yml @@ -272,9 +272,8 @@ jobs: job-issues-nolabel: name: >- 🎫 Labels β€Ί Assign Missing - # runs-on: ubuntu-latest - runs-on: apollo-x64 - timeout-minutes: 5 + runs-on: ubuntu-latest + timeout-minutes: 4 needs: job-labels-create steps: @@ -434,16 +433,46 @@ jobs: if ( author === `${{ env.BOT_NAME_RENOVATE }}` ) core.info( `Skipping: Detected ${ author }` ) - // Rename title to contain Bug: + /* + Rename title to contain Bug: + if bug title or body contains keyword hinting at the issue being about a bug; change the title of the issue + + @ref https://jsfiddle.net/aetherinox/wj17x8mp/2/ + */ + if ( author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !bug_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ) ) ) { - const title = issue.title; + + /* + If a user creates an issue starting with our tag; strip it and add ours with the emoji instead + original: Bug: CMD windows opens then closes, can't run the script. + new: πŸ› Bug: CMD windows opens then closes, can't run the script. + */ + + const removeBeginning1 = bug_tag.substring(3); // "Bug:" + let removeBeginning2 = bug_tag.substring(0); // "πŸ› Bug:" + removeBeginning2 = removeBeginning2.replace(/\s/g, '') // "Bug:" + + if ( iss_title.startsWith(removeBeginning1) ) + { + iss_title = iss_title.slice(removeBeginning1.length); + iss_title = iss_title.trim(); + } + else if ( iss_title.startsWith(removeBeginning2) ) + { + iss_title = iss_title.slice(removeBeginning2.length); + iss_title = iss_title.trim(); + } + + const title = iss_title; let title_new = title.replace( /^\s?bug\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?fail\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?issue\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?fail\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?issue\s*(.*?)\b/gi, '' ); iss_title = `${ bug_tag } ${ title_new }`; } + console.log( `New Title: ...................... ${ iss_title }` ) + await github.rest.issues.update( { owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, @@ -464,7 +493,7 @@ jobs: https://regex101.com/r/fR1Hm6/1 */ - const feat_findWordList = /(?:(?:add|enjoy|would|like|can|request|include|see|could|have)\s*?(?:the|liked?|i|we|an?|the|you?)\s*?(?:to|have|an|get|ability|request|add|feature|functionality|addon|addition|plugin|create))|(?:(?:add|see|get)\s*?support\s*?(?:for|with|of))|(?:can\s*we\s*get\s*?(?:the|a)\s*?(?:ability|feature))|(?:πŸ’‘ Feature:)$/igm; + const feat_findWordList = /(?:(?:add|enjoy|would|like|can|request|include|see|could|have)\s*?(?:the|liked?|i|we|an?|the|you?)\s*?(?:to|have|an|get|ability|request|add|feature|functionality|addon|addition|plugin|create))|(?:(?:add|see|get)\s*?support\s*?(?:for|with|of))|(?:can\s*we\s*get\s*?(?:the|a)\s*?(?:ability|feature))|(?:πŸ’‘ Feature:)$/igm; const feat_bFoundMatchTitle = Boolean( feat_findWordList.test( iss_title ) ); const feat_bFoundMatchBody = Boolean( feat_findWordList.test( iss_body ) ); @@ -494,15 +523,42 @@ jobs: if ( author === `${{ env.BOT_NAME_RENOVATE }}` ) core.info( `Skipping: Detected ${ author }` ) - // Rename title to contain Feature: + /* + Rename title to contain Feature: + if feature title or body contains keyword hinting at the issue being about a feature; change the title of the issue + + @ref https://jsfiddle.net/aetherinox/wj17x8mp/2/ + */ if ( author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !feat_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ) ) ) { - const title = issue.title; + + /* + If a user creates an issue starting with our tag; strip it and add ours with the emoji instead + original: Feature: CMD windows opens then closes, can't run the script. + new: πŸ’‘ Feature: CMD windows opens then closes, can't run the script. + */ + + const removeBeginning1 = feat_tag.substring(3); // "Feature:" + let removeBeginning2 = feat_tag.substring(0); // "πŸ’‘ Feature:" + removeBeginning2 = removeBeginning2.replace(/\s/g, '') // "Feature:" + + if ( iss_title.startsWith(removeBeginning1) ) + { + iss_title = iss_title.slice(removeBeginning1.length); + iss_title = iss_title.trim(); + } + else if ( iss_title.startsWith(removeBeginning2) ) + { + iss_title = iss_title.slice(removeBeginning2.length); + iss_title = iss_title.trim(); + } + + const title = iss_title; let title_new = title.replace( /^\s?feature\s*(.*?)\b/gi, '' ); title_new = title.replace( /^\s?request\s*(.*?)\b/gi, '' ); title_new = title.replace( /^\s?add(.*?)\s?feature\s*(.*?)\b/gi, '' ); title_new = title.replace( /^\s?add(.*?)\s?support\s*(.*?)\b/gi, '' ); - iss_title = `${ feat_tag } ${ title_new }`; + iss_title = `${ feat_tag } ${ title_new }`; // change TAG per category } console.log( `New Title: ...................... ${ iss_title }` ) @@ -557,10 +613,37 @@ jobs: if ( author === `${{ env.BOT_NAME_RENOVATE }}` ) core.info( `Skipping: Detected ${ author }` ) - // Rename title to contain Urgent: + /* + Rename title to contain Urgent: + if urgent title or body contains keyword hinting at the issue being about urgent; change the title of the issue + + @ref https://jsfiddle.net/aetherinox/wj17x8mp/2/ + */ if ( author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !urgn_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ) ) ) { - const title = issue.title; + + /* + If a user creates an issue starting with our tag; strip it and add ours with the emoji instead + original: Urgent: CMD windows opens then closes, can't run the script. + new: ⚠ Urgent: CMD windows opens then closes, can't run the script. + */ + + const removeBeginning1 = urgn_tag.substring(3); // "Urgent:" + let removeBeginning2 = urgn_tag.substring(0); // "⚠ Urgent:" + removeBeginning2 = removeBeginning2.replace(/\s/g, '') // "Urgent:" + + if ( iss_title.startsWith(removeBeginning1) ) + { + iss_title = iss_title.slice(removeBeginning1.length); + iss_title = iss_title.trim(); + } + else if ( iss_title.startsWith(removeBeginning2) ) + { + iss_title = iss_title.slice(removeBeginning2.length); + iss_title = iss_title.trim(); + } + + const title = iss_title; let title_new = title.replace( /^\s?emergency\s*(.*?)\b/gi, '' ); title_new = title.replace( /^\s?urgent\s*(.*?)\b/gi, '' ); title_new = title.replace( /^\s?urgency\s*(.*?)\b/gi, '' ); @@ -569,6 +652,8 @@ jobs: iss_title = `${ urgn_tag } ${ title_new }`; } + console.log( `New Title: ...................... ${ iss_title }` ) + await github.rest.issues.update( { owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, @@ -620,18 +705,45 @@ jobs: if ( author === `${{ env.BOT_NAME_RENOVATE }}` ) core.info( `Skipping: Detected ${ author }` ) - // Rename title to contain Roadmap: + /* + Rename title to contain Roadmap: + if roadmap title or body contains keyword hinting at the issue being about roadmap; change the title of the issue + + @ref https://jsfiddle.net/aetherinox/wj17x8mp/2/ + */ if ( author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !road_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ) ) ) { - const title = issue.title; - let title_new = title.replace( /^\s?emergency\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?urgent\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?urgency\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?important\s*(.*?)\b/gi, '' ); - title_new = title.replace( /^\s?critical\s*(.*?)\b/gi, '' ); - iss_title = `${ road_tag } ${ title_new }`; + + /* + If a user creates an issue starting with our tag; strip it and add ours with the emoji instead + original: Roadmap: CMD windows opens then closes, can't run the script. + new: πŸ—ΊοΈ Roadmap: CMD windows opens then closes, can't run the script. + */ + + const removeBeginning1 = road_tag.substring(3); // "Roadmap:" + let removeBeginning2 = road_tag.substring(0); // "πŸ—ΊοΈ Roadmap:" + removeBeginning2 = removeBeginning2.replace(/\s/g, '') // "Roadmap:" + + if ( iss_title.startsWith(removeBeginning1) ) + { + iss_title = iss_title.slice(removeBeginning1.length); + iss_title = iss_title.trim(); + } + else if ( iss_title.startsWith(removeBeginning2) ) + { + iss_title = iss_title.slice(removeBeginning2.length); + iss_title = iss_title.trim(); + } + + const title = iss_title; + let title_new = title.replace( /^\s?broad(.*?)\s?map\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?planned\s*(.*?)\b/gi, '' ); + title_new = title.replace( /^\s?broadmap\s*(.*?)\b/gi, '' ); + iss_title = `${ road_tag } ${ title_new }`; // change TAG per category } + console.log( `New Title: ...................... ${ iss_title }` ) + await github.rest.issues.update( { owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number,