-
-
Notifications
You must be signed in to change notification settings - Fork 3k
58 lines (49 loc) · 1.83 KB
/
generate-doc-files.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
name: Generate Documentation Prep Files
on:
pull_request:
paths:
- www/apps/**
jobs:
check_files:
runs-on: ubuntu-latest
permissions:
contents: write # Required to push changes
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2 # Ensures we can check the diff
ref: ${{ github.event.pull_request.head.ref }} # Checkout PR branch
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 20
cache: "yarn"
- name: Install Workspace dependencies
working-directory: www
run: yarn install
- name: Build packages
working-directory: www
run: yarn build:packages
- name: Run yarn prep in book
working-directory: www/apps/book
run: yarn prep
- name: Run yarn prep in resources
working-directory: www/apps/resources
run: yarn prep
- name: Commit and push changes (if any)
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if [[ -n $(git status --porcelain www/apps/book/generated www/apps/book/public www/apps/resources/generated) ]]; then
echo "Ran prep and generated files, committing and pushing..."
git add www/apps/book/generated www/apps/book/public www/apps/resources/generated
git commit -m "chore: run yarn prep automatically"
git push origin ${{ github.event.pull_request.head.ref }}
else
echo "No generated files, skipping commit."
fi