Skip to content
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

ci: add assign-reviewers.yml #32

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/assign-reviewers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Assign Reviewers

on:
pull_request:
push:
branches:
- main

jobs:
assign_reviewers:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get list of modified files
id: files
run: |
git fetch origin main
git diff --name-only HEAD ${{ github.sha }} > modified_files.txt
cat modified_files.txt
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Assign reviewers based on directory paths
run: |
# Define the list of reviewers based on file paths
conf_reviewers="ricardosalveti,quic-vkraleti,sbanerjee-quic"
kernel_reviewers="NainaMehtaQUIC,quic-vkraleti,sbanerjee-quic"
ci_reviewers="ricardosalveti,quic-vkraleti,sbanerjee-quic,quaresmajose"
default_reviewers="ricardosalveti,quic-vkraleti,sbanerjee-quic"

# Initialize a variable to hold the selected reviewers
reviewers=""

# Read the modified files
while IFS= read -r file; do
if [[ "$file" == conf/* ]]; then
reviewers="$conf_reviewers"
break
elif [[ "$file" == recipes-kernel/linux/* ]]; then
reviewers="$kernel_reviewers"
break
elif [[ "$file" == ci/* ]]; then
reviewers="$ci_reviewers"
break
fi
done < modified_files.txt

# Use default reviewers if no path matched
if [ -z "$reviewers" ]; then
reviewers="$default_reviewers"
fi

# Add the reviewers to the pull request
gh pr edit ${{ github.event.pull_request.number }} --add-reviewer $reviewers
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading