enforce-issue-labels.yml 1001 B

123456789101112131415161718192021222324252627282930
  1. name: Enforce issue templates
  2. on:
  3. issues:
  4. types:
  5. - opened
  6. permissions:
  7. issues: write
  8. jobs:
  9. enforce-issue-labels:
  10. name: Enforce Issue Labels
  11. runs-on: ubuntu-slim
  12. if: github.event.issue.labels[0] == null
  13. steps:
  14. - name: Close new issues without labels
  15. env:
  16. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  17. GH_REPO: ${{ github.repository }}
  18. NUMBER: ${{ github.event.issue.number }}
  19. COMMENT: >
  20. This issue is being closed automatically because it was not opened using one of the provided forms.
  21. Please note that we do not permit the use of AI agents to submit issues on a user's behalf.
  22. You can resubmit the issue using one of the [available issue forms](${{ github.server_url }}/${{ github.repository }}/issues/new/choose).
  23. Thanks!
  24. run: |
  25. gh issue close "$NUMBER" --reason "not planned" --comment "$COMMENT"
  26. gh issue lock "$NUMBER" --reason off_topic