From d20221950235cc4312497854f0671e7e44626a15 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 12 Jul 2025 15:24:14 +0200 Subject: [PATCH] ci/github-script: move from ci/labels This just moves things around to use less specific naming - `labels` is only *one* script that can potentially be run locally while still being written in github-script. Later, we can add more. (cherry picked from commit 6f6c62502622fea6904d6d7e42b89f3ebc400ede) --- .github/workflows/labels.yml | 4 ++-- ci/{labels => github-script}/.editorconfig | 0 ci/{labels => github-script}/.gitignore | 0 ci/{labels => github-script}/.npmrc | 0 ci/github-script/README.md | 13 +++++++++++++ ci/{labels => github-script}/labels.cjs | 0 ci/{labels => github-script}/package-lock.json | 0 ci/{labels => github-script}/package.json | 0 ci/{labels => github-script}/run.js | 2 +- ci/{labels => github-script}/shell.nix | 0 ci/labels/README.md | 4 ---- 11 files changed, 16 insertions(+), 7 deletions(-) rename ci/{labels => github-script}/.editorconfig (100%) rename ci/{labels => github-script}/.gitignore (100%) rename ci/{labels => github-script}/.npmrc (100%) create mode 100644 ci/github-script/README.md rename ci/{labels => github-script}/labels.cjs (100%) rename ci/{labels => github-script}/package-lock.json (100%) rename ci/{labels => github-script}/package.json (100%) rename ci/{labels => github-script}/run.js (92%) rename ci/{labels => github-script}/shell.nix (100%) delete mode 100644 ci/labels/README.md diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index f5a04ad073bc..ff6905d62164 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -43,7 +43,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: sparse-checkout: | - ci/labels + ci/github-script - name: Install dependencies run: npm install @actions/artifact bottleneck @@ -69,7 +69,7 @@ jobs: github-token: ${{ steps.app-token.outputs.token || github.token }} retries: 3 script: | - require('./ci/labels/labels.cjs')({ + require('./ci/github-script/labels.cjs')({ github, context, core, diff --git a/ci/labels/.editorconfig b/ci/github-script/.editorconfig similarity index 100% rename from ci/labels/.editorconfig rename to ci/github-script/.editorconfig diff --git a/ci/labels/.gitignore b/ci/github-script/.gitignore similarity index 100% rename from ci/labels/.gitignore rename to ci/github-script/.gitignore diff --git a/ci/labels/.npmrc b/ci/github-script/.npmrc similarity index 100% rename from ci/labels/.npmrc rename to ci/github-script/.npmrc diff --git a/ci/github-script/README.md b/ci/github-script/README.md new file mode 100644 index 000000000000..73cb4119a68d --- /dev/null +++ b/ci/github-script/README.md @@ -0,0 +1,13 @@ +# GitHub specific CI scripts + +This folder contains [`actions/github-script`](https://github.com/actions/github-script)-based JavaScript code. +It provides a `nix-shell` environment to run and test these actions locally. + +To run any of the scripts locally: + +- Provide `gh` on `PATH` and make sure it's authenticated. +- Enter `nix-shell` in `./ci/github-script`. + +## Labeler + +Run `./run.js OWNER REPO`, where OWNER is your username or "NixOS" and REPO the name of your fork or "nixpkgs". diff --git a/ci/labels/labels.cjs b/ci/github-script/labels.cjs similarity index 100% rename from ci/labels/labels.cjs rename to ci/github-script/labels.cjs diff --git a/ci/labels/package-lock.json b/ci/github-script/package-lock.json similarity index 100% rename from ci/labels/package-lock.json rename to ci/github-script/package-lock.json diff --git a/ci/labels/package.json b/ci/github-script/package.json similarity index 100% rename from ci/labels/package.json rename to ci/github-script/package.json diff --git a/ci/labels/run.js b/ci/github-script/run.js similarity index 92% rename from ci/labels/run.js rename to ci/github-script/run.js index d7e8e9ff9401..7f3f92e7b1f0 100755 --- a/ci/labels/run.js +++ b/ci/github-script/run.js @@ -7,7 +7,7 @@ import { getOctokit } from '@actions/github' import labels from './labels.cjs' if (process.argv.length !== 4) - throw new Error('Call this with exactly two arguments: ./run.js OWNER REPO') + throw new Error('Call this with exactly three arguments: ./run OWNER REPO') const [, , owner, repo] = process.argv const token = execSync('gh auth token', { encoding: 'utf-8' }).trim() diff --git a/ci/labels/shell.nix b/ci/github-script/shell.nix similarity index 100% rename from ci/labels/shell.nix rename to ci/github-script/shell.nix diff --git a/ci/labels/README.md b/ci/labels/README.md deleted file mode 100644 index 26cd88763fe6..000000000000 --- a/ci/labels/README.md +++ /dev/null @@ -1,4 +0,0 @@ -To test the labeler locally: -- Provide `gh` on `PATH` and make sure it's authenticated. -- Enter `nix-shell` in `./ci/labels`. -- Run `./run.js OWNER REPO`, where OWNER is your username or "NixOS" and REPO the name of your fork or "nixpkgs".