From b609fdf0924ab81609a2acf77025f650f33bfdf7 Mon Sep 17 00:00:00 2001 From: Michal Shalev Date: Fri, 15 Nov 2024 10:11:19 +0200 Subject: [PATCH] GITHUB/WORKFLOWS: Add workflow for auto-assigning reviewers based on git blame --- .github/workflows/auto-assign-reviewers.yml | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/auto-assign-reviewers.yml diff --git a/.github/workflows/auto-assign-reviewers.yml b/.github/workflows/auto-assign-reviewers.yml new file mode 100644 index 000000000000..1486f4ce063d --- /dev/null +++ b/.github/workflows/auto-assign-reviewers.yml @@ -0,0 +1,24 @@ +name: Auto-Assign Reviewers + +on: + pull_request: + types: [opened, synchronize] + +jobs: + auto-assign: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run git blame analysis + run: | + git diff HEAD^ | grep 'diff --git' | awk '{print $3}' | while read file; do + echo "Analyzing $file" + git blame -e $file + done > reviewers.txt + + - name: Assign reviewers + uses: peter-evans/create-pull-request@v5 + with: + reviewers: ${{ steps.blame.outputs.reviewers }}