jrylan / github-action-stuck-pr-notifier

Automatically label and mention/notify users about stuck pull requests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stuck Pull Request Notifier GitHub Action

Automatically label and mention/notify a user about stuck pull requests.

This is primarily useful if you use a dependency update bot such as Dependabot, Greenkeeper, or Renovate and have configured their pull requests to be merged automatically.

This action will catch unmerged PRs that may be stuck because of a failing GitHub status check, and will automatically remove the stuck label from all closed or merged pull requests.

Pairs very well with the Auto Approve action by Harry Marr.

Usage

Pre-requisites

Create a label in your repo to assign to stuck pull requests. The default label this action uses is stuck, but you can use any label.

Inputs

❗ = Required

repo-token

Input for ${{ secrets.GITHUB_TOKEN }}.

cutoff

  • Default: 24h

The cutoff time period before a pull request is considered stuck. The value will be passed to the ms package.

label

  • Default: stuck

Name of the label to assign to stuck pull requests. The supplied label must already exist. This action will not create a new label.

message

The comment message to post on the pull request to notify a user.

search-query

Search query to pass to the pull request search. The value provided will be appended to the base search query, which looks something like this:

repo:${GITHUB_REPOSITORY} is:pr is:open created:<=${createdSinceCutOff} -label:${stuckLabel}

Example workflow

Find and update Dependabot pull requests that have not been automatically merged in 24 hours (default cutoff).

name: Stuck PRs
on:
  schedule:
    - cron: '0 * * * *' # Run once per hour
jobs:
  stuck-prs:
    runs-on: ubuntu-latest
    steps:
      - uses: jrylan/github-action-stuck-pr-notifier@main
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          message: 'Hey @yourUsername, this PR appears to be stuck.'
          search-query: 'author:app/dependabot-preview author:app/dependabot'

Related

License

ISC

About

Automatically label and mention/notify users about stuck pull requests.

License:ISC License


Languages

Language:TypeScript 100.0%