-
Notifications
You must be signed in to change notification settings - Fork 37
74 lines (65 loc) · 2.17 KB
/
cli-docs.yaml
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
name: cli-docs
on:
# WIP just to test without bugging people with PRs
pull_request:
types: [edited, ready_for_review, converted_to_draft]
repository_dispatch:
types: [ update-cli-docs ]
env:
GITHUB_TOKEN: ${{ github.token }}
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout vcluster repository
uses: actions/checkout@v4
with:
repository: loft-sh/vcluster
fetch-depth: 0
ref: ${{ github.event.client_payload.ref }}
path: vcluster-repo
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Setup Just
uses: extractions/setup-just@v2
- name: Generate cli docs
working-directory: vcluster-repo
run: |
pwd
ls
just generate-cli-docs
- uses: actions/checkout@v4
with:
repository: loft-sh/vcluster-docs
fetch-depth: 0
path: vcluster-docs
- name: Copy generated files
env:
PR_TITLE: ${{ github.event.client_payload.title || 'No title' }}
PR_REF: ${{ github.event.client_payload.ref || 'main' }}
PR_VERSION: ${{ github.event.client_payload.version || 'wip-version' }}
run: |
# set git info
git config --global user.name "Loft Bot"
git config --global user.email '[email protected]'
pwd
ls
echo "------vcluster-repo-----"
ls ./vcluster-repo
echo "------vcluster-docs-----"
ls ./vcluster-docs
echo "copying..."
cp -r ./vcluster-repo/docs/pages/cli vcluster-docs/vcluster
cd vcluster-docs
git checkout -b "CLI-DOC-$PR_REF"
git add ./vcluster/cli
# if there are no changes, exit early
if git diff-index --quiet HEAD --; then
exit 0
fi
git commit -m "DOC Update from {{ github.event.client_payload.title }}"
git status
git push origin "CLI-DOC-$PR_REF"
gh pr create --base main -t "DOC Update from {{ github.event.client_payload.title }}" --body "Autogenerated PR for CLI docs"