Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: doc: link to the generated docs once the CI doc build has run successfully #63020

Open
fgrandel opened this issue Sep 24, 2023 · 0 comments
Assignees

Comments

@fgrandel
Copy link
Contributor

fgrandel commented Sep 24, 2023

Problem Description

We have a nice hidden feature that the doc being built for a PR is actually available for download/viewing. It would be nice if that feature could be made more visible (e.g. as proposed by @kartben as an automatic comment).

Proposed Solution

Similar to @kartben 's nice little browser script:

// ==UserScript==
// @name         Show link to CI-built docs for a Zephyr PR
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  add link to CI doc site
// @author       You
// @match        https://github.com/zephyrproject-rtos/zephyr/pull/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const addDocsLink = () => {
        const PRNumberRegex = /(\d+)/g;
        let targetElement = document.querySelector(".gh-header-title");

        if (targetElement) {
            // Get PR number from URL
            let prNumber = window.location.pathname.split("/").pop();
            if (PRNumberRegex.test(prNumber)) {
                let container = document.createElement('div');

                let docLink = document.createElement('a');
                docLink.href = `https://builds.zephyrproject.io/zephyr/pr/${prNumber}/docs/`;
                docLink.target = "_blank";
                docLink.innerText = `here`;

                container.appendChild(document.createTextNode('CI-built documentation: '));
                container.appendChild(docLink); 
                container.appendChild(document.createElement('br'));

                targetElement.parentNode.parentNode.insertBefore(container, targetElement.parentNode);
            }
        }
    };

    addDocsLink();
})();

Alternatives

./.

Additional context

Has come up several times as a question on Discord plus would probably actively promote active review of doc results by both, contributors and reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants