Skip to content

Commit

Permalink
updated workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
akshatnema committed Mar 14, 2024
1 parent 2fbc619 commit 7e59d00
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 22 deletions.
53 changes: 36 additions & 17 deletions .github/workflows/notify-triager.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Notify Triage Maintainers
name: Notify Triagers

on:
pull_request_target:
Expand All @@ -13,44 +13,63 @@ jobs:

- name: Check PR Changes for .md files
id: md-pr-changes
uses: tj-actions/changed-filesaa08304bd477b800d468db44fe10f6c61f7f7b11 # version 42.1.0 https://github.com/tj-actions/changed-files/releases/tag/v42.1.0
uses: tj-actions/changed-files@v42
with:
files: |
**.md
- name: Check PR Changes for non-.md files
id: non-md-pr-changes
uses: tj-actions/changed-files@v42
with:
files: |
!**.md
- name: Read triagers.json
id: read-triagers-json
- name: Extract Doc Triage Maintainers
id: doc-triager
run: |
mdTriagers=$(jq -c '.mdTriagers' triagers.json)
codeTriagers=$(jq -c '.codeTriagers' triagers.json)
echo "md-triagers=$mdTriagers" >> $GITHUB_OUTPUT
echo "code-triagers=$codeTriagers" >> $GITHUB_OUTPUT
docTriagers=$(grep '^#' CODEOWNERS | tail -n 2 | head -n 1)
echo "docTriagers: $docTriagers"
prefix="#docTriagers: "
docTriagers=${docTriagers#$prefix}
echo "docTriagers=$docTriagers" >> $GITHUB_ENV
- name: Add reviewers for non-.md files
- name: Extract Code Triage Maintainers
id: code-triager
run: |
codeTriagers=$(grep '^#' CODEOWNERS | tail -n 1)
echo "codeTriagers: $codeTriagers"
prefix="#codeTriagers: "
codeTriagers=${codeTriagers#$prefix}
echo "codeTriagers=$codeTriagers" >> $GITHUB_ENV
- name: Add Reviewers for code files
if: steps.non-md-pr-changes.outputs.any_changed == 'true'
run: |
IFS=' ' read -r -a codeTriagers <<< "${{ env.codeTriagers }}"
reviewers=$(printf ', "%s"' "${codeTriagers[@]}")
reviewers=[${reviewers:2}]
curl \
-X POST \
-H "Authorization: token ${{ secrets.GH_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \
-d '{
"reviewers": ${{ steps.read-triagers-json.outputs.code-triagers }}
}'
- name: Add reviewers for .md files
-d "{
\"reviewers\": $reviewers
}"
- name: Add Reviewers for doc files
if: steps.md-pr-changes.outputs.any_changed == 'true'
run: |
IFS=' ' read -r -a docTriagers <<< "${{ env.docTriagers }}"
reviewers=$(printf ', "%s"' "${docTriagers[@]}")
reviewers=[${reviewers:2}]
curl \
-X POST \
-H "Authorization: token ${{ secrets.GH_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \
-d '{
"reviewers": ${{ steps.read-triagers-json.outputs.md-triagers }}
}'
-d "{
\"reviewers\": $reviewers
}"
4 changes: 3 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
* @derberg @akshatnema @magicmatatjahu @anshgoyalevil @sambhavgupta0705 @mayaleeeee @asyncapi-bot-eve

# All .md files
*.md @alequetzalli @octonawish-akcodes @BhaswatiRoy @TRohit20 @VaishnaviNandakumar @Arya-Gupta @J0SAL @asyncapi-bot-eve
*.md @alequetzalli @octonawish-akcodes @BhaswatiRoy @TRohit20 @VaishnaviNandakumar @Arya-Gupta @J0SAL @asyncapi-bot-eve

pages/blog/*.md @thulieblack @alequetzalli
pages/community/*.md @thulieblack @alequetzalli

README.md @alequetzalli @derberg @akshatnema @magicmatatjahu @mayaleeeee @asyncapi-bot-eve
#docTriagers: TRohit20 octonawish-akcodes BhaswatiRoy VaishnaviNandakumar Arya-Gupta J0SAL
#codeTriagers: sambhavgupta0705
4 changes: 0 additions & 4 deletions triagers.json

This file was deleted.

0 comments on commit 7e59d00

Please sign in to comment.