-
Notifications
You must be signed in to change notification settings - Fork 56
42 lines (36 loc) · 1.19 KB
/
code-blocks-linting.yaml
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
name: Linting code-blocks
on: [pull_request]
jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax
- name: Installing Dependencies
run: |
pip install blacken-docs
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
dir_names_max_depth: 0
files: |
docs/source/*.rst
docs/source/**/*.rst
!docs/source/**/_templates
- name: Running blacken
run: |
blacken-docs -E -l 80 ${{ steps.changed-files.outputs.all_changed_files }} > blacken.log | true
cat blacken.log
if grep -q "parse error" "blacken.log"; then
exit 1
fi
- name: Run action-suggester (only works on lines that were changes in this PR)
uses: reviewdog/action-suggester@v1
with:
tool_name: blacken-docs
- name: Display diff and fail if there was anything changed by blacken-docs
run: |
git diff --diff-algorithm histogram --exit-code