Skip to content

SD-13/pending-review-notifier

Repository files navigation

stale-review-request-notifier GitHub Action

Action to send notifications to reviewers on github-discussion when they miss reviewing PRs within expected time.

Table of Contents

Usage

  1. Generate a github-personal-access-token with rights to create discussion and read issues & pull request. image image

  2. Create a new repository secret (assuming DISCUSSION_NOTIFICATION_TOKEN) with value as the newly generated personal access token.

  3. Create a GitHub discussion and then a workflow file in the .github/workflows/ dir.

    Example:

    name: Send pending review notifications to reviewer on github-discussion
    on:
      schedule:
        - cron: '0 0 * * 2,4'
    
    jobs:
      send_notifications:
        name: Send pending review notifications
        runs-on:  ${{ matrix.os }}
        strategy:
          matrix:
            os: [ubuntu-22.04]
        steps:
          - uses: actions/checkout@v3
          - uses: actions/setup-python@v4
            with:
              python-version: '3.8.15'
              architecture: 'x64'
          - uses: oppia/stale-review-request-notifier
            with:
              category-name: << category_name >>
              discussion-title: << discussion_title >>
              repo-token: ${{ secrets.DISCUSSION_NOTIFICATION_TOKEN }}
              review-turnaround-hours: << TURNAROUND_HOURS >>

    Important notes:

    • Replace << category_name >> and << discussion_title >> with the respective category name and discussion title.
    • Replace << TURNAROUND_HOURS >> with the expected PR review time.
    • The POSIX cron syntax needs to be quoted as * is a special character in YAML.
  4. Add PENDING_REVIEW_NOTIFICATION_TEMPLATE.yml file in .github/ dir.

    Example:

    Hi {{ username }},
    
    It looks like you haven't reviewed the following PRs within the expected time:
    {{ pr_list }}
    
    Can you please review the pending PRs as soon as possible?
    
    Please make sure to reply to this thread once all the PRs are reviewed!
    

    Important notes: - Template can have username and pr_list placeholders which will eventually get replaced with the reviewer's username and the list of PRs waiting on their review respectively.

Inputs

Name Requirement Default Description
category-name required The category name the discussion belongs to.
discussion-title required The title of the discussion in which comments will be posted.
repo-token required The github-personal-token which at least have rights to create a discussion in the given team.
review-turnaround-hours required The maximum review turnaround hours. Notifications will be sent only for PRs waiting for more than review-turnaround-hours.

Known issue

The secret.GITHUB_TOKEN available in build container doesn't have permission to create discussion in team.

License

See LICENSE.

About

Notify reviewers to review pending pull requests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages