-
Notifications
You must be signed in to change notification settings - Fork 895
ci: Create Github Action to Automate CODEOWNER update #1870
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
Changes from all commits
98f22f8
b5fb3db
a87e632
4e22b6b
f8a1a8c
d4df395
757cb32
3934511
560b434
130b8b3
3b5e0aa
c402730
f038549
9cc7e98
7547693
86c78ed
363e3f0
0961939
823ce14
55bc90e
e2c4f7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,118 @@ | ||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
Comment on lines
+35
to
+45
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Authenticate gh with GH_TOKEN, not just GITHUB_TOKEN The analyzer calls Apply: - name: Run CODEOWNERS analyzer
env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # optional, keeps other tooling happy
run: |
python scripts/codeowner_analyzer.py \
--output .github/CODEOWNERS \
--depth 3 \
--min-commits 1 \
--days-back 180 \
--top-n 5 \
--allowed-users-file scripts/authorized_codeowner.txtπ€ Prompt for AI Agents |
||||||||||||||||||||||||||||
| - 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 | ||||||||||||||||||||||||||||
|
Comment on lines
+72
to
+80
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove external vendor branding from commit body Commit message body includes references to βClaude Codeβ and βCo-Authored-By: Claude.β Prefer neutral/firstβparty wording to avoid brand/legal noise. commit-message: |
chore: update CODEOWNERS based on git history
-
- Auto-generated CODEOWNERS update based on commit activity over the last 180 days.
-
- π€ Generated with [Claude Code](https://claude.com/claude-code)
-
- Co-Authored-By: Claude <noreply@anthropic.com>
+ Auto-generated CODEOWNERS update based on commit activity over the last 180 days.π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||
| 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: | | ||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| aleozlx | ||
| Amir-19 | ||
| Anerudhan | ||
| azhurkevich | ||
| bkryu | ||
| cyx-6 | ||
| dierksen | ||
| IwakuraRein | ||
| joker-eph | ||
| kahyunnam | ||
| kaixih | ||
| nv-yunzheq | ||
| nvmbreughe | ||
| paul841029 | ||
| Quackens | ||
| sergachev | ||
| sunggg | ||
| ttyio | ||
| wenscarl | ||
| yongwww | ||
| yzh119 |
Uh oh!
There was an error while loading. Please reload this page.