This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Check validity of .editorconfig" | |
permissions: read-all | |
on: | |
pull_request: | |
jobs: | |
check-editorconfig: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.pull_request.title, '[skip ci]')" | |
steps: | |
- name: Get list of changed files from PR | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh api \ | |
repos/notashelf/neovim-flake/pulls/${{github.event.number}}/files --paginate \ | |
| 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 | |
uses: DeterminateSystems/nix-installer-action@main | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Checking EditorConfig | |
shell: bash | |
run: | | |
cat "$HOME/changed_files" | nix-shell -p editorconfig-checker.out --run 'xargs -r editorconfig-checker -disable-indentation -exclude flake.lock --verbose' | |
echo -n "Check status: $?" | |
- name: Fail Gracefully | |
if: ${{ failure() }} | |
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 |