about summary refs log tree commit diff
path: root/nixpkgs/.github/workflows/editorconfig.yml
blob: c20ed3ab768d7c68148d9a72c679d6155245284a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: "Checking EditorConfig"

on:
  pull_request:
    branches-ignore:
      - 'release-**'

jobs:
  tests:
    runs-on: ubuntu-latest
    if: github.repository_owner == 'NixOS'
    steps:
    - name: Get list of changed files from PR
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        echo 'PR_DIFF<<EOF' >> $GITHUB_ENV
        gh api \
          repos/NixOS/nixpkgs/pulls/${{github.event.number}}/files --paginate \
          | jq '.[] | select(.status != "removed") | .filename' \
          >> $GITHUB_ENV
        echo 'EOF' >> $GITHUB_ENV
    - uses: actions/checkout@v2
      if: env.PR_DIFF
    - name: Fetch editorconfig-checker
      if: env.PR_DIFF
      env:
        ECC_VERSION: "2.3.5"
        ECC_URL: "https://github.com/editorconfig-checker/editorconfig-checker/releases/download"
      run: |
        curl -sSf -O -L -C - "$ECC_URL/$ECC_VERSION/ec-linux-amd64.tar.gz" && \
        tar xzf ec-linux-amd64.tar.gz && \
        mv ./bin/ec-linux-amd64 ./bin/editorconfig-checker
    - name: Checking EditorConfig
      if: env.PR_DIFF
      run: |
        echo "$PR_DIFF" | xargs ./bin/editorconfig-checker -disable-indent-size