-
Notifications
You must be signed in to change notification settings - Fork 43
98 lines (93 loc) · 3.15 KB
/
build_documentation.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
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Build Cloud SDK Documentation
on:
pull_request:
branches: [main]
jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine Changed Files
id: changed-files
run: |
ALL_FILES=$(gh pr view ${{ github.event.pull_request.number }} --json files --jq '.files.[] | select(.additions > 0) | .path')
CHANGED_FILES="${ALL_FILES//$'\n'/,}"
echo "[DEBUG] Following files have been changed: $CHANGED_FILES"
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Vale Linter
# vale fails if the PR is too large, e.g. when updating API docs
if: ${{ github.event.pull_request.changed_files < 100 }}
# You may pin to the exact commit or the version.
# uses: errata-ai/vale-action@0da98680790f89b8d5b685de9c264f55addc971b
uses: errata-ai/vale-action@reviewdog
with:
# version of 'vale' to use
# see https://github.com/errata-ai/vale for all releases
version: 3.0.5
# changed files. computed in the step above
files: ${{ steps.changed-files.outputs.CHANGED_FILES }}
# the separator for the file list. we are using a comma (see step above)
separator: ","
# let review dog fail if there are errors
fail_on_error: true
env:
# Required
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/cache@v4
id: cache
with:
path: node_modules
key: ubuntu-latest-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: ESlint and Prettier
run: npm run lint
build:
runs-on: ubuntu-latest
needs: [checks]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/cache@v4
id: cache
with:
path: node_modules
key: ubuntu-latest-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Build docs
run: npm run build
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
needs: [build]
permissions:
pull-requests: write
contents: write
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}