diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e38b140..6c90641 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ on: type: choice default: yes_sandbox_true options: - - 'no' + - "no" - yes_sandbox_false - yes_sandbox_relaxed - yes_sandbox_true @@ -36,7 +36,7 @@ on: type: choice default: yes_sandbox_true options: - - 'no' + - "no" - yes_sandbox_false - yes_sandbox_relaxed - yes_sandbox_true @@ -78,9 +78,9 @@ jobs: system: ${{ matrix.system }} sandbox: ${{ (matrix.system == 'x86_64-darwin' && inputs.x86_64-darwin == 'yes_sandbox_false' - || matrix.system == 'aarch64-darwin' && inputs.aarch64-darwin == 'yes_sandbox_false') && 'false' + || matrix.system == 'aarch64-darwin' && inputs.aarch64-darwin == 'yes_sandbox_false') && 'false' || (matrix.system == 'x86_64-darwin' && inputs.x86_64-darwin == 'yes_sandbox_relaxed' - || matrix.system == 'aarch64-darwin' && inputs.aarch64-darwin == 'yes_sandbox_relaxed') && 'relaxed' + || matrix.system == 'aarch64-darwin' && inputs.aarch64-darwin == 'yes_sandbox_relaxed') && 'relaxed' || 'true' }} - name: nix build diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index d8728f3..3e3e044 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -29,7 +29,7 @@ on: type: choice default: yes_sandbox_true options: - - 'no' + - "no" - yes_sandbox_false - yes_sandbox_relaxed - yes_sandbox_true @@ -39,7 +39,7 @@ on: type: choice default: yes_sandbox_true options: - - 'no' + - "no" - yes_sandbox_false - yes_sandbox_relaxed - yes_sandbox_true @@ -147,11 +147,11 @@ jobs: system: ${{ matrix.system }} sandbox: ${{ (matrix.system == 'x86_64-darwin' && inputs.x86_64-darwin == 'yes_sandbox_false' - || matrix.system == 'aarch64-darwin' && inputs.aarch64-darwin == 'yes_sandbox_false') && 'false' + || matrix.system == 'aarch64-darwin' && inputs.aarch64-darwin == 'yes_sandbox_false') && 'false' || (matrix.system == 'x86_64-darwin' && inputs.x86_64-darwin == 'yes_sandbox_relaxed' - || matrix.system == 'aarch64-darwin' && inputs.aarch64-darwin == 'yes_sandbox_relaxed') && 'relaxed' + || matrix.system == 'aarch64-darwin' && inputs.aarch64-darwin == 'yes_sandbox_relaxed') && 'relaxed' || 'true' }} - + - name: install packages run: | pkgs=(coreutils nixpkgs-review jq gnused) diff --git a/shortcut.js b/shortcut.js index 5dc52be..26ac73c 100644 --- a/shortcut.js +++ b/shortcut.js @@ -8,7 +8,7 @@ const repo = "Defelo/nixpkgs-review-gha"; const reviewDefaults = ({ title, commits, labels, author, authoredByMe, hasLinuxRebuilds, hasDarwinRebuilds }) => { const darwinSandbox = "true"; - + return { // "branch": "main", "x86_64-linux": hasLinuxRebuilds, @@ -40,15 +40,20 @@ const query = async (doc, sel) => { const getPrDetails = pr => { const title = document.querySelector("bdi.js-issue-title.markdown-title").innerText; - const commits = [...document.querySelectorAll(".TimelineItem-body a.markdown-title[href*='/commits/']")] - .flatMap(({ title, href }) => { + const commits = [...document.querySelectorAll(".TimelineItem-body a.markdown-title[href*='/commits/']")].flatMap( + ({ title, href }) => { const match = /\/NixOS\/nixpkgs\/pull\/(\d+)\/commits\/([0-9a-f]+)$/i.exec(href); - return (match === null || match[1] !== pr) ? [] : [{ - commit_id: match[2], - subject: title.split("\n")[0], - description: title, - }]; - }); + return match === null || match[1] !== pr + ? [] + : [ + { + commit_id: match[2], + subject: title.split("\n")[0], + description: title, + }, + ]; + }, + ); const labels = [...document.querySelectorAll("div.js-issue-labels > a")].map(x => x.innerText); const author = document.querySelector(".js-discussion > :first-child a.author").href.split("/").at(-1); const self = document.querySelector("div.AppHeader-user button[data-login]").getAttribute("data-login"); @@ -61,7 +66,9 @@ const getPrDetails = pr => { }; const setupActionsPage = async () => { - const match = /^https:\/\/github.com\/([^/]+\/[^/]+)\/actions\/workflows\/review.yml#dispatch:(.*)$/.exec(location.href); + const match = /^https:\/\/github.com\/([^/]+\/[^/]+)\/actions\/workflows\/review.yml#dispatch:(.*)$/.exec( + location.href, + ); if (match === null || match[1] !== repo) return; const inputs = new URLSearchParams(match[2]); @@ -99,9 +106,7 @@ const setupActionsPage = async () => { const branch = inputs.get("branch"); if (branch) await setBranch(branch); - [...inputs] - .filter(([name]) => name !== "branch") - .forEach(([name, value]) => setInput(name, value)); + [...inputs].filter(([name]) => name !== "branch").forEach(([name, value]) => setInput(name, value)); document.querySelector("details .workflow-dispatch button[type=submit]").focus(); }; @@ -109,7 +114,7 @@ const setupActionsPage = async () => { const setupPrPage = async () => { const match = /^https:\/\/github.com\/NixOS\/nixpkgs\/pull\/(\d+)([?#].*)?$/i.exec(location.href); if (match === null) return; - + const pr = match[1]; const actions = await query(document, ".gh-header-show .gh-header-actions"); @@ -140,7 +145,7 @@ const setupPrPage = async () => { }; } } -} +}; new MutationObserver(setupPrPage).observe(document, { subtree: true, childList: true });