nixpkgs/ci/github-script
Wolfgang Walther 443f30f811
workflows/test: init
This workflow runs the PR and Push workflow files on a `pull_request`
trigger. The intent is to test changes to the workflow files
immediately. Previously, these were run directly from the respective
workflow files.

The new approach allows us to move the logic to run this only when
workflow files changed from the pull_request trigger into a job. This
has the advantage that older jobs are cleaned up, when the PR changes
from a state of "workflow files changed" to "no workflow files changed".
This can happen when changing a PR's base from staging to master, in
which case changes from master would temporarily appear in the PR as
changes. When these include changes to workflow files, this would
trigger the PR workflow via `pull_request`. Once the base is changed,
the PR is closed and re-opened, so CI runs again - but since it's on the
same commit and the new run doesn't trigger `pull_request`, the results
of the previous run are still kept and displayed. These results may
include cancelled or failed jobs, which are impossible to recover from
without another force-push.

Checking this condition at run-time is only possible, because we move it
into a separate workflow, turning the `pr.yml` workflow into a re-usable
workflow. This will make sure to skip the whole workflow at once, when
no change was detected, which will prevent the "no PR failures" job from
appearing as skipped - which would imply "success" and make the PR
mergeable immediately. Instead the "no PR failures" job is not shown at
all for this trigger, which is generally what we want.

Do the same for `push.yml` for consistency.
2025-08-24 12:07:39 +02:00
..
.editorconfig ci/github-script: default to commonjs 2025-07-14 10:35:18 +02:00
.gitignore ci/github-script/commits: init from ci/check-cherry-picks 2025-07-16 11:50:13 +02:00
.npmrc ci/github-script: use real @actions/core 2025-07-15 15:09:02 +02:00
commits.js workflows/test: init 2025-08-24 12:07:39 +02:00
labels.js ci: apply unsafe fixes with biome 2025-08-20 15:41:28 +02:00
package-lock.json ci/github-script: use real @actions/core 2025-07-15 15:09:02 +02:00
package.json ci/github-script: use real @actions/core 2025-07-15 15:09:02 +02:00
prepare.js ci/github-script/prepare: fix logging of branch classification 2025-08-20 17:59:27 +02:00
README.md ci/github-script/commits: init from ci/check-cherry-picks 2025-07-16 11:50:13 +02:00
run ci/github-script/prepare: init from actions/get-merge-commit 2025-08-20 15:16:15 +02:00
shell.nix ci/github-script: add gh dependency to dev shell 2025-07-15 12:19:41 +02:00
withRateLimit.js ci: apply unsafe fixes with biome 2025-08-20 15:41:28 +02:00

GitHub specific CI scripts

This folder contains 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:

  • Enter nix-shell in ./ci/github-script.
  • Ensure gh is authenticated.

Check commits

Run ./run commits OWNER REPO PR, where OWNER is your username or "NixOS", REPO is the name of your fork or "nixpkgs" and PR is the number of the pull request to check.

Labeler

Run ./run labels OWNER REPO, where OWNER is your username or "NixOS" and REPO the name of your fork or "nixpkgs".