Skip to content

Update CODEOWNERS

Update CODEOWNERS #5

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
env:
DEPTH: 3
MIN_COMMITS: 1
DAYS_BACK: 180
TOP_N: 5
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
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 ${{ env.DEPTH }} \
--min-commits ${{ env.MIN_COMMITS }} \
--days-back ${{ env.DAYS_BACK }} \
--top-n ${{ env.TOP_N }} \
--allowed-users-file scripts/authorized_codeowner.txt
- name: Check for changes
id: check_changes
run: |
# Check if CODEOWNERS file is new (unstaged) or has changes
if git ls-files --error-unmatch .github/CODEOWNERS >/dev/null 2>&1; then
# File is tracked, check for changes
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
else
# File is untracked (newly created)
echo "changed=true" >> $GITHUB_OUTPUT
echo "CODEOWNERS file is new"
fi
- name: Create Pull Request
if: steps.check_changes.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.FLASHINFER_BOT_TOKEN }}
committer: flashinfer-bot <flashinfer-bot@users.noreply.github.com>
author: flashinfer-bot <flashinfer-bot@users.noreply.github.com>
commit-message: |
chore: update CODEOWNERS based on git history
Auto-generated CODEOWNERS update based on commit activity over the last ${{ env.DAYS_BACK }} days.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
branch: auto-update-codeowners
base: main
delete-branch: true
title: 'chore: Update CODEOWNERS'
body: |
## Summary
This PR updates the CODEOWNERS file based on git commit history analysis from the last ${{ env.DAYS_BACK }} 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: ${{ env.MIN_COMMITS }}
- Analysis period: ${{ env.DAYS_BACK }} days
- Directory depth: ${{ env.DEPTH }} levels
- Top N owners per module: ${{ env.TOP_N }}
---
🤖 This PR was automatically generated by the [update-codeowners workflow](.github/workflows/update-codeowners.yml)
labels: |
automated
maintenance
assignees: |
reviewers: |