1 name: "Checking EditorConfig"
6 # avoids approving first time contributors
13 name: editorconfig-check
14 runs-on: ubuntu-latest
15 if: "github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip treewide]')"
17 - name: Get list of changed files from PR
19 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 repos/NixOS/nixpkgs/pulls/${{github.event.number}}/files --paginate \
23 | jq '.[] | select(.status != "removed") | .filename' \
24 > "$HOME/changed_files"
25 - name: print list of changed files
27 cat "$HOME/changed_files"
28 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
30 # pull_request_target checks out the base branch by default
31 ref: refs/pull/${{ github.event.pull_request.number }}/merge
32 - uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27
34 # nixpkgs commit is pinned so that it doesn't break
35 # editorconfig-checker 2.4.0
36 nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz
37 - name: Checking EditorConfig
39 cat "$HOME/changed_files" | nix-shell -p editorconfig-checker --run 'xargs -r editorconfig-checker -disable-indent-size'
40 - if: ${{ failure() }}
42 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."