Ver Fonte

Customize the comment posted when auto-closing unlabeled issues

Replace the ldez/no-blank-issue action, which hardcodes its comment, with
an inline gh step. Drop the reopened trigger so maintainers can reopen an
auto-closed issue, and note in AGENTS.md that agents must not open issues
on a user's behalf.
Jeremy Stretch há 2 dias atrás
pai
commit
aa84381f09

+ 30 - 0
.github/workflows/enforce-issue-labels.yml

@@ -0,0 +1,30 @@
+name: Enforce issue templates
+
+on:
+  issues:
+    types:
+      - opened
+
+permissions:
+  issues: write
+
+jobs:
+  enforce-issue-labels:
+    name: Enforce Issue Labels
+    runs-on: ubuntu-slim
+    if: github.event.issue.labels[0] == null
+
+    steps:
+      - name: Close new issues without labels
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          GH_REPO: ${{ github.repository }}
+          NUMBER: ${{ github.event.issue.number }}
+          COMMENT: >
+            This issue is being closed automatically because it was not opened using one of the provided forms.
+            Please note that we do not permit the use of AI agents to submit issues on a user's behalf.
+            You can resubmit the issue using one of the [available issue forms](${{ github.server_url }}/${{ github.repository }}/issues/new/choose).
+            Thanks!
+        run: |
+          gh issue close "$NUMBER" --reason "not planned" --comment "$COMMENT"
+          gh issue lock "$NUMBER" --reason off_topic

+ 0 - 21
.github/workflows/no-blank-issue.yml

@@ -1,21 +0,0 @@
-name: Enforce issue templates
-
-on:
-  issues:
-    types:
-      - opened
-      - reopened
-
-permissions:
-  issues: write
-
-jobs:
-  no-blank-issue:
-    name: No Blank Issue
-    runs-on: ubuntu-slim
-
-    steps:
-      - name: Close new issues without labels
-        uses: ldez/no-blank-issue@800e2d0c81c9e0ca7bdb58f3e7480a74602d91e0  # v1.2.0
-        with:
-          github-token: ${{ secrets.GITHUB_TOKEN }}

+ 1 - 0
AGENTS.md

@@ -273,6 +273,7 @@ All contributions must comply with the project's [AI policy](AI_POLICY.md). In s
 - AI tools may be used to explore the codebase and to generate code.
 - The contributor must fully understand, and be able to explain, every change submitted.
 - Issues, pull request descriptions, and comments must be written in the contributor's own voice. Anything you draft for these is a starting point for the contributor to review and rewrite: keep it brief and plain, and say so when handing it over.
+- Never open a GitHub issue on the contributor's behalf (e.g. via `gh issue create` or the API). The contributor must submit it themselves using one of the [issue forms](https://github.com/netbox-community/netbox/issues/new/choose); issues opened any other way are closed automatically.
 
 ## Branch & PR Conventions