-
Notifications
You must be signed in to change notification settings - Fork 532
ci: Create Github Action to Automate CODEOWNER update #1869
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
98f22f8
create github action to automate codeowner change
yzh119 b5fb3db
upd
yzh119 a87e632
upd
yzh119 4e22b6b
upd
yzh119 f8a1a8c
upd
yzh119 d4df395
upd
yzh119 757cb32
upd
yzh119 3934511
upd
yzh119 560b434
Revert "upd"
yzh119 130b8b3
upd
yzh119 3b5e0aa
upd
yzh119 c402730
test: switch to pull_request with FLASHINFER_GITHUB_TOKEN
yzh119 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Update CODEOWNERS | ||
|
||
on: | ||
schedule: | ||
# Run weekly on Monday at 00:00 UTC | ||
- cron: '0 0 * * 1' | ||
workflow_dispatch: # Allow manual triggering | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
update-codeowners: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 # Fetch full history for accurate analysis | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Run CODEOWNERS analyzer | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
python scripts/codeowner_analyzer.py \ | ||
--output .github/CODEOWNERS \ | ||
--depth 3 \ | ||
--min-commits 2 \ | ||
--days-back 365 | ||
|
||
- name: Check for changes | ||
id: check_changes | ||
run: | | ||
if git diff --quiet .github/CODEOWNERS; then | ||
echo "changed=false" >> $GITHUB_OUTPUT | ||
echo "No changes detected in CODEOWNERS" | ||
else | ||
echo "changed=true" >> $GITHUB_OUTPUT | ||
echo "Changes detected in CODEOWNERS" | ||
fi | ||
|
||
- name: Create Pull Request | ||
if: steps.check_changes.outputs.changed == 'true' | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: | | ||
chore: update CODEOWNERS based on git history | ||
|
||
Auto-generated CODEOWNERS update based on commit activity over the last 365 days. | ||
|
||
π€ Generated with [Claude Code](https://claude.com/claude-code) | ||
|
||
Co-Authored-By: Claude <[email protected]> | ||
branch: auto-update-codeowners | ||
delete-branch: true | ||
title: 'chore: Update CODEOWNERS' | ||
body: | | ||
## Summary | ||
|
||
This PR updates the CODEOWNERS file based on git commit history analysis from the last 365 days. | ||
|
||
## Changes | ||
|
||
- Updated `.github/CODEOWNERS` with current code ownership based on: | ||
- Commit frequency | ||
- File coverage | ||
- Commit recency | ||
|
||
## How to Review | ||
|
||
1. Review the changes to `.github/CODEOWNERS` | ||
2. Verify that the assigned owners are appropriate for each module | ||
3. Make manual adjustments if needed before merging | ||
|
||
## Notes | ||
|
||
- This is an automated PR generated weekly | ||
- Minimum commits threshold: 2 | ||
- Analysis period: 365 days | ||
- Directory depth: 3 levels | ||
|
||
--- | ||
|
||
π€ This PR was automatically generated by the [update-codeowners workflow](.github/workflows/update-codeowners.yml) | ||
labels: | | ||
automated | ||
maintenance | ||
assignees: | | ||
|
||
reviewers: | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It's good practice to validate input parameters. The
max_depth
should be a positive integer. A value of 0 or less would result in no modules being detected, which might be unexpected. Consider adding a check to ensuremax_depth
is positive.