summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorzowoq <59103226+zowoq@users.noreply.github.com>2020-12-27 18:30:10 +1000
committerzowoq <59103226+zowoq@users.noreply.github.com>2020-12-28 17:48:26 +1000
commit3f73b922700b6a8427e82702452a374d4719b52b (patch)
treef496c839d6b28bde6c244cce1646a1056aa80f6a /.github
parent85c8f75393d7b0e593b3accd3b52155f63daa4f1 (diff)
.github/workflows/editorconfig.yml: use api for list of changed files
faster than doing a full clone and using git diff
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/editorconfig.yml22
1 files changed, 15 insertions, 7 deletions
diff --git a/.github/workflows/editorconfig.yml b/.github/workflows/editorconfig.yml
index be7a4ba02b61..6935d0bbd21f 100644
--- a/.github/workflows/editorconfig.yml
+++ b/.github/workflows/editorconfig.yml
@@ -8,13 +8,22 @@ on:
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
- with:
- fetch-depth: 0
- - uses: technote-space/get-diff-action@v4.0.0
+ if: env.PR_DIFF
- name: Fetch editorconfig-checker
- if: env.GIT_DIFF
+ if: env.PR_DIFF
env:
ECC_VERSION: "2.2.0"
ECC_URL: "https://github.com/editorconfig-checker/editorconfig-checker/releases/download"
@@ -23,7 +32,6 @@ jobs:
tar xzf ec-linux-amd64.tar.gz && \
mv ./bin/ec-linux-amd64 ./bin/editorconfig-checker
- name: Checking EditorConfig
- if: env.GIT_DIFF
+ if: env.PR_DIFF
run: |
- ./bin/editorconfig-checker -disable-indent-size \
- ${{ env.GIT_DIFF }}
+ echo "$PR_DIFF" | xargs ./bin/editorconfig-checker -disable-indent-size