Skip to content

Commit 2c791ec

Browse files
committed
feat: documentation action
1 parent 6be64e9 commit 2c791ec

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Update Documentation"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
8+
jobs:
9+
generate:
10+
runs-on: ubuntu-latest
11+
environment: documentation
12+
if: "github.ref == 'refs/heads/main'"
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Generate Documentation
17+
uses: devcontainers/action@v1
18+
with:
19+
generate-docs: "true"
20+
base-path-to-features: "./src"
21+
22+
- name: Create a PR for Documentation
23+
id: push_image_info
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.PAT }}
26+
run: |
27+
set -e
28+
echo "Start."
29+
30+
# Configure git and Push updates
31+
git config --global user.email [email protected]
32+
git config --global user.name github-actions
33+
git config pull.rebase false
34+
35+
branch=automated-documentation-update-$GITHUB_RUN_ID
36+
git checkout -b $branch
37+
message='Automated documentation update'
38+
39+
# Add / update and commit
40+
git add */**/README.md
41+
git commit -m 'Automated documentation update [skip ci]' || export NO_UPDATES=true
42+
43+
# Push
44+
if [ "$NO_UPDATES" != "true" ] ; then
45+
git push origin "$branch"
46+
gh api \
47+
--method POST \
48+
-H "Accept: application/vnd.github+json" \
49+
/repos/${GITHUB_REPOSITORY}/pulls \
50+
-f title="$message" \
51+
-f body="$message" \
52+
-f head="$branch" \
53+
-f base='main'
54+
fi

0 commit comments

Comments
 (0)