File tree Expand file tree Collapse file tree 3 files changed +403
-9
lines changed
Expand file tree Collapse file tree 3 files changed +403
-9
lines changed Original file line number Diff line number Diff line change 1+ # Workflow to run plugin documentation generation then commit the updated changes
2+
3+ name : Plugin Documentation Generator
4+
5+ permissions :
6+ contents : write
7+
8+ on :
9+ workflow_dispatch :
10+ schedule :
11+ - cron : ' 0 0 * * *'
12+
13+ jobs :
14+ generate_docs :
15+ runs-on : [ self-hosted ]
16+ # To disable this workflow, set DISABLE_AUTO_DOCS to 'true' in repository variables
17+ if : vars.DISABLE_AUTO_DOCS != 'true'
18+
19+ steps :
20+ - name : Checkout repository
21+ uses : actions/checkout@v4
22+ with :
23+ token : ${{ secrets.GITHUB_TOKEN }}
24+
25+ - name : Install dependencies
26+ run : ./dev-setup.sh
27+
28+ - name : Run plugin documentation generator
29+ run : |
30+ source venv/bin/activate
31+ python docs/generate_plugin_doc_bundle.py \
32+ --package nodescraper.plugins.inband \
33+ --output docs/PLUGIN_DOC.md
34+
35+ - name : Format documentation with pre-commit
36+ run : |
37+ source venv/bin/activate
38+ pre-commit run --files docs/PLUGIN_DOC.md || true
39+
40+ - name : Commit and push changes
41+ run : |
42+ git config user.name "github-actions[bot]"
43+ git config user.email "github-actions[bot]@users.noreply.github.com"
44+ git add docs/PLUGIN_DOC.md
45+ git diff --staged --quiet || git commit --no-verify -m "docs: Update plugin documentation [automated]"
46+ git push
Original file line number Diff line number Diff line change @@ -52,8 +52,41 @@ When creating a PR, use the following process.
5252> By creating a PR, you agree to allow your contribution to be licensed under the
5353> terms of the LICENSE.txt file.
5454
55- ### Documentation
55+ ### Pre-commit hooks
5656
57- Submit Node Scraper documentation changes to our
58- [ documentation] ( https://github.com/amd/node-scraper/blob/development/README.md ) . You must update
59- documentation related to any new feature or API contribution.
57+ This repository uses [ pre-commit] ( https://pre-commit.com/ ) to automatically format code. When you commit changes to plugin files, the hooks will:
58+
59+ 1 . Run code formatters (ruff, black)
60+ 2 . Run type checking (mypy)
61+
62+ #### Setup
63+
64+ Install pre-commit hooks after cloning the repository:
65+
66+ ``` bash
67+ # Activate your virtual environment
68+ source venv/bin/activate
69+
70+ # Install pre-commit hooks
71+ pre-commit install
72+ ```
73+
74+ #### Usage
75+
76+ The hooks run automatically when you commit.
77+
78+ ``` bash
79+ # First commit attempt - hooks run and may modify files
80+ git commit -m " Add new plugin feature"
81+
82+ # If hooks modified files, stage them and commit again
83+ git add .
84+ git commit -m " Add new plugin feature"
85+ ```
86+
87+ You can also run hooks manually:
88+
89+ ``` bash
90+ # Run all hooks on all files
91+ pre-commit run --all-files
92+ ```
You can’t perform that action at this time.
0 commit comments