This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (65 loc) · 2.36 KB
/
commit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Commit Checks
on:
push:
branches:
- 'master'
- 'release/v*.*.*-*'
tags:
- v*.*.*-*
pull_request:
branches:
- 'master'
- 'release/v*.*.*-*'
permissions:
contents: read
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint Commits
uses: wagoid/commitlint-github-action@v5
editorconfig-commit:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-22.11.tar.gz
- name: Check EditorConfig
run: |
nix-shell -p editorconfig-checker --run 'editorconfig-checker'
- if: ${{ failure() }}
run: |
echo "::error :: Hey! It looks like your changes don't follow our editorconfig settings. Read https://editorconfig.org/#download to configure your editor so you never see this error again."
# Based on https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/editorconfig.yml
editorconfig:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Get list of changed files from PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api repos/${{github.repository}}/pulls/${{github.event.number}}/files --paginate \
| jq '.[] | select(.status != "removed") | .filename' > $HOME/changed_files
- name: Print change list
run: cat $HOME/changed_files
- name: Checkout
uses: actions/checkout@v3
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-22.11.tar.gz
- name: Check EditorConfig
run: |
cat "$HOME/changed_files" | nix-shell -p editorconfig-checker --run 'xargs -r editorconfig-checker'
- if: ${{ failure() }}
run: |
echo "::error :: Hey! It looks like your changes don't follow our editorconfig settings. Read https://editorconfig.org/#download to configure your editor so you never see this error again."