.github/workflows/editorconfig.yml: use api for list of changed files
faster than doing a full clone and using git diff
This commit is contained in:
parent
85c8f75393
commit
3f73b92270
|
@ -8,13 +8,22 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.repository_owner == 'NixOS'
|
||||||
steps:
|
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
|
- uses: actions/checkout@v2
|
||||||
with:
|
if: env.PR_DIFF
|
||||||
fetch-depth: 0
|
|
||||||
- uses: technote-space/get-diff-action@v4.0.0
|
|
||||||
- name: Fetch editorconfig-checker
|
- name: Fetch editorconfig-checker
|
||||||
if: env.GIT_DIFF
|
if: env.PR_DIFF
|
||||||
env:
|
env:
|
||||||
ECC_VERSION: "2.2.0"
|
ECC_VERSION: "2.2.0"
|
||||||
ECC_URL: "https://github.com/editorconfig-checker/editorconfig-checker/releases/download"
|
ECC_URL: "https://github.com/editorconfig-checker/editorconfig-checker/releases/download"
|
||||||
|
@ -23,7 +32,6 @@ jobs:
|
||||||
tar xzf ec-linux-amd64.tar.gz && \
|
tar xzf ec-linux-amd64.tar.gz && \
|
||||||
mv ./bin/ec-linux-amd64 ./bin/editorconfig-checker
|
mv ./bin/ec-linux-amd64 ./bin/editorconfig-checker
|
||||||
- name: Checking EditorConfig
|
- name: Checking EditorConfig
|
||||||
if: env.GIT_DIFF
|
if: env.PR_DIFF
|
||||||
run: |
|
run: |
|
||||||
./bin/editorconfig-checker -disable-indent-size \
|
echo "$PR_DIFF" | xargs ./bin/editorconfig-checker -disable-indent-size
|
||||||
${{ env.GIT_DIFF }}
|
|
||||||
|
|
Loading…
Reference in New Issue