-
Notifications
You must be signed in to change notification settings - Fork 66
72 lines (71 loc) · 2.38 KB
/
autogen-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
name: autogen-docs
run-name: Automatically run GenerateDocs
on:
schedule:
- cron: '45 10 * * TUE'
- cron: '45 10 * * THU'
jobs:
autogen-docs:
runs-on: windows-latest
permissions:
contents: write
defaults:
run:
shell: bash
working-directory: ./generate-docs
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Make the script file executable
run: |
echo "Making script file executable"
chmod +x ./GenerateDocs.sh
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Run GenerateDocs script
run: |
echo "Generating docs"
./GenerateDocs.sh -b DT+
- name: Undo chmod
run: |
echo "Undoing script file chmod"
chmod -x ./GenerateDocs.sh
- name: Get whether autogen-docs branch exists
run: |
echo "Getting whether autogen-docs branch exists"
git config user.name github-actions
git config user.email [email protected]
{
echo 'git_ls_remote_origin_autogen_docs<<EOF'
git ls-remote origin autogen-docs
echo EOF
} >> "$GITHUB_OUTPUT"
id: run_git_ls_remote_origin_autogen_docs
- name: Delete autogen-docs if it exists
if: ${{ contains(steps.run_git_ls_remote_origin_autogen_docs.outputs.git_ls_remote_origin_autogen_docs, '/autogen-docs') }}
run: |
echo "Deleting remote autogen-docs branch"
git push origin --delete autogen-docs
- name: Add any changes
run: |
echo "Determining if there are any changes"
git config user.name github-actions
git config user.email [email protected]
git checkout -b autogen-docs
git add ../.
- name: Run git status
run: |
{
echo 'git_status<<EOF'
git status
echo EOF
} >> "$GITHUB_OUTPUT"
id: run_git_status
- name: Commit and push changes if any
if: ${{ !contains(steps.run_git_status.outputs.git_status, 'nothing to commit, working tree clean') }}
run: |
echo "Committing and pushing changes to autogen-docs branch"
git commit -m "Automatically generated docs"
git push --set-upstream origin autogen-docs