-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4724b0
commit 5a53437
Showing
1 changed file
with
33 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,60 +39,45 @@ jobs: | |
run: | | ||
echo "PR Author: ${{ steps.pr_author.outputs.author }}" | ||
- name: Select First Reviewer | ||
id: select_first_reviewer | ||
if: github.actor != steps.pr_author.outputs.author # Exclude the author | ||
- name: Assign Reviewers | ||
id: assign_reviewers | ||
run: | | ||
author="${{ steps.pr_author.outputs.author }}" | ||
all_users=("stardustmeg" "Kleostro" "YulikK") | ||
# Exclude the PR author from the list of potential reviewers | ||
potential_reviewers=() | ||
for user in "${all_users[@]}"; do | ||
if [[ "$user" != "$author" ]]; then | ||
potential_reviewers+=("$user") | ||
fi | ||
done | ||
echo "Potential Reviewers: ${potential_reviewers[@]}" | ||
if [[ ${#potential_reviewers[@]} -gt 0 ]]; then | ||
# Select the first reviewer from the potential reviewers list | ||
first_reviewer="${potential_reviewers[0]}" | ||
echo "::set-output name=first_reviewer::${first_reviewer}" | ||
if [[ "$author" == "stardustmeg" ]]; then | ||
first_reviewer="Kleostro" | ||
second_reviewer="YulikK" | ||
elif [[ "$author" == "Kleostro" ]]; then | ||
first_reviewer="stardustmeg" | ||
second_reviewer="YulikK" | ||
elif [[ "$author" == "YulikK" ]]; then | ||
first_reviewer="stardustmeg" | ||
second_reviewer="Kleostro" | ||
else | ||
echo "No potential reviewers found." | ||
echo "Author not found." | ||
exit 1 | ||
fi | ||
echo "::set-output name=first_reviewer::${first_reviewer}" | ||
echo "::set-output name=second_reviewer::${second_reviewer}" | ||
- name: Debug First Reviewer | ||
- name: Debug Reviewers | ||
run: | | ||
echo "First Reviewer: ${{ steps.select_first_reviewer.outputs.first_reviewer }}" | ||
echo "First Reviewer: ${{ steps.assign_reviewers.outputs.first_reviewer }}" | ||
echo "Second Reviewer: ${{ steps.assign_reviewers.outputs.second_reviewer }}" | ||
- name: Select Second Reviewer | ||
id: select_second_reviewer | ||
- name: Request First Reviewer | ||
if: github.actor != steps.pr_author.outputs.author # Exclude the author | ||
run: | | ||
author="${{ steps.pr_author.outputs.author }}" | ||
all_users=("stardustmeg" "Kleostro" "YulikK") | ||
# Exclude the PR author and the first reviewer from the list of potential reviewers | ||
potential_reviewers=() | ||
for user in "${all_users[@]}"; do | ||
if [[ "$user" != "$author" && "$user" != "${{ steps.select_first_reviewer.outputs.first_reviewer }}" ]]; then | ||
potential_reviewers+=("$user") | ||
fi | ||
done | ||
echo "Potential Reviewers: ${potential_reviewers[@]}" | ||
if [[ ${#potential_reviewers[@]} -gt 0 ]]; then | ||
# Select the second reviewer from the potential reviewers list | ||
second_reviewer="${potential_reviewers[0]}" | ||
echo "::set-output name=second_reviewer::${second_reviewer}" | ||
else | ||
echo "No potential reviewers found." | ||
fi | ||
uses: octokit/[email protected] | ||
with: | ||
route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers | ||
mediaType: '{"previews":["luke-cage"]}' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
reviewers: ${{ steps.assign_reviewers.outputs.first_reviewer }} | ||
|
||
- name: Debug Second Reviewer | ||
run: | | ||
echo "Second Reviewer: ${{ steps.select_second_reviewer.outputs.second_reviewer }}" | ||
- name: Request Second Reviewer | ||
if: github.actor != steps.pr_author.outputs.author # Exclude the author | ||
uses: octokit/[email protected] | ||
with: | ||
route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers | ||
mediaType: '{"previews":["luke-cage"]}' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
reviewers: ${{ steps.assign_reviewers.outputs.second_reviewer }} |