diff --git a/.github/workflows/label-agent-prs.yml b/.github/workflows/label-agent-prs.yml new file mode 100644 index 000000000..b30b52f94 --- /dev/null +++ b/.github/workflows/label-agent-prs.yml @@ -0,0 +1,56 @@ +name: label-agent-prs + +on: + pull_request: + types: + - opened + - reopened + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + label-agent-prs: + if: github.event.pull_request.user.type == 'Bot' || contains(github.event.pull_request.user.login, 'copilot') + runs-on: ubuntu-latest + steps: + - name: Ensure robot label exists + uses: actions/github-script@v7 + with: + script: | + const labelName = 'robot'; + const labelColor = '5319E7'; + const labelDescription = 'Pull request created by a bot or automated agent'; + + try { + await github.rest.issues.getLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: labelName, + }); + } catch (error) { + if (error.status === 404) { + await github.rest.issues.createLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: labelName, + color: labelColor, + description: labelDescription, + }); + } else { + throw error; + } + } + + - name: Add robot label to PR + uses: actions/github-script@v7 + with: + script: | + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['robot'], + }); diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..055d95ba0 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,13 @@ +# AGENTS.md + +## Repository guidance for automated agents + +- Keep changes minimal and focused on the task. +- Preserve existing content structure and frontmatter field names in `content/**/*.md`. +- Do not rename or remove required frontmatter keys. +- For ownership or reviewer changes, update `CODEOWNERS` only when explicitly requested by repo policy. +- Do not change workflows, labels, permissions, branch protection, or automation behavior unless explicitly requested. +- If a change affects repository policy or automation, ask before applying it. +- Prefer existing project patterns and avoid unrelated refactors. +- Before claiming a change is ready, run the repo checks that already exist: `npm test -- --runInBand` and `npm run lint`. +- If you open or update a PR, use a clear description and avoid introducing unrelated files.