Auto Dismiss GitLab Auto DevOps Alert

Automatically dismisses the "Auto DevOps" alert on GitLab

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==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 });
})();