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

fix: add workflow to notify docs triagers on relevant PRs #2660

Merged
merged 20 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
69 changes: 69 additions & 0 deletions .github/workflows/notify-triager.yml
TRohit20 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Notify Triagers

on:
pull_request:
push:
branches:
- master
TRohit20 marked this conversation as resolved.
Show resolved Hide resolved

jobs:
Notify-triagers:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
TRohit20 marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/[email protected]

- name: Check PR Changes for .md files
id: md-pr-changes
uses: tj-actions/changed-files@v42
TRohit20 marked this conversation as resolved.
Show resolved Hide resolved
akshatnema marked this conversation as resolved.
Show resolved Hide resolved
akshatnema marked this conversation as resolved.
Show resolved Hide resolved
akshatnema marked this conversation as resolved.
Show resolved Hide resolved
with:
files: |
**.md

- name: Check PR Changes for non-.md files
id: non-md-pr-changes
uses: tj-actions/changed-files@v42
TRohit20 marked this conversation as resolved.
Show resolved Hide resolved
akshatnema marked this conversation as resolved.
Show resolved Hide resolved
akshatnema marked this conversation as resolved.
Show resolved Hide resolved
with:
files: |
!**.md

- name: Read triagers.json
if: steps.md-pr-changes.outputs.any_changed == 'true' || steps.non-md-pr-changes.outputs.any_changed == 'true'
id: read-triagers-json
run: |
mdTriagers=$(jq -r '.mdTriagers[]' triagers.json | tr '\n' ' ')
codeTriagers=$(jq -r '.codeTriagers[]' triagers.json | tr '\n' ' ')
echo "md-triagers=$mdTriagers" >> $GITHUB_OUTPUT
echo "code-triagers=$codeTriagers" >> $GITHUB_OUTPUT

# - name: Create Comment for .md files
# if: steps.md-pr-changes.outputs.any_changed == 'true'
# uses: mshick/[email protected]
# with:
# message: "The PR contains modifications to `.md` files, hence tagging Docs triagers for review and approval.
# cc: ${{ steps.read-triagers-json.outputs.md-triagers }}"
# env:
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

# - name: Create Comment for non-.md files
# if: steps.non-md-pr-changes.outputs.any_changed == 'true'
# uses: mshick/[email protected]
# with:
# message: "The PR contains modifications to code related files, hence tagging Code triagers for review and approval.
# cc: ${{ steps.read-triagers-json.outputs.code-triagers }}"
# env:
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Create comment for .md files
anshgoyalevil marked this conversation as resolved.
Show resolved Hide resolved
if: steps.md-pr-changes.outputs.any_changed == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work as secrets of the upstream repository are not available to pull_request_targets.

Instead secrets.GITHUB_TOKEN can be used as is mentioned in https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.

But do note that this won't comment as asyncapi-bot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use GITHUB_TOKEN in place of github-token right?

script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `The PR contains modifications to `.md` files, hence tagging Docs triagers for review and approval.
# cc: ${{ steps.read-triagers-json.outputs.md-triagers }}`
})
4 changes: 4 additions & 0 deletions triagers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
TRohit20 marked this conversation as resolved.
Show resolved Hide resolved
"mdTriagers": ["@TRohit20", "@octonawish-akcodes", "@BhaswatiRoy", "@VaishnaviNandakumar", "@Arya-Gupta", "@J0SAL"],
"codeTriagers": ["@sambhavgupta0705"]
}
Loading