-
Notifications
You must be signed in to change notification settings - Fork 445
85 lines (83 loc) · 2.76 KB
/
lint.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Lint
on: [pull_request]
jobs:
trailing-whitespace:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for trailing whitespace
uses: raisedevs/find-trailing-whitespace@restrict-to-plaintext-only
- name: Check for merge conflicts
run: git diff --check
shell: bash
- name: Ensure all files have newline at EOF
uses: Logerfo/newline-action@0.0.4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
prose:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Vale
uses: errata-ai/vale-action@d89dee975228ae261d22c15adcd03578634d429c
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: avto-dev/markdown-lint@v1
with:
config: '.github/lint/markdown.json'
args: 'docs/**/*.md'
changedfiles:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
all: ${{ steps.changes.outputs.all}}
markdown: ${{ steps.changes.outputs.markdown }}
steps:
# Make sure we have some code to diff.
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changes
# Set outputs using the command.
run: |
echo "::set-output name=all::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | xargs)"
echo "::set-output name=markdown::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep .md$ | xargs)"
changelog:
runs-on: ubuntu-latest
# require the first job to have ran
needs: changedfiles
steps:
- name: echo changed files
run: |
if [[ ! "${{needs.changedfiles.outputs.markdown}}" == *"CHANGELOG.md"* ]]; then
echo "::error file=CHANGELOG.md,line=1,col=1::Please make sure that you add a docs/CHANGELOG.md entry to describe the changes in this pull request."
exit 1
fi
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
- uses: actions/cache@v4
with:
path: vendor/bundle
key: gems-build-rails-7.1-ruby-3.2-${{ hashFiles('**/Gemfile.lock') }}
- name: Lint with Rubocop and ERB Lint
run: |
bundle config path vendor/bundle
bundle update
bundle exec standardrb -r "rubocop-md"
bundle exec erblint **/*.html.erb
env:
RAILS_VERSION: '~> 7.1.0'