python312Packages.pyenvisalink: 4.7 -> 4.8
[NixPkgs.git] / .github / workflows / editorconfig-v2.yml
blobb14f76637458cae48022ac005dcc0e5e27053323
1 name: "Checking EditorConfig v2"
3 permissions:
4   pull-requests: read
5   contents: read
7 on:
8   # avoids approving first time contributors
9   pull_request_target:
10     branches-ignore:
11       - 'release-**'
13 jobs:
14   tests:
15     name: editorconfig-check
16     runs-on: ubuntu-latest
17     if: "github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip treewide]')"
18     steps:
19     - name: Get list of changed files from PR
20       env:
21         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22       run: |
23         gh api \
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
28       run: |
29         cat "$HOME/changed_files"
30     - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31       with:
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
35       with:
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
40       run: |
41         cat "$HOME/changed_files" | nix-shell -p editorconfig-checker --run 'xargs -r editorconfig-checker -disable-indent-size'
42     - if: ${{ failure() }}
43       run: |
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."