-
Notifications
You must be signed in to change notification settings - Fork 35
Auto label Copilot agent PRs with "ai: copilot" #2360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: LokmaneKrizou <[email protected]>
Co-authored-by: LokmaneKrizou <[email protected]>
@copilot the solution didn't work. this PR is from copilot agent and it the pr label workflow didn't recognise it as copilot is not set as the author of the PR, check using commits instead, chatgpt suggested this
|
Co-authored-by: LokmaneKrizou <[email protected]>
You're absolutely right! I've implemented the commit-based detection approach you suggested. The new solution:
This is much more robust as it works regardless of who opened the PR and correctly identifies when Copilot was involved in creating the commits. The implementation includes comprehensive logging for debugging and follows the existing workflow patterns. Commit: 8f29822 |
@copilot your solution seems overcomplicated, can't we use existing DangerFile.dif.kts to add the label?
|
Co-authored-by: LokmaneKrizou <[email protected]>
... You're absolutely right! I've moved the Copilot detection logic to the Dangerfile.df.kts as you suggested. This is much cleaner and follows the existing repository patterns. The new implementation:
Commit: c3c2d54 Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
@copilot didn't work , try this
|
…s.createOrAddLabel Co-authored-by: LokmaneKrizou <[email protected]>
... I've implemented your suggested approach using the
Commit: b728f41 |
@copilot abort dangerfile change, lets go back to changing pr.yml and use this
|
…pproach Co-authored-by: LokmaneKrizou <[email protected]>
... I've implemented your suggested approach. The solution now:
This approach is much cleaner and more reliable than the previous API-based solutions. Commit: 5936585 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds automatic labeling functionality for pull requests created by Copilot agents. The workflow job detects Copilot involvement through commit message analysis and applies the "ai: copilot" label when detected.
- Adds a new
CopilotAgent
job to automatically label Copilot agent PRs - Uses git commit message analysis to detect Copilot involvement
- Follows existing workflow patterns for permissions and labeling
Co-authored-by: LokmaneKrizou <[email protected]>
I've reverted to commit 8f29822 and cleaned it up by removing all console.log statements and unnecessary comments. The solution is now optimized and clean while maintaining the same functionality - checking commits for Copilot involvement through author/committer login or co-authored-by trailers. Commit: eadfcd0 |
Adds automatic labeling for pull requests created by Copilot agents with the "ai: copilot" label.
Changes Made
Added a new
CopilotAgent
job to the PR workflow (.github/workflows/pr.yml
) that:Detects Copilot agent PRs by checking multiple indicators:
github-copilot
(e.g.,github-copilot[bot]
)copilot
(e.g.,copilot
,copilot-agent
)Automatically applies the "ai: copilot" label when any indicator is detected
Follows existing patterns - uses the same permissions, app token setup, and GitHub CLI approach as the existing Dependabot labeling logic
Implementation Details
The solution is minimal and follows the repository's established conventions:
The job includes debug output to help with troubleshooting and runs independently of other workflow jobs.
Fixes #2359.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.