action.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. name: 'Internal Checklist Validator'
  2. description: 'Validates and enforces completion of internal checklists in issues. Reopens issues and notifies users if required checklist items are not completed.'
  3. runs:
  4. using: "composite"
  5. steps:
  6. - name: 🔁 Reopen issue if checklist is incomplete
  7. uses: actions/github-script@v7
  8. with:
  9. script: |
  10. const issueBody = context.payload.issue.body;
  11. const checklistRegex = /### (?:Internal )?Checklist:[\s\S]*?<details>([\s\S]*?)<\/details>/;
  12. const match = issueBody.match(checklistRegex);
  13. if (!match) {
  14. console.log("Checklist not found. Assuming not required.");
  15. return;
  16. }
  17. const checklist = match[1];
  18. const unchecked = checklist.match(/-\s\[\s\]/g);
  19. if (unchecked && unchecked.length > 0) {
  20. console.log("Checklist is incomplete. Reopening issue.");
  21. await github.rest.issues.update({
  22. owner: context.repo.owner,
  23. repo: context.repo.repo,
  24. issue_number: context.payload.issue.number,
  25. state: "open"
  26. });
  27. await github.rest.issues.createComment({
  28. owner: context.repo.owner,
  29. repo: context.repo.repo,
  30. issue_number: context.payload.issue.number,
  31. body: "Thanks for the update! However, the internal checklist is not yet complete. A Manticore team member will close this issue once everything is checked off. 🛠️"
  32. });
  33. } else {
  34. console.log("Checklist is complete. No action needed.");
  35. }