diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..17e9be802 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,12 @@ +## Summary + + +## Linked Issues + + + + +## Documentation +- [ ] No Docs Needed: + +If this PR adds new feature or changes existing. Make sure documentation is adjusted accordingly. If the docs is not needed, please explain why. \ No newline at end of file diff --git a/.github/workflows/docs-check.yaml b/.github/workflows/docs-check.yaml new file mode 100644 index 000000000..824c1721d --- /dev/null +++ b/.github/workflows/docs-check.yaml @@ -0,0 +1,60 @@ +name: Docs Check + +on: + pull_request: + types: [opened, synchronize, reopened, edited] + +jobs: + docs-check: + runs-on: ubuntu-latest + permissions: + pull-requests: read + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Get PR body + id: get_pr + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const body = context.payload.pull_request.body || ""; + fs.writeFileSync('pr_body.txt', body, 'utf8'); + core.setOutput("body", body); + + - name: Check for No Docs Needed checkbox + id: skip + run: | + if grep -Eiq '\[x\].*no docs needed' pr_body.txt; then + echo "🟡 'No Docs Needed' checked — skipping docs enforcement." + echo "skip=true" >> $GITHUB_OUTPUT + else + echo "skip=false" >> $GITHUB_OUTPUT + fi + + - name: Get changed files + run: | + git fetch origin ${{ github.event.pull_request.base.ref }} + if git diff --name-only origin/${{ github.event.pull_request.base.ref }}..HEAD > changed_files.txt 2>/dev/null; then + echo "✅ Found changed files" + else + echo "⚠️ Could not determine changed files, using empty list" + echo "" > changed_files.txt + fi + cat changed_files.txt + + - name: Enforce docs update + run: | + if [ "${{ steps.skip.outputs.skip }}" = "true" ]; then + echo "🟡 Skipping docs check (No Docs Needed checked)." + exit 0 + fi + + if grep -qE '^(docs/|CONTRIBUTING\.md$|README\.md$|CODE_OF_CONDUCT\.md$)' changed_files.txt; then + echo "✅ Docs updated." + else + echo "❌ No docs changes found and 'No Docs Needed' not checked." + exit 1 + fi \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d75a358cc..2eb0717e3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -331,3 +331,9 @@ Use the release script: mise run release ``` + +## Documentation + +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. + +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.