-
-
Notifications
You must be signed in to change notification settings - Fork 625
62 lines (52 loc) · 1.65 KB
/
generate-docs.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
name: Generate documentation
# Run this workflow on all pushes to master and pull requests
on:
push:
branches:
- master
pull_request: {}
merge_group:
types: [checks_requested]
# Cancel previous PR/branch runs when a new commit is pushed
concurrency:
group: 'generate-docs-${{ github.ref }}'
cancel-in-progress: true
jobs:
# This job checks if the docs can be generated and produce changes
# If they do, a PR will be created with the changes
check-and-update:
# Don't run in forks
if: github.repository == 'zwave-js/node-zwave-js'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18] # This should be LTS
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare environment
uses: ./.github/actions/prepare-env
with:
node-version: ${{ matrix.node-version }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
# FIXME: Check if this build step is still needed
- name: Compile TypeScript code
run: yarn run build
- name: Generate documentation
run: yarn run docs:generate
- name: Generate API report
run: yarn run accept-api
# Trigger this step only when pushing to master
- name: Create or update PR
if: |
github.event_name == 'push' &&
github.ref == 'refs/heads/master'
uses: actions/github-script@v7
with:
github-token: ${{secrets.BOT_TOKEN}}
result-encoding: string
script: |
const main = require(`${process.env.GITHUB_WORKSPACE}/.github/action-scripts/generateTypedDocs.cjs`);
return main({github, context});