Skip to content

Commit bad9cab

Browse files
committed
ci: update issues workflows
1 parent 8371d81 commit bad9cab

File tree

2 files changed

+266
-49
lines changed

2 files changed

+266
-49
lines changed

.github/workflows/issues-new.yml

Lines changed: 135 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -394,19 +394,45 @@ jobs:
394394
if ( iss_author === `${{ env.BOT_NAME_RENOVATE }}` )
395395
core.info( `Skipping: Detected ${ iss_author }` )
396396
397-
// Rename title to contain Bug:
398-
// Make sure issue / pr title doesnt already contain a beginning title tag
397+
/*
398+
Rename title to contain Bug:
399+
if bug title or body contains keyword hinting at the issue being about a bug; change the title of the issue
400+
Make sure issue / pr title doesnt already contain a beginning title tag
401+
402+
@ref https://jsfiddle.net/aetherinox/wj17x8mp/2/
403+
*/
399404
400405
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( ) ) )
401406
{
402407
console.log( "Renaming Title" )
403408
console.log( `Old Title: .................. ${ iss_title }` )
404409
405-
const title = context.payload.issue.title
406-
let title_new = title.replace( /^\s?bug\s*(.*?)\b/gi, '' );
407-
title_new = title.replace( /^\s?fail\s*(.*?)\b/gi, '' );
408-
title_new = title.replace( /^\s?issue\s*(.*?)\b/gi, '' );
409-
iss_title = `${ bug_tag } ${ title_new }`;
410+
/*
411+
If a user creates an issue starting with our tag; strip it and add ours with the emoji instead
412+
original: Bug: CMD windows opens then closes, can't run the script.
413+
new: 🐛 Bug: CMD windows opens then closes, can't run the script.
414+
*/
415+
416+
const removeBeginning1 = bug_tag.substring(3); // "Bug:"
417+
let removeBeginning2 = bug_tag.substring(0); // "🐛 Bug:"
418+
removeBeginning2 = removeBeginning2.replace(/\s/g, '') // "Bug:"
419+
420+
if ( iss_title.startsWith(removeBeginning1) ) // "Bug:"
421+
{
422+
iss_title = iss_title.slice(removeBeginning1.length);
423+
iss_title = iss_title.trim();
424+
}
425+
else if ( iss_title.startsWith(removeBeginning2) ) // "🐛Bug:"
426+
{
427+
iss_title = iss_title.slice(removeBeginning2.length);
428+
iss_title = iss_title.trim();
429+
}
430+
431+
const title = iss_title;
432+
let title_new = title.replace( /^\s?bug\s*(.*?)\b/gi, '' );
433+
title_new = title.replace( /^\s?fail\s*(.*?)\b/gi, '' );
434+
title_new = title.replace( /^\s?issue\s*(.*?)\b/gi, '' );
435+
iss_title = `${ bug_tag } ${ title_new }`;
410436
}
411437

412438
console.log( `New Title: ...................... ${ iss_title }` )
@@ -540,20 +566,46 @@ jobs:
540566
if ( iss_author === `${{ env.BOT_NAME_RENOVATE }}` )
541567
core.info( `Skipping: Detected ${ iss_author }` )
542568
543-
// Rename title to contain Feature:
544-
// Make sure issue / pr title doesnt already contain a beginning title tag
569+
/*
570+
Rename title to contain Feature:
571+
if feature title or body contains keyword hinting at the issue being about a feature; change the title of the issue
572+
Make sure issue / pr title doesnt already contain a beginning title tag
573+
574+
@ref https://jsfiddle.net/aetherinox/wj17x8mp/2/
575+
*/
545576
546577
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( ) ) )
547578
{
548579
console.log( "Renaming Title" )
549580
console.log( `Old Title: .................. ${ iss_title }` )
550581
551-
const title = context.payload.issue.title
552-
let title_new = title.replace( /^\s?feature\s*(.*?)\b/gi, '' );
553-
title_new = title.replace( /^\s?request\s*(.*?)\b/gi, '' );
554-
title_new = title.replace( /^\s?add(.*?)\s?feature\s*(.*?)\b/gi, '' );
555-
title_new = title.replace( /^\s?add(.*?)\s?support\s*(.*?)\b/gi, '' );
556-
iss_title = `${ feat_tag } ${ title_new }`; // change TAG per category
582+
/*
583+
If a user creates an issue starting with our tag; strip it and add ours with the emoji instead
584+
original: Feature: CMD windows opens then closes, can't run the script.
585+
new: 💡 Feature: CMD windows opens then closes, can't run the script.
586+
*/
587+
588+
const removeBeginning1 = feat_tag.substring(3); // "Feature:"
589+
let removeBeginning2 = feat_tag.substring(0); // "💡 Feature:"
590+
removeBeginning2 = removeBeginning2.replace(/\s/g, '') // "Feature:"
591+
592+
if ( iss_title.startsWith(removeBeginning1) ) // "Feature:"
593+
{
594+
iss_title = iss_title.slice(removeBeginning1.length);
595+
iss_title = iss_title.trim();
596+
}
597+
else if ( iss_title.startsWith(removeBeginning2) ) // "💡 Feature:"
598+
{
599+
iss_title = iss_title.slice(removeBeginning2.length);
600+
iss_title = iss_title.trim();
601+
}
602+
603+
const title = iss_title;
604+
let title_new = title.replace( /^\s?feature\s*(.*?)\b/gi, '' );
605+
title_new = title.replace( /^\s?request\s*(.*?)\b/gi, '' );
606+
title_new = title.replace( /^\s?add(.*?)\s?feature\s*(.*?)\b/gi, '' );
607+
title_new = title.replace( /^\s?add(.*?)\s?support\s*(.*?)\b/gi, '' );
608+
iss_title = `${ feat_tag } ${ title_new }`; // change TAG per category
557609
}
558610
559611
console.log( `New Title: ...................... ${ iss_title }` )
@@ -688,19 +740,45 @@ jobs:
688740
if ( iss_author === `${{ env.BOT_NAME_RENOVATE }}` )
689741
core.info( `Skipping: Detected ${ iss_author }` )
690742
691-
// Rename title to contain Roadmap:
692-
// Make sure issue / pr title doesnt already contain a beginning title tag
743+
/*
744+
Rename title to contain Roadmap:
745+
if roadmap title or body contains keyword hinting at the issue being about roadmap; change the title of the issue
746+
Make sure issue / pr title doesnt already contain a beginning title tag
747+
748+
@ref https://jsfiddle.net/aetherinox/wj17x8mp/2/
749+
*/
693750
694751
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( ) ) )
695752
{
696753
console.log( "Renaming Title" )
697754
console.log( `Old Title: .................. ${ iss_title }` )
698755
699-
const title = context.payload.issue.title
700-
let title_new = title.replace( /^\s?broad(.*?)\s?map\s*(.*?)\b/gi, '' );
701-
title_new = title.replace( /^\s?planned\s*(.*?)\b/gi, '' );
702-
title_new = title.replace( /^\s?broadmap\s*(.*?)\b/gi, '' );
703-
iss_title = `${ road_tag } ${ title_new }`; // change TAG per category
756+
/*
757+
If a user creates an issue starting with our tag; strip it and add ours with the emoji instead
758+
original: Roadmap: CMD windows opens then closes, can't run the script.
759+
new: 🗺️ Roadmap: CMD windows opens then closes, can't run the script.
760+
*/
761+
762+
const removeBeginning1 = road_tag.substring(3); // "Roadmap:"
763+
let removeBeginning2 = road_tag.substring(0); // "🗺️ Roadmap:"
764+
removeBeginning2 = removeBeginning2.replace(/\s/g, '') // "Roadmap:"
765+
766+
if ( iss_title.startsWith(removeBeginning1) ) // "Roadmap:"
767+
{
768+
iss_title = iss_title.slice(removeBeginning1.length);
769+
iss_title = iss_title.trim();
770+
}
771+
else if ( iss_title.startsWith(removeBeginning2) ) // "🗺️ Roadmap:"
772+
{
773+
iss_title = iss_title.slice(removeBeginning2.length);
774+
iss_title = iss_title.trim();
775+
}
776+
777+
const title = iss_title;
778+
let title_new = title.replace( /^\s?broad(.*?)\s?map\s*(.*?)\b/gi, '' );
779+
title_new = title.replace( /^\s?planned\s*(.*?)\b/gi, '' );
780+
title_new = title.replace( /^\s?broadmap\s*(.*?)\b/gi, '' );
781+
iss_title = `${ road_tag } ${ title_new }`; // change TAG per category
704782
}
705783
706784
console.log( `New Title: .................... ${ iss_title }` )
@@ -840,21 +918,47 @@ jobs:
840918
if ( iss_author === `${{ env.BOT_NAME_RENOVATE }}` )
841919
core.info( `Skipping: Detected ${ iss_author }` )
842920
843-
// Rename title to contain Urgent:
844-
// Make sure issue / pr title doesnt already contain a beginning title tag
921+
/*
922+
Rename title to contain Urgent:
923+
if urgent title or body contains keyword hinting at the issue being about urgent; change the title of the issue
924+
Make sure issue / pr title doesnt already contain a beginning title tag
925+
926+
@ref https://jsfiddle.net/aetherinox/wj17x8mp/2/
927+
*/
845928
846929
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( ) ) )
847930
{
848931
console.log( "Renaming Title" )
849932
console.log( `Old Title: .................. ${ iss_title }` )
850933
851-
const title = context.payload.issue.title
852-
let title_new = title.replace( /^\s?emergency\s*(.*?)\b/gi, '' );
853-
title_new = title.replace( /^\s?urgent\s*(.*?)\b/gi, '' );
854-
title_new = title.replace( /^\s?urgency\s*(.*?)\b/gi, '' );
855-
title_new = title.replace( /^\s?important\s*(.*?)\b/gi, '' );
856-
title_new = title.replace( /^\s?critical\s*(.*?)\b/gi, '' );
857-
iss_title = `${ urgn_tag } ${ title_new }`; // change TAG per category
934+
/*
935+
If a user creates an issue starting with our tag; strip it and add ours with the emoji instead
936+
original: Urgent: CMD windows opens then closes, can't run the script.
937+
new: ⚠ Urgent: CMD windows opens then closes, can't run the script.
938+
*/
939+
940+
const removeBeginning1 = urgn_tag.substring(3); // "Urgent:"
941+
let removeBeginning2 = urgn_tag.substring(0); // "⚠ Urgent:"
942+
removeBeginning2 = removeBeginning2.replace(/\s/g, '') // "Urgent:"
943+
944+
if ( iss_title.startsWith(removeBeginning1) ) // "Urgent:"
945+
{
946+
iss_title = iss_title.slice(removeBeginning1.length);
947+
iss_title = iss_title.trim();
948+
}
949+
else if ( iss_title.startsWith(removeBeginning2) ) // "⚠ Urgent:"
950+
{
951+
iss_title = iss_title.slice(removeBeginning2.length);
952+
iss_title = iss_title.trim();
953+
}
954+
955+
const title = context.payload.issue.title;
956+
let title_new = title.replace( /^\s?emergency\s*(.*?)\b/gi, '' );
957+
title_new = title.replace( /^\s?urgent\s*(.*?)\b/gi, '' );
958+
title_new = title.replace( /^\s?urgency\s*(.*?)\b/gi, '' );
959+
title_new = title.replace( /^\s?important\s*(.*?)\b/gi, '' );
960+
title_new = title.replace( /^\s?critical\s*(.*?)\b/gi, '' );
961+
iss_title = `${ urgn_tag } ${ title_new }`;
858962
}
859963
860964
console.log( `New Title: ...................... ${ iss_title }` )

0 commit comments

Comments
 (0)