Skip to content

Commit cb7c2f3

Browse files
Merge pull request #75 from amd/alex_doc_update
Documentation update workflow
2 parents 31fee81 + 7b01c0d commit cb7c2f3

File tree

3 files changed

+400
-9
lines changed

3 files changed

+400
-9
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
11+
jobs:
12+
generate_docs:
13+
runs-on: [ self-hosted ]
14+
# To disable this workflow, set DISABLE_AUTO_DOCS to 'true' in repository variables
15+
if: vars.DISABLE_AUTO_DOCS != 'true'
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.9'
27+
28+
- name: Install dependencies
29+
run: ./dev-setup.sh
30+
31+
- name: Run plugin documentation generator
32+
run: |
33+
python docs/generate_plugin_doc_bundle.py \
34+
--package nodescraper.plugins.inband \
35+
--output docs/PLUGIN_DOC.md
36+
37+
- name: Commit and push changes
38+
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

CONTRIBUTING.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff 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+
```

0 commit comments

Comments
 (0)