nvf/.github/workflows/editorconfig.yml

48 lines
1.5 KiB
YAML
Raw Normal View History

2023-10-11 18:03:07 +00:00
name: "Check validity of .editorconfig"
permissions: read-all
on:
pull_request:
jobs:
check-editorconfig:
runs-on: ubuntu-latest
2023-10-20 08:48:58 +00:00
if: "!contains(github.event.pull_request.title, '[skip ci]')"
2023-10-11 18:03:07 +00:00
steps:
- name: Get list of changed files from PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api \
2023-10-20 08:48:58 +00:00
repos/notashelf/neovim-flake/pulls/${{github.event.number}}/files --paginate \
2023-10-11 18:03:07 +00:00
| jq '.[] | select(.status != "removed") | .filename' \
> "$HOME/changed_files"
- name: Print list of changed files
run: |
cat "$HOME/changed_files"
- name: Checkout
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Install Nix
2023-10-20 08:48:58 +00:00
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
2023-10-11 18:03:07 +00:00
- name: Checking EditorConfig
2023-10-20 08:52:35 +00:00
shell: bash
2023-10-11 18:03:07 +00:00
run: |
2023-10-20 08:52:35 +00:00
cat "$HOME/changed_files" | nix-shell -p editorconfig-checker.out --run 'xargs -r editorconfig-checker -disable-indent-size --verbose'
echo -n "Check status: $?"
2023-10-11 18:03:07 +00:00
2023-10-20 08:52:35 +00:00
- name: Fail Gracefully
if: ${{ failure() }}
2023-10-11 18:03:07 +00:00
shell: bash
run: |
echo "::error:: Current formatting does not fit convention provided by .editorconfig located in the project root."
echo "Please make sure your editor properly integrates editorconfig. See https://editorconfig.org/#download for more."
exit 1