-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (72 loc) · 2.19 KB
/
update-spec-for-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
64
65
66
67
68
69
70
71
72
on:
push:
tags:
- v*
branches:
- main
paths:
- kittycad.ts.patch.json
pull_request:
paths:
- .github/workflows/update-spec-for-docs.yml
workflow_dispatch:
name: update spec for docs
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
jobs:
update-spec:
name: update-spec
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
node-version: '16'
cache: 'yarn'
- run: yarn install
- run: yarn gen
# Ensure no files changed.
- name: Ensure no files changed
shell: bash
run: |
if [[ `git status --porcelain` ]]; then
echo "Files changed, exiting";
exit 1;
else
# No changes
echo "No files changed, proceeding";
fi
# Checkout the docs repo since we will want to update the files there.
- uses: actions/checkout@v3
with:
repository: 'kittycad/website'
path: 'docs'
token: ${{secrets.KITTYCAD_TS_PAT}}
- name: move spec to docs
shell: bash
run: |
rm docs/kittycad.ts.patch.json || true
cp kittycad.ts.patch.json docs/kittycad.ts.patch.json
- name: commit the changes in the docs repo
shell: bash
run: |
cd docs
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -am "YOYO NEW SPEC TYPESCRIPT DOCS!" || exit 0
git fetch origin
git rebase origin/main || exit 0
export NEW_BRANCH="update-spec-typescript"
git checkout -b "$NEW_BRANCH"
git push -f origin "$NEW_BRANCH"
gh pr create --title "Update lang spec docs for typescript" \
--body "Updating the generated docs for typescript" \
--head "$NEW_BRANCH" \
--reviewer jessfraz \
--reviewer irev-dev \
--reviewer franknoirot \
--base main || true
env:
GITHUB_TOKEN: ${{secrets.KITTYCAD_TS_PAT}}