GithubHelp home page GithubHelp logo

flex-development / flautoreview Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 1001 KB

GitHub Action to automate pull request reviews

License: BSD 3-Clause "New" or "Revised" License

Shell 0.45% JavaScript 12.79% TypeScript 86.76%
automation typescript typescript-action github-action github-actions-typescript pull-requests pull-request-review github-automation

flautoreview's Introduction

✅ flautoreview Conventional Commits TypeScript tested with jest

GitHub Action to automate pull request reviews

⚠️ THIS ACTION IS DEPRECATED. YOU DO NOT NEED IT. ⚠️
This action can be implemented in a single workflow using actions/checkout and the GitHub CLI.

# Approve Pull Request
#
# Automatically approve a pull request when a review is requested from @flexdevelopment by certain users.
#
#
# References:
#
# - https://cli.github.com/manual/gh_pr_review
# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#pull_request
# - https://docs.github.com/actions/using-workflows/using-github-cli-in-workflows
# - https://github.com/actions/checkout

---
name: approve-pr
on:
  pull_request:
    types:
      - review_requested
env:
  GITHUB_TOKEN: ${{ secrets.PAT_ADMIN }}
jobs:
  approve-pr:
    if: github.event.requested_reviewer.login == 'flexdevelopment'
    runs-on: ubuntu-latest
    steps:
      - id: checkout
        name: Checkout ${{ github.head_ref }}
        uses: actions/[email protected]
        with:
          persist-credentials: false
          ref: ${{ github.head_ref }}
      - id: approve
        name: Approve pull request
        if: github.actor == 'unicornware' || github.actor == 'quickbrownfox'
        run: gh pr review ${{ github.event.number }} --approve --body 'lgtm 👍🏾'

Note: Setting env.GITHUB_TOKEN to ${{ secrets.GITHUB_TOKEN }} will result in the github-actions bot submitting reviews.

Usage

Do you work alone? Do you request reviews from your admin account? Is switching between accounts becoming a hassle? Geared towards lone developers, this action speeds up your pull request workflow by allowing you to automate reviews.

# Automate Pull Request Reviews - .github/workflows/flautoreview.yml
#
# References:
#
# - https://github.com/flex-development/flautoreview

---
name: Automate PR Reviews
on:
  pull_request:
    types: [review_requested]
jobs:
  flautoreview:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout branch
        uses: actions/checkout@v2
      - name: flexdevelopment
        uses: flex-development/[email protected]
        with:
          body: lgtm 👍🏾
          reviewers: flexdevelopment
          senders: unicornware
          token: ${{ secrets.PAT_REPO_flexdevelopment }}
      - name: prbot
        uses: flex-development/[email protected]
        with:
          body: lgtm2 👍🏾
          reviewers: prbot
          senders: unicornware
          token: ${{ secrets.PAT_REPO_prbot }}

See: .github/workflows/flautoreview.yml

Note: Using github.token, the default token value, will result in the github-actions bot submitting reviews instead of the user or team listed in reviewers.

Options

/**
 * Action options.
 *
 * @see https://docs.github.com/actions/creating-actions/metadata-syntax-for-github-actions#inputs
 */
export interface Inputs {
  /**
   * Body text of pull request review.
   *
   * **Required** if:
   *
   * - `event === ReviewEvent.COMMENT`
   * - `event === ReviewEvent.REQUEST_CHANGES`
   */
  body?: string

  /**
   * Automated review action to perform.
   *
   * @default ReviewEvent.APPROVE
   */
  event?: ReviewEvent

  /**
   * List of user logins and/or team slugs to automate reviews on behalf of;
   * e.g: `'flexdevelopment,team-flautoreview'`.
   *
   * If `undefined` or an empty string, a warning will be logged and the action
   * will exit without failing.
   */
  reviewers?: string

  /**
   * List of users allowed to receive automated reviews; e.g: `'unicornware'`.
   *
   * If an empty string, a warning will be logged and the action will exit
   * without failing.
   */
  senders?: string

  /**
   * GitHub [Personal Access Token][1] with repository access.
   *
   * Using `github.token`, the default `token` value, will result in the
   * [`github-actions`][2] bot submitting reviews instead of the user or team
   * listed in `reviewers`.
   *
   * [1]: https://github.com/settings/tokens/new
   * [2]: https://github.com/features/actions
   *
   * @default '${{ github.token }}'
   */
  token: string
}

Built With

flautoreview's People

Contributors

unicornware avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.