-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (62 loc) · 2.15 KB
/
merge-actions.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
on:
push:
branches:
- main
generate_doc:
needs:
- validate
name: Generate the documentation from the JSON Schemas
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04"]
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
id: extract_branch
# - name: Create new branch
# run: |
# git fetch
# git checkout merge/${{ github.run_id }}
- name: Install json-schema-for-humans
run: pip install json-schema-for-humans
- name: Create documentation directory
run: mkdir -p _docs
- name: Generate the documentation
run: |
generate-schema-doc --config template_name=md_nested ./.schema/controller.json ./_docs/controller.md
generate-schema-doc --config template_name=md_nested ./.schema/manufacturer.json ./_docs/manufacturer.md
generate-schema-doc --config template_name=md_nested ./.schema/category.json ./_docs/category.md
# - name: Commit files
# run: |
# git config --local user.email "action@github.com"
# git config --local user.name "GitHub Action"
# git add *
# if ! git diff-index --quiet HEAD; then
# git commit -m "Update documentation" -a
# fi
# - name: push changes
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: merge/${{ github.run_id }}
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
commit-message: |
Update documentation
branch: merge/${{ github.run_id }}
- Name: Merge Pull Request
uses: peter-evans/enable-pull-request-automerge@v3
with:
token: ${{ secrets.PAT }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}