Auto Dismiss GitLab Auto DevOps Alert

Automatically dismisses the "Auto DevOps" alert on GitLab

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Auto Dismiss GitLab Auto DevOps Alert
// @namespace    https://gitlab.com
// @version      1.0
// @description  Automatically dismisses the "Auto DevOps" alert on GitLab
// @author       Sam Artuso <[email protected]>
// @match        *://gitlab.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function dismissAlert() {
        let button = document.querySelector('[aria-label="Dismiss Auto DevOps box"]');
        if (button) {
            console.log('Auto DevOps alert found! Dismissing it...');
            button.click();
        } else {
            console.log('No Auto DevOps alert found.');
        }
    }

    // Run the function after page load
    window.addEventListener('load', () => {
        setTimeout(dismissAlert, 2000); // Delay to allow GitLab to render elements
    });

    // Also run periodically in case the alert appears later (SPA handling)
    let observer = new MutationObserver(() => dismissAlert());
    observer.observe(document.body, { childList: true, subtree: true });
})();