1+ name : AsciiDoc Review
2+
3+ on :
4+ push :
5+ branches : [main, master, auto_review]
6+ paths : ['**.adoc', '**.asciidoc']
7+ pull_request :
8+ branches : [main, master, auto_review]
9+ paths : ['**.adoc', '**.asciidoc']
10+
11+ jobs :
12+ adoc-review :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - uses : actions/checkout@v4
16+
17+ - name : Setup Ruby
18+ uses : ruby/setup-ruby@v1
19+ with :
20+ ruby-version : ' 3.2'
21+ bundler-cache : true
22+
23+ - name : Cache gems
24+ uses : actions/cache@v3
25+ with :
26+ path : ~/.gem
27+ key : ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
28+ restore-keys : |
29+ ${{ runner.os }}-gems-
30+
31+ - name : Install Asciidoctor
32+ run : |
33+ gem install asciidoctor --version '~>2.3.19'
34+ gem install asciidoctor-diagram --version '~>2.3.19'
35+
36+ - name : Validate AsciiDoc syntax
37+ run : |
38+ set -e
39+ files=$(find . -name "*.adoc" -o -name "*.asciidoc")
40+ if [ -n "$files" ]; then
41+ echo "Found AsciiDoc files to validate:"
42+ echo "$files"
43+ echo "$files" | xargs -I {} sh -c 'echo "Validating: $1" && asciidoctor -b docbook -o /dev/null "$1"' _ {}
44+ else
45+ echo "No AsciiDoc files found to validate"
46+ fi
47+
48+ - name : Setup Node.js
49+ uses : actions/setup-node@v4
50+ with :
51+ node-version : ' 18'
52+
53+ - name : Install asciidoc-link-check
54+ run : npm install --save-dev asciidoc-link-check@1.17.0
55+
56+ - name : Create link check config
57+ run : |
58+ cat > .asciidoc-link-check.json << 'EOF'
59+ {
60+ "ignorePatterns": [
61+ {
62+ "pattern": "^http://localhost"
63+ }
64+ ],
65+ "timeout": "10s",
66+ "retryOn429": true,
67+ "retryCount": 3
68+ }
69+ EOF
70+
71+ - name : Check internal links
72+ run : |
73+ find . \( -name "*.adoc" -o -name "*.asciidoc" \) | xargs -I {} asciidoc-link-check -c .asciidoc-link-check.json {}
0 commit comments