neovim-flake/.github/workflows/editorconfig.yml

48 lines
1.5 KiB
YAML
Raw Permalink Normal View History

2023-10-11 20:03:07 +02:00
name: "Check validity of .editorconfig"
permissions: read-all
on:
pull_request:
jobs:
check-editorconfig:
runs-on: ubuntu-latest
2023-10-20 10:48:58 +02:00
if: "!contains(github.event.pull_request.title, '[skip ci]')"
2023-10-11 20:03:07 +02:00
steps:
- name: Get list of changed files from PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api \
2023-10-20 10:48:58 +02:00
repos/notashelf/neovim-flake/pulls/${{github.event.number}}/files --paginate \
2023-10-11 20:03:07 +02: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 10:48:58 +02:00
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
2023-10-11 20:03:07 +02:00
- name: Checking EditorConfig
2023-10-20 10:52:35 +02:00
shell: bash
2023-10-11 20:03:07 +02:00
run: |
2023-10-21 00:36:32 +02:00
cat "$HOME/changed_files" | nix-shell -p editorconfig-checker.out --run 'xargs -r editorconfig-checker -disable-indentation -exclude flake.lock --verbose'
2023-10-20 10:52:35 +02:00
echo -n "Check status: $?"
2023-10-11 20:03:07 +02:00
2023-10-20 10:52:35 +02:00
- name: Fail Gracefully
if: ${{ failure() }}
2023-10-11 20:03:07 +02: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