Skip to content

Commit

Permalink
Fix quitation issue and add headers
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorsomogyi committed Jan 11, 2024
1 parent ff00962 commit e1c792f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/pr_reviews.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ jobs:
- uses: actions/checkout@v3
- name: Add Reviewers
run: |
user_json=$(gh api users/${{ github.event.review.user.login }})
user_json=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" users/${{ github.event.review.user.login }})
user_name=$(echo "$user_json" | jq -r '.name')
user_email=$(echo "$user_json" | jq -r '.email')
if [[ "${{ github.event.pull_request.body }}" =~ ^.*Reviewers:\ .*${user_name}.*$ ]]; then
if [[ '${{ github.event.pull_request.body }}' =~ ^.*Reviewers:\ .*${user_name}.*$ ]]; then
echo "Reviewer already added: ${user_name} <${user_email}>"
elif [[ "${{ github.event.pull_request.body }}" =~ ^.*Reviewers:\ .*$ ]]; then
pr_body="${{ github.event.pull_request.body }}, ${user_name} <${user_email}>"
elif [[ '${{ github.event.pull_request.body }}' =~ ^.*Reviewers:\ .*$ ]]; then
pr_body=$(echo '${{ github.event.pull_request.body }}'", ${user_name} <${user_email}>")
gh pr edit ${{ github.event.pull_request.number }} --body "${pr_body}"
echo "Added reviewer: ${user_name} <${user_email}>"
else
pr_body="${{ github.event.pull_request.body }}
pr_body=$(echo '${{ github.event.pull_request.body }}'"
Reviewers: ${user_name} <${user_email}>"
Reviewers: ${user_name} <${user_email}>")
gh pr edit ${{ github.event.pull_request.number }} --body "${pr_body}"
echo "Added reviewer: ${user_name} <${user_email}>"
fi
Expand Down

0 comments on commit e1c792f

Please sign in to comment.