forked from arcalot/arcaflow-docsgen
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (66 loc) · 2.33 KB
/
reusable_workflow.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
74
75
76
77
78
name: Arcaflow Docsgen Python Plugin
on:
workflow_call:
inputs:
plugin_path:
required: true
type: string
jobs:
docsgen-python:
name: Comparing ${{ github.ref_name }} docs from ${{ github.event_name }}
runs-on: ubuntu-latest
steps:
- name: Checkout this project
uses: actions/checkout@v4
- name: Install arcaflow-docsgen
env:
DOCSGEN_VER: "0.3.3"
run: |
wget https://github.com/arcalot/arcaflow-docsgen/releases/download/v${{env.DOCSGEN_VER}}/arcaflow-docsgen_${{env.DOCSGEN_VER}}_linux_amd64.tar.gz \
&& tar -C /usr/local/bin -xzf arcaflow-docsgen_${{env.DOCSGEN_VER}}_linux_amd64.tar.gz
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.9.16
- name: Install poetry
run: |
python -m pip install poetry==1.4.2
- name: Configure poetry
run: |
python -m poetry config virtualenvs.in-project true
- name: Cache the virtualenv
uses: actions/cache@v4
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
python -m poetry install
- name: Generate schema yaml
run: |
python -m poetry run python ./${{ inputs.plugin_path }} --schema > schema.yaml
- name: Create temp readme
run: |
cp README.md README_TMP.md
- name: Run arcaflow-docsgen
run: |
python -m poetry run arcaflow-docsgen -markdown README_TMP.md -schema schema.yaml
- name: Determine diff
run: |
set +e
diff README.md README_TMP.md > arcaflow-docsgen.diff
set -e
echo "README_DIFF=$(cat arcaflow-docsgen.diff | wc -l)" >> $GITHUB_ENV
- name: Update README.md if necessary
if: env.README_DIFF != 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_EMAIL: [email protected]
GH_USERNAME: arcabot
run: |
mv README_TMP.md README.md
git config --global user.name $GH_USERNAME
git config --global user.email $GH_EMAIL
git add README.md
git commit -m 'Automatic update of README.md by arcaflow-docsgen arcabot'
git push