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

Automated review instructions #14

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Changes from all 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
32 changes: 32 additions & 0 deletions .github/workflows/request-review-instructions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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._`,
});