From 1cb7a384e022733ba8c1387a9aef9ad382c86394 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Fri, 9 May 2025 21:54:12 +0200 Subject: [PATCH] workflows/keep-sorted: drop and move to treefmt Same reasoning as the commit before, but keep-sorted has even less overhead than editorconfig-checker. Benchmark has it at 1 second per run. --- .github/workflows/keep-sorted.yml | 41 ------------------------------- ci/default.nix | 2 ++ 2 files changed, 2 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/keep-sorted.yml diff --git a/.github/workflows/keep-sorted.yml b/.github/workflows/keep-sorted.yml deleted file mode 100644 index ec2237f52bd9..000000000000 --- a/.github/workflows/keep-sorted.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Check that files are sorted - -on: - pull_request_target: - types: [opened, synchronize, reopened] - -permissions: {} - -jobs: - get-merge-commit: - uses: ./.github/workflows/get-merge-commit.yml - - nixos: - name: keep-sorted - runs-on: ubuntu-24.04 - needs: get-merge-commit - if: "needs.get-merge-commit.outputs.mergedSha && !contains(github.event.pull_request.title, '[skip treewide]')" - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - ref: ${{ needs.get-merge-commit.outputs.mergedSha }} - - - name: Get Nixpkgs revision for keep-sorted - run: | - # Pin to a commit from nixpkgs-unstable to avoid e.g. building nixfmt from staging. - # This should not be a URL, because it would allow PRs to run arbitrary code in CI! - rev=$(jq -r .rev ci/pinned-nixpkgs.json) - echo "url=https://github.com/NixOS/nixpkgs/archive/$rev.tar.gz" >> "$GITHUB_ENV" - - - uses: cachix/install-nix-action@526118121621777ccd86f79b04685a9319637641 # v31 - with: - extra_nix_config: sandbox = true - nix_path: nixpkgs=${{ env.url }} - - - name: Install keep-sorted - run: "nix-env -f '' -iAP keep-sorted jq" - - - name: Check that Nix files are sorted - shell: bash - run: | - git ls-files | xargs keep-sorted --mode lint | jq --raw-output '.[] | "Please make sure any new entries in \(.path) are sorted alphabetically."' diff --git a/ci/default.nix b/ci/default.nix index 59fb1b48574c..9d0fff7d119a 100644 --- a/ci/default.nix +++ b/ci/default.nix @@ -44,6 +44,8 @@ let # By default it's info, which is too noisy since we have many unmatched files settings.on-unmatched = "debug"; + programs.keep-sorted.enable = true; + # This uses nixfmt-rfc-style underneath, # the default formatter for Nix code. # See https://github.com/NixOS/nixfmt