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.
This commit is contained in:
41
.github/workflows/keep-sorted.yml
vendored
41
.github/workflows/keep-sorted.yml
vendored
@@ -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 '<nixpkgs>' -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."'
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user