11// ==UserScript==
22// @name Auto-Merge Dependabot PRs
33// @namespace typpi.online
4- // @version 6.6
4+ // @version 6.7
55// @description Merges Dependabot PRs in any of your repositories - pulls the PRs into a table and lets you select which ones to merge.
66// @author Nick2bad4u
77// @match https://github.com/notifications
@@ -398,7 +398,7 @@ function safeGM_addStyle(css) {
398398 return [ ...userRepos , ...orgRepos . flat ( ) ] ;
399399 }
400400
401- const botUsernames = safeGM_getValue ( 'dependabot_usernames' , [ 'dependabot[bot]' , 'dependabot-preview[bot]' ] )
401+ const botUsernames = safeGM_getValue ( 'dependabot_usernames' , [ 'dependabot[bot]' , 'dependabot-preview[bot]' , 'github-actions[bot]' ] )
402402 . map ( ( username ) => username . trim ( ) )
403403 . filter ( Boolean ) ;
404404
@@ -687,6 +687,21 @@ function safeGM_addStyle(css) {
687687 title . textContent = 'Select Dependabot PRs to Merge' ;
688688 container . appendChild ( title ) ;
689689
690+ // Add Select All button
691+ const selectAllBtn = document . createElement ( 'button' ) ;
692+ selectAllBtn . textContent = 'Select All' ;
693+ selectAllBtn . className = 'merge-dependabot-btn' ;
694+ selectAllBtn . style . marginBottom = '8px' ;
695+ selectAllBtn . style . marginRight = '8px' ;
696+ let allSelected = false ;
697+ selectAllBtn . addEventListener ( 'click' , ( ) => {
698+ const checkboxes = Array . from ( prList . querySelectorAll ( 'input[type="checkbox"]' ) ) ;
699+ allSelected = ! allSelected ;
700+ checkboxes . forEach ( cb => { cb . checked = allSelected ; } ) ;
701+ selectAllBtn . textContent = allSelected ? 'Deselect All' : 'Select All' ;
702+ } ) ;
703+ container . appendChild ( selectAllBtn ) ;
704+
690705 const prList = document . createElement ( 'div' ) ;
691706 prList . className = 'merge-dependabot-pr-list' ;
692707 prList . id = 'merge-dependabot-pr-list' ;
@@ -738,7 +753,18 @@ function safeGM_addStyle(css) {
738753 const selectedPRs = selectedCheckboxes . map ( ( checkbox ) => prs . find ( ( pr ) => pr . number == checkbox . value ) ) ;
739754
740755 if ( selectedPRs . length > 0 ) {
741- container . innerHTML = '<div id="merge-status">Merging PRs...<br></div>' ;
756+ // Remove the PR selection container before merging to avoid blue rectangle
757+ container . remove ( ) ;
758+ removeAllPRSelectionContainers ( ) ;
759+ // Show status only
760+ let status = document . getElementById ( 'merge-status' ) ;
761+ if ( ! status ) {
762+ status = document . createElement ( 'div' ) ;
763+ status . id = 'merge-status' ;
764+ status . classList . add ( 'merge-status' ) ;
765+ document . body . appendChild ( status ) ;
766+ }
767+ status . innerHTML = 'Merging PRs...<br>' ;
742768 // Remove the container after merging is done (with a delay to show status)
743769 const groupedPRs = selectedPRs . reduce ( ( acc , pr ) => {
744770 if ( ! acc [ pr . repo ] ) {
@@ -756,15 +782,13 @@ function safeGM_addStyle(css) {
756782 console . error ( `Error merging PRs for repo ${ repo } :` , error ) ;
757783 const status = document . getElementById ( 'merge-status' ) ;
758784 if ( status ) status . remove ( ) ;
759- container . remove ( ) ;
760785 removeAllPRSelectionContainers ( ) ;
761786 alert ( `Failed to merge PRs for repo ${ repo } . Please check the console for details.` ) ;
762787 return ;
763788 }
764789 setTimeout ( ( ) => {
765790 const status = document . getElementById ( 'merge-status' ) ;
766791 if ( status ) status . remove ( ) ;
767- container . remove ( ) ;
768792 removeAllPRSelectionContainers ( ) ;
769793 } , 11000 ) ; // Wait for status to finish
770794 }
@@ -782,7 +806,7 @@ function safeGM_addStyle(css) {
782806 document . body . appendChild ( container ) ;
783807
784808 // Focus management for modal
785- const focusableEls = [ closeBtn , mergeSelectedButton , ...Array . from ( prList . querySelectorAll ( 'input[type="checkbox"]' ) ) ] ;
809+ const focusableEls = [ closeBtn , selectAllBtn , mergeSelectedButton , ...Array . from ( prList . querySelectorAll ( 'input[type="checkbox"]' ) ) ] ;
786810 container . lastFocused = document . activeElement ;
787811 setTimeout ( ( ) => mergeSelectedButton . focus ( ) , 0 ) ;
788812 container . addEventListener ( 'keydown' , function ( e ) {
0 commit comments