Add policy to restrict Approved-LowRisk label#26728
Conversation
Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds a GitHub policy automation file to restrict the Approved-LowRisk label to authorized maintainers only. When an unauthorized user adds this label to a PR, the policy automatically removes it and posts an explanatory message.
Changes:
- Adds
.github/policies/labelAdded.approvedLowRisk.ymlwith event responder configuration that monitors forApproved-LowRisklabel additions, validates authorization, and takes removal actions if unauthorized
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Unauthorized = NOT admin AND NOT in explicit allowlist | ||
| - not: | ||
| or: | ||
| - activitySenderHasPermission: | ||
| permission: Admin |
There was a problem hiding this comment.
The PR description states that allowed users include "Repository members with Admin permissions" and users in the allowlist. However, the original prompt in the PR description includes both Admin and Write permissions in the authorization check, while the current implementation only checks for Admin permission.
The original prompt specified:
- activitySenderHasPermission:
permission: Admin
- activitySenderHasPermission:
permission: WriteBut the current implementation only has:
- activitySenderHasPermission:
permission: AdminThis means users with Write permission (who are not in the explicit allowlist) will have the label removed, even though the original specification intended to allow them. Please clarify whether Write permission holders should be authorized to use this label, and if so, add the missing permission check.
Adds automation to restrict the
Approved-LowRisklabel to authorized maintainers. Unauthorized additions are automatically removed with a reply message.Changes
.github/policies/labelAdded.approvedLowRisk.ymlwith event responder that:Approved-LowRisklabel added to open PRsAuthorization
Allowed users:
iSazonov,daxian-dbwTravisEz13,adityapatwardhan,jshigetomiPolicy Structure
Original prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.