Skip to content

Updated CODEOWNERS - 11/20/2025 #4

Updated CODEOWNERS - 11/20/2025

Updated CODEOWNERS - 11/20/2025 #4

name: Check CODEOWNERS for Backend Review Group Directory Assignments
on:
pull_request:
paths:
- '.github/CODEOWNERS'
permissions:
contents: read
pull-requests: write
jobs:
check-codeowners:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: .github/CODEOWNERS
- name: Check for backend-review-group directory assignments
if: steps.changed-files.outputs.any_changed == 'true'
id: check
continue-on-error: true
run: |
#!/bin/bash
set -e
echo "πŸ” Checking for backend-review-group assignments to directories..."
echo ""
# Get the diff for CODEOWNERS file
git diff origin/master/.github/CODEOWNERS .github/CODEOWNERS > codeowners.diff
# Initialize arrays and counters
declare -a violations
violation_count=0
file_count=0
# Process additions
while IFS= read -r line; do
# Process added lines only
if [[ "$line" =~ ^\\+ ]] && [[ ! "$line" =~ ^\\+\\+\\+ ]] && [[ ! "$line" =~ ^\\+--- ]]; then
clean_line="${line:1}"
# Skip empty lines and comments
if [[ -z "$clean_line" ]] || [[ "$clean_line" =~ ^[[:space:]]*# ]]; then
continue
fi
# Check if line contains backend-review-group
if [[ "$clean_line" =~ backend-review-group ]]; then
path=$(echo "$clean_line" | awk '{print $1}')
# Determine if it's a directory
is_directory=false
if [[ "$path" =~ /$ ]]; then
is_directory=true
elif [[ ! "$path" =~ \.[a-zA-Z0-9]+$ ]]; then
# Exception for Makefile, README, etc.
if [[ ! "$path" =~ ^[A-Z][a-z]*file$ ]] && [[ ! "$path" =~ ^README ]] && [[ ! "$path" =~ ^LICENSE ]]; then
is_directory=true
fi
fi
if [ "$is_directory" = true ]; then
violations+=("$path")
((violation_count++))
echo "⚠️ Directory: $path"
else
((file_count++))
echo "βœ“ File: $path"
fi
fi
fi
done < codeowners.diff
# Save outputs BEFORE any exit
echo "violation_count=$violation_count" >> $GITHUB_OUTPUT
echo "file_count=$file_count" >> $GITHUB_OUTPUT
# Save violations as multiline string
if [ $violation_count -gt 0 ]; then
{
echo "violations<<EOF"
printf '%s\n' "${violations[@]}"
echo "EOF"
} >> $GITHUB_OUTPUT
fi
# Generate summary
echo ""
echo "════════════════════════════════════════════════"
echo " SUMMARY "
echo "════════════════════════════════════════════════"
echo ""
echo "πŸ“Š Statistics:"
echo " β€’ Directory assignments added: $violation_count"
echo " β€’ File assignments added: $file_count"
echo ""
# Determine exit code
if [ $violation_count -eq 0 ]; then
echo "βœ… PASSED: No directory assignments detected"
echo ""
if [ $file_count -gt 0 ]; then
echo "βœ“ All $file_count backend-review-group assignments are for specific files"
fi
exit 0
else
echo "❌ FAILED: Found $violation_count directory assignment(s)"
echo ""
echo "Directory assignments detected:"
for violation in "${violations[@]}"; do
echo " β€’ $violation"
done
echo ""
echo "════════════════════════════════════════════════"
echo ""
echo "⚠️ WARNING"
echo "Assigning backend-review-group to directories causes"
echo "automatic assignment for ALL new files created by"
echo "other VFS teams in those directories."
echo ""
exit 1
fi
- name: Fail workflow if violations found
if: steps.check.outputs.violation_count != '' && steps.check.outputs.violation_count != '0'
run: |
echo "❌ Workflow failed due to ${{ steps.check.outputs.violation_count }} directory assignment(s)"
exit 1