Skip to content

Update README.md

Update README.md #3

name: notify reviewer
on:
pull_request_review:
types: [assigned]
jobs:
comment:
runs-on: ubuntu-latest
steps:
- name: Comment on PR
uses: actions/github-script@v5
with:
script: |
const pr_number = context.payload.pull_request.number;
const reviewer = context.payload.review.user.login;
const fs = require('fs');
const path = require('path');
// Read CONTRIBUTING.md
const markdown = fs.readFileSync(path.join(process.env.GITHUB_WORKSPACE, '../tree/master/CONTRIBUTING.md'), 'utf8');
// Extract Reviewing guidelines
const section = markdown.split('### Reviewing pull-requests')[1].split('###')[0];
// Post a comment tagging the reviewer asking them to review following the guidelines
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr_number,
body: `> [!NOTE]\n> @${reviewer}, your review was requested for this Pull Request. Please review this PR following these guidelines:\n\n___\n${section}\n\n\n🤖 _beep boop! I'm a bot and this was an automated message._`,
});