Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
feat: reviewpad GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Oct 13, 2022
1 parent 019e5d9 commit a6ec10b
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/reviewpad.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file configures Reviewpad action to run on Issues and Pull Requests! 🦄
name: Reviewpad

on:
issues:
types:
- opened
- edited
issue_comment:
pull_request_target:
types:
- opened
- synchronize
- edited

# These permissions are necessary to automate pull requests from forks.
permissions:
pull-requests: write
issues: write

jobs:
reviewpad_job:
runs-on: ubuntu-latest
name: Reviewpad
steps:
- name: Reviewpad
uses: reviewpad/action@v3.x
with:
# Uncomment next line to use your own configuration file 💪
file: reviewpad.yml
97 changes: 97 additions & 0 deletions reviewpad.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
api-version: reviewpad.com/v3.x

labels:
small:
description: "Pull request with less than 10 changed lines"
color: "294b69"
medium:
description: "Pull request with changed lines between 10 and 30"
color: "a8c3f7"
large:
description: "Pull request with more than 30 changed lines"
color: "8a2138"

rules:
- name: check-for-profile
description: Checks for profile changed
spec: $hasFilePattern("public/data/**")

- name: check-for-file-name
description: Checks for the correct author
spec: $hasFileName($sprintf("public/data/%v.json", [$author()]))

- name: modifies-only-one-file
spec: $fileCount() == 1

- name: check-for-profile-addition
spec: $rule("check-for-file-name") && $rule("modifies-only-one-file")

- name: check-for-version2
kind: patch
spec: $base() == "nextjs"

workflows:
- name: label-pull-request-with-size
always-run: true
if:
- rule: $size() <= 10
extra-actions:
- $addLabel("small")
- rule: $size() > 10 && $size() <= 30
extra-actions:
- $addLabel("medium")
- rule: $size() > 30
extra-actions:
- $addLabel("large")

- name: first-time-contributor
always-run: true
if:
- rule: $pullRequestCountBy($author(), "all") == 1
extra-actions:
- '$commentOnce($sprintf("Welcome @%v! Thank you so much for your first pull request!", [$author()]))'

- rule: $pullRequestCountBy($author(), "all") == 10
extra-actions:
- $addLabel("kudos")
- $info("Kudos for your 10th pull request! You are awesome")

- name: waiting-for-reviewers
always-run: true
if:
- rule: $reviewers() == []
extra-actions:
- '$info("A maintainer will review your pull request soon!")'
- '$addLabel("waiting-for-reviewers")'

- name: add-label-for-chore-profile-addition
always-run: true
if:
- rule: $hasFilePattern("public/data/**")
then:
- '$addLabel("✍ chore: profile addition")'

- name: chore-profile-addition
description: Automates profile addition
always-run: true
if:
- rule: check-for-profile-addition
then:
- '$addLabel("LGTM")'

- name: version 2 with nextjs
description: Automates v2 label
always-run: true
if:
- rule: check-for-version2
then:
- '$addLabel("v2")'

- name: hacktoberfest exclude
description: Exclude pull requests from Hacktoberfest that are profile changes
always-run: true
if:
- rule: check-for-profile
then:
- '$addLabel("invalid")'
- '$commentOnce("Thank you for adding/editing your profile. Note this will not be included as part of Hacktoberfest.")'

0 comments on commit a6ec10b

Please sign in to comment.