A GitHub action to add an attention label on an open pull-request after certain days.
This Action uses the Pull request api which will fire on the scheduled_event .
The action requires three environment variables
ADD_LABEL
: The label name to add. Mandatory variable.AFTER_DAYS
: The number of days from pull request creation date. Optional variable, default value is3 days
.SKIP_LABELS
: The comma separated labels string. If an open pull-request have one of those label then this action will skip adding the attention label. Optional variable, default value iswork-in-progress,wip
.
Problem
: Let's say, we need to add an reviewer attention labelneed-review
for code-review of an open pull-request, when it is 4 days old. We need to skip the open pull request, if already have approved/wip label. Also lets add reviewer attention label only in working days Monday-Friday(5days).Solution
: Schedule a GitHub action to addneed-review
label for those 4 days old open pull-requests.
name: Add an attention label to an open pull request for review after 4 days.
on:
schedule:
- cron: '0 0 * * 1-5'
jobs:
pullrequestAttentionLabel:
runs-on: ubuntu-latest
steps:
- name: Add an attention label to an open pull request
uses: crazymanish/pullrequest-attention-label-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ADD_LABEL: "need-review"
AFTER_DAYS: 4
SKIP_LABELS: "approved,wip"
REMOVE_LABELS: "helpwanted,untriaged"
The Dockerfile and associated scripts and documentation in this project are released under the MIT License.