diff --git a/.github/workflows/ai-policy.yml b/.github/workflows/ai-policy.yml new file mode 100644 index 0000000..9bbd513 --- /dev/null +++ b/.github/workflows/ai-policy.yml @@ -0,0 +1,32 @@ +name: AI tools policy + +on: + issues: + types: [labeled] + # Labeling a pull request triggers no event whose token can close one + # from a fork without pull_request_target, so an hourly run picks them up. + schedule: + - cron: "17 * * * *" + +permissions: + issues: write + pull-requests: write + +jobs: + close: + if: github.event_name == 'schedule' || github.event.label.name == 'slop' + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + COMMENT: Closed under the [AI tools policy](https://github.com/publiccodeyml/publiccode.yml/blob/main/AI_POLICY.md). + steps: + - run: | + for n in $(gh issue list --label slop --state open --json number --jq '.[].number'); do + gh issue close "$n" --reason "not planned" --comment "$COMMENT" + gh issue lock "$n" + done + for n in $(gh pr list --label slop --state open --json number --jq '.[].number'); do + gh pr close "$n" --comment "$COMMENT" + gh pr lock "$n" + done diff --git a/AI_POLICY.md b/AI_POLICY.md index 128737b..dc3f27d 100644 --- a/AI_POLICY.md +++ b/AI_POLICY.md @@ -27,3 +27,9 @@ We do not run AI detectors and writing style is not evidence. Detectors misfire on people who write in a second language, as most of this community does. A maintainer acts on what the content shows, for example code or claims the author cannot explain. + +## Automation + +When a maintainer adds the `slop` label to an issue or a pull request, +a workflow links this policy, then closes and locks it. Issues are +closed right away, pull requests within the hour.