diff --git a/.github/workflows/ai-disclosure-gate.yml b/.github/workflows/ai-disclosure-gate.yml new file mode 100644 index 0000000000..acff2b260a --- /dev/null +++ b/.github/workflows/ai-disclosure-gate.yml @@ -0,0 +1,25 @@ +name: ai-disclosure-gate + +permissions: + contents: read + pull-requests: read + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + check: + runs-on: ubuntu-latest + name: AI disclosure gate + steps: + - name: Block merge while AI_AGENT_DISCLOSURE.md is present + env: + GH_TOKEN: ${{ github.token }} + run: | + files=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --paginate --jq '.[] | select(.status != "removed") | .filename') + if echo "$files" | grep -qE '(^|/)AI_AGENT_DISCLOSURE\.md$'; then + echo "::error::This pull request contains AI_AGENT_DISCLOSURE.md, which states the change may not have been independently reviewed or tested by its human submitter. Please review the code your AI agent produced yourself, then remove the file from the commits (amend/rebase) to confirm that manual review took place. The merge stays blocked while the file is present." + exit 1 + fi + echo "No AI_AGENT_DISCLOSURE.md in this pull request."