1 name: "Checking EditorConfig v2"
8 # avoids approving first time contributors
15 name: editorconfig-check
16 runs-on: ubuntu-latest
17 if: "github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip treewide]')"
19 - name: Get list of changed files from PR
21 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 repos/NixOS/nixpkgs/pulls/${{github.event.number}}/files --paginate \
25 | jq '.[] | select(.status != "removed") | .filename' \
26 > "$HOME/changed_files"
27 - name: print list of changed files
29 cat "$HOME/changed_files"
30 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32 # pull_request_target checks out the base branch by default
33 ref: refs/pull/${{ github.event.pull_request.number }}/merge
34 - uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
36 # nixpkgs commit is pinned so that it doesn't break
37 # editorconfig-checker 2.4.0
38 nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz
39 - name: Checking EditorConfig
41 cat "$HOME/changed_files" | nix-shell -p editorconfig-checker --run 'xargs -r editorconfig-checker -disable-indent-size'
42 - if: ${{ failure() }}
44 echo "::error :: Hey! It looks like your changes don't follow our editorconfig settings. Read https://editorconfig.org/#download to configure your editor so you never see this error again."