|
1 | | -# Workflow to run plugin documentation generation then commit the updated changes |
| 1 | +# Workflow to run plugin documentation generation then create a PR with the updated changes |
2 | 2 |
|
3 | 3 | name: Plugin Documentation Generator |
4 | 4 |
|
5 | 5 | permissions: |
6 | 6 | contents: write |
| 7 | + pull-requests: write |
7 | 8 |
|
8 | 9 | on: |
9 | 10 | workflow_dispatch: |
| 11 | + schedule: |
| 12 | + - cron: '0 0 * * *' |
10 | 13 |
|
11 | 14 | jobs: |
12 | 15 | generate_docs: |
13 | 16 | runs-on: [ self-hosted ] |
14 | 17 | # To disable this workflow, set DISABLE_AUTO_DOCS to 'true' in repository variables |
15 | 18 | if: vars.DISABLE_AUTO_DOCS != 'true' |
| 19 | + env: |
| 20 | + HOME: /tmp/github-actions-home |
16 | 21 |
|
17 | 22 | steps: |
| 23 | + - name: Setup HOME directory |
| 24 | + run: | |
| 25 | + mkdir -p /tmp/github-actions-home |
| 26 | + export HOME=/tmp/github-actions-home |
| 27 | +
|
18 | 28 | - name: Checkout repository |
19 | 29 | uses: actions/checkout@v4 |
20 | 30 | with: |
21 | 31 | token: ${{ secrets.GITHUB_TOKEN }} |
22 | 32 |
|
23 | | - - name: Set up Python |
24 | | - uses: actions/setup-python@v5 |
25 | | - with: |
26 | | - python-version: '3.9' |
27 | | - |
28 | 33 | - name: Install dependencies |
29 | 34 | run: ./dev-setup.sh |
30 | 35 |
|
31 | 36 | - name: Run plugin documentation generator |
32 | 37 | run: | |
| 38 | + source venv/bin/activate |
33 | 39 | python docs/generate_plugin_doc_bundle.py \ |
34 | 40 | --package nodescraper.plugins.inband \ |
35 | 41 | --output docs/PLUGIN_DOC.md |
36 | 42 |
|
37 | | - - name: Commit and push changes |
| 43 | + - name: Format documentation with pre-commit |
38 | 44 | run: | |
39 | | - git config --global user.name "github-actions[bot]" |
40 | | - git config --global user.email "github-actions[bot]@users.noreply.github.com" |
41 | | - git add docs/PLUGIN_DOC.md |
42 | | - git diff --staged --quiet || git commit -m "docs: Update plugin documentation [automated]" |
43 | | - git push |
| 45 | + source venv/bin/activate |
| 46 | + pre-commit run --files docs/PLUGIN_DOC.md || true |
| 47 | +
|
| 48 | + - name: Create Pull Request |
| 49 | + uses: peter-evans/create-pull-request@v6 |
| 50 | + with: |
| 51 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + commit-message: "docs: Update plugin documentation [automated]" |
| 53 | + committer: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>" |
| 54 | + author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>" |
| 55 | + branch: automated-plugin-docs-update |
| 56 | + delete-branch: true |
| 57 | + title: "docs: Update plugin documentation [automated]" |
| 58 | + body: | |
| 59 | + Automated plugin documentation update generated by workflow. |
| 60 | +
|
| 61 | + This PR was automatically created by the Plugin Documentation Generator workflow. |
| 62 | + labels: documentation,automated |
0 commit comments