Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create check-undocumented-issues.yml #1906

Merged
merged 7 commits into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/check-undocumented-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Check Undocumented Issues

on:
issues:
types: [opened]

jobs:
check-issue-content:
runs-on: ubuntu-latest
permissions:
issues: write

steps:
- name: Check issue content
uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue;

// Get the issue body and title
const body = issue.body || '';
const title = issue.title || '';

// Check if this is a docs update request
const isDocsRequest = title.startsWith('Docs update request:');

if (!isDocsRequest) {
return;
}

// Split body into lines and remove empty ones
const bodyLines = body.split('\n').filter(line => line.trim());

// Check if only contains the template content
const hasOnlyTemplate =
bodyLines.length <= 3 && // Updated to match 3 lines
bodyLines[0]?.startsWith('Source:') &&
bodyLines[1]?.startsWith('Request: (how can we help?)') &&
bodyLines[2]?.includes('Psst, this issue will be closed'); // Added check for the warning message

if (hasOnlyTemplate) {
// Close the issue with a comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: 'This issue is being closed automatically as it appears to be an empty documentation update request. Please provide specific details about what needs to be updated or improved in the documentation. You can create a new issue with more details if needed.\n\nSome helpful details to include:\n- What specific part of the documentation needs updating?\n- What is unclear or missing?\n- What would make the documentation more helpful?\n\nThank you for helping us improve our documentation!'
});

await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: 'closed',
state_reason: 'not_planned'
});
}
Loading