-
Notifications
You must be signed in to change notification settings - Fork 95
70 lines (59 loc) · 2.28 KB
/
docs-reminder.yml
File metadata and controls
70 lines (59 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# =============================================================================
# Documentation Reminder
# =============================================================================
#
# TRIGGER:
# When a PR is opened or updated
#
# OUTPUT:
# Comments on PRs tagged with [ENH] if no documentation changes detected.
# This is a reminder, not a blocker.
#
# =============================================================================
name: Documentation Reminder
on:
pull_request:
types: [opened, synchronize]
permissions:
contents: read
pull-requests: write
jobs:
check-docs:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.title, '[ENH]')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for documentation changes
id: docs-check
run: |
DOCS_CHANGED=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -E '^docs/|\.rst$' | wc -l)
echo "docs_changed=$DOCS_CHANGED" >> $GITHUB_OUTPUT
- name: Check for existing reminder comment
if: steps.docs-check.outputs.docs_changed == '0'
id: find-comment
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Documentation Reminder
- name: Comment if no docs and no existing comment
if: steps.docs-check.outputs.docs_changed == '0' && steps.find-comment.outputs.comment-id == ''
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `**Documentation Reminder**
This PR is tagged as \`[ENH]\` but no documentation changes were detected.
Please ensure:
- [ ] Docstrings are added/updated
- [ ] User guide is updated (if applicable)
- [ ] Examples are added (if applicable)
If no documentation is needed, please explain why in the PR description.
---
*This is an automated reminder. You can ignore it if documentation is not applicable.*`
})