Skip to content

Commit a2bd7b1

Browse files
tomkisedengilbert
authored andcommitted
chore: docs workflow (i-am-bee#1502)
* chore: docs workflow Signed-off-by: Tomas Weiss <[email protected]> * fix: better quoting Signed-off-by: Tomas Weiss <[email protected]> * fix: better git habndling Signed-off-by: Tomas Weiss <[email protected]> * chore: improve PR template Signed-off-by: Tomas Weiss <[email protected]> * chore: provide docs Signed-off-by: Tomas Weiss <[email protected]> --------- Signed-off-by: Tomas Weiss <[email protected]> Signed-off-by: Eden Gilbert <[email protected]>
1 parent 1a9cb2a commit a2bd7b1

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

.github/pull_request_template.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Summary
2+
<!-- Briefly describe what this PR changes -->
3+
4+
## Linked Issues
5+
<!-- Make sure the linked issue is always provided eg: -->
6+
<!-- Closes #XYZ, Fixes #XYZ, Resolves #XYZ -->
7+
8+
9+
## Documentation
10+
- [ ] No Docs Needed:
11+
12+
If this PR adds new feature or changes existing. Make sure documentation is adjusted accordingly. If the docs is not needed, please explain why.

.github/workflows/docs-check.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Docs Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited]
6+
7+
jobs:
8+
docs-check:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: read
12+
contents: read
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Get PR body
18+
id: get_pr
19+
uses: actions/github-script@v7
20+
with:
21+
script: |
22+
const fs = require('fs');
23+
const body = context.payload.pull_request.body || "";
24+
fs.writeFileSync('pr_body.txt', body, 'utf8');
25+
core.setOutput("body", body);
26+
27+
- name: Check for No Docs Needed checkbox
28+
id: skip
29+
run: |
30+
if grep -Eiq '\[x\].*no docs needed' pr_body.txt; then
31+
echo "🟡 'No Docs Needed' checked — skipping docs enforcement."
32+
echo "skip=true" >> $GITHUB_OUTPUT
33+
else
34+
echo "skip=false" >> $GITHUB_OUTPUT
35+
fi
36+
37+
- name: Get changed files
38+
run: |
39+
git fetch origin ${{ github.event.pull_request.base.ref }}
40+
if git diff --name-only origin/${{ github.event.pull_request.base.ref }}..HEAD > changed_files.txt 2>/dev/null; then
41+
echo "✅ Found changed files"
42+
else
43+
echo "⚠️ Could not determine changed files, using empty list"
44+
echo "" > changed_files.txt
45+
fi
46+
cat changed_files.txt
47+
48+
- name: Enforce docs update
49+
run: |
50+
if [ "${{ steps.skip.outputs.skip }}" = "true" ]; then
51+
echo "🟡 Skipping docs check (No Docs Needed checked)."
52+
exit 0
53+
fi
54+
55+
if grep -qE '^(docs/|CONTRIBUTING\.md$|README\.md$|CODE_OF_CONDUCT\.md$)' changed_files.txt; then
56+
echo "✅ Docs updated."
57+
else
58+
echo "❌ No docs changes found and 'No Docs Needed' not checked."
59+
exit 1
60+
fi

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,9 @@ Use the release script:
331331
mise run release
332332
```
333333

334+
335+
## Documentation
336+
337+
All changes that modify existing features or introduce new functionality must include documentation updates as part of the pull request. Documentation files should be added or updated in the `docs` folder.
338+
339+
A GitHub workflow automatically checks that documentation requirements are met. If your change does not require documentation updates (e.g., bug fixes that don't change behavior, internal refactoring, or test-only changes), you must explicitly note this in your PR description.

0 commit comments

Comments
 (0)