-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (51 loc) · 1.65 KB
/
update-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
63
# This workflow will update the docs in the sdk-docs repo
name: Update Docs
on:
push:
branches:
- generate-docs
jobs:
update-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Yarn
run: |
corepack enable
corepack prepare yarn@4.5.0 --activate
- name: Install dependencies
run: yarn install
- name: Run the gen:docs command
run: yarn gen:docs
- name: Check and commit changes
id: commit_check
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
if [[ -n "$(git status --porcelain docs)" ]]; then
git add docs
git commit -m "Update docs"
echo "has_changes=true" >> "$GITHUB_OUTPUT"
else
echo "has_changes=false" >> "$GITHUB_OUTPUT"
fi
- name: Push the changes
if: steps.commit_check.outputs.has_changes == 'true'
run: git push
- name: Install dependencies
if: steps.commit_check.outputs.has_changes == 'true'
run: yarn add simple-git
- name: Setup GitHub CLI
if: steps.commit_check.outputs.has_changes == 'true'
run: |
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
- name: Update docs
if: steps.commit_check.outputs.has_changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node ./.github/ci-scripts/update-sdk-docs.js