pullup-sandbox

0.0.1 • Public • Published

PullUp

Work in progress

PullUp is a GitHub Action to triage your pull-request metadata. It is heavily inspired on Danger.

PullUp provides methods to comment on the pull-request and fail the check:

PullUp.message('This is a message!')
PullUp.warning('This is a warning!')
PullUp.error('This is an error, and it will fail the pull-request!')

It provides information about the pull-request:

PullUp.pr: PullsGetResponse // https://developer.github.com/v3/pulls/#list-pull-requests

And it provides the list of changed files:

PullUp.git.addedFiles: string[] // List of added files
PullUp.git.removedFiles: string[]  // List of removed files
PullUp.git.modifiedFiles: string[] // List of modified files

Getting Started

In this example we'll set up PullUp to fail pull-requests with titles that doesn't start with the pattern [JIRA-123].

By default, PullUp will look for a Pullupfile.js file inside the .github folder, so let's create the file and add the following contents:

if (!/\[[A-Z]+-[0-9]+\]\s/.test(PullUp.pr.title)) {
  PullUp.error("Title should start with the ticket id e.g.: [JIRA-123]")
}

You can access the pull-request data with PullUp.pr and fail the checks with PullUp.error(message).

Now let's create the workflow file for PullUp and add the following contents:

name: "PullUp"
on:
  pull_request:
    types:
      - labeled
      - opened
      - edited
      - reopened
      - synchronize

jobs:
  triage-pr:
    runs-on: ubuntu-latest
    steps:
    - uses: alephao/PullUp@develop
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"

That's it for a minimal setup, now if someone creates a pull-request that doesn't follow the [JIRA-123] My title pattern, the pull-request will fail and PullUp will add a comment with the reason why.

Error Message

Documentation

See the Documentation folder:

License

MIT License

Readme

Keywords

Package Sidebar

Install

npm i pullup-sandbox

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

823 kB

Total Files

40

Last publish

Collaborators

  • jaytoday