From 588463ec65a77b134a8b964d7a8948094288b738 Mon Sep 17 00:00:00 2001 From: Tomas Weiss Date: Mon, 10 Nov 2025 11:51:25 +0100 Subject: [PATCH 1/5] chore: docs workflow Signed-off-by: Tomas Weiss --- .github/pull_request_template.md | 8 +++++ .github/workflows/docs-check.yaml | 60 +++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/docs-check.yaml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..bf81adf64 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,8 @@ +## Summary + + +## Documentation +- [ ] Docs updated +- [ ] No Docs Needed: + +If this PR adds new APIs, features, or changes existing behavior, you must update `/docs` accordingly. \ 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..ef689bdd2 --- /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 + + # 1️⃣ Get PR body + - name: Get PR body + id: get_pr + uses: actions/github-script@v7 + with: + script: | + const body = context.payload.pull_request.body || ""; + core.setOutput("body", body); + + # 2️⃣ Check if "No Docs Needed" is checked + - name: Check for No Docs Needed checkbox + id: skip + run: | + BODY="${{ steps.get_pr.outputs.body }}" + echo "$BODY" > pr_body.txt + + 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 + + # 3️⃣ Get changed files + - name: Get changed files + run: | + git fetch origin main + git diff --name-only origin/main...HEAD > changed_files.txt + cat changed_files.txt + + # 4️⃣ Enforce docs update unless skipped + - 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 -q '^docs/' 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 From 0b5f23a9ec0394161330c4374ed3fbac95c997df Mon Sep 17 00:00:00 2001 From: Tomas Weiss Date: Mon, 10 Nov 2025 11:58:28 +0100 Subject: [PATCH 2/5] fix: better quoting Signed-off-by: Tomas Weiss --- .github/workflows/docs-check.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs-check.yaml b/.github/workflows/docs-check.yaml index ef689bdd2..7256e6e6b 100644 --- a/.github/workflows/docs-check.yaml +++ b/.github/workflows/docs-check.yaml @@ -2,6 +2,7 @@ name: Docs Check on: pull_request: + # types: [ready_for_review] types: [opened, synchronize, reopened, edited] jobs: @@ -20,16 +21,15 @@ jobs: 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); # 2️⃣ Check if "No Docs Needed" is checked - name: Check for No Docs Needed checkbox id: skip run: | - BODY="${{ steps.get_pr.outputs.body }}" - echo "$BODY" > pr_body.txt - if grep -Eiq '\[x\].*no docs needed' pr_body.txt; then echo "🟡 'No Docs Needed' checked — skipping docs enforcement." echo "skip=true" >> $GITHUB_OUTPUT From b42bb1367b032296d3a0db0c74ad1d31d3cc0127 Mon Sep 17 00:00:00 2001 From: Tomas Weiss Date: Mon, 10 Nov 2025 12:04:59 +0100 Subject: [PATCH 3/5] fix: better git habndling Signed-off-by: Tomas Weiss --- .github/workflows/docs-check.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs-check.yaml b/.github/workflows/docs-check.yaml index 7256e6e6b..6a208ebf1 100644 --- a/.github/workflows/docs-check.yaml +++ b/.github/workflows/docs-check.yaml @@ -40,8 +40,13 @@ jobs: # 3️⃣ Get changed files - name: Get changed files run: | - git fetch origin main - git diff --name-only origin/main...HEAD > changed_files.txt + 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 # 4️⃣ Enforce docs update unless skipped From 8e8b2d9a07bff02680ba55e888479c0a43c6a6ec Mon Sep 17 00:00:00 2001 From: Tomas Weiss Date: Mon, 10 Nov 2025 12:21:41 +0100 Subject: [PATCH 4/5] chore: improve PR template Signed-off-by: Tomas Weiss --- .github/pull_request_template.md | 8 ++++++-- .github/workflows/docs-check.yaml | 5 ----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index bf81adf64..17e9be802 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,8 +1,12 @@ ## Summary +## Linked Issues + + + + ## Documentation -- [ ] Docs updated - [ ] No Docs Needed: -If this PR adds new APIs, features, or changes existing behavior, you must update `/docs` accordingly. \ No newline at end of file +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 index 6a208ebf1..0b1e4ca98 100644 --- a/.github/workflows/docs-check.yaml +++ b/.github/workflows/docs-check.yaml @@ -2,7 +2,6 @@ name: Docs Check on: pull_request: - # types: [ready_for_review] types: [opened, synchronize, reopened, edited] jobs: @@ -15,7 +14,6 @@ jobs: steps: - uses: actions/checkout@v4 - # 1️⃣ Get PR body - name: Get PR body id: get_pr uses: actions/github-script@v7 @@ -26,7 +24,6 @@ jobs: fs.writeFileSync('pr_body.txt', body, 'utf8'); core.setOutput("body", body); - # 2️⃣ Check if "No Docs Needed" is checked - name: Check for No Docs Needed checkbox id: skip run: | @@ -37,7 +34,6 @@ jobs: echo "skip=false" >> $GITHUB_OUTPUT fi - # 3️⃣ Get changed files - name: Get changed files run: | git fetch origin ${{ github.event.pull_request.base.ref }} @@ -49,7 +45,6 @@ jobs: fi cat changed_files.txt - # 4️⃣ Enforce docs update unless skipped - name: Enforce docs update run: | if [ "${{ steps.skip.outputs.skip }}" = "true" ]; then From 2bf032e642de2d35ff7cb6549070d64d33f10d3c Mon Sep 17 00:00:00 2001 From: Tomas Weiss Date: Mon, 10 Nov 2025 12:29:12 +0100 Subject: [PATCH 5/5] chore: provide docs Signed-off-by: Tomas Weiss --- .github/workflows/docs-check.yaml | 2 +- CONTRIBUTING.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs-check.yaml b/.github/workflows/docs-check.yaml index 0b1e4ca98..824c1721d 100644 --- a/.github/workflows/docs-check.yaml +++ b/.github/workflows/docs-check.yaml @@ -52,7 +52,7 @@ jobs: exit 0 fi - if grep -q '^docs/' changed_files.txt; then + 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." 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.