Skip to content

Files

Latest commit

adc2213 · Feb 6, 2018

History

History
60 lines (47 loc) · 1.9 KB

get-metadata.md

File metadata and controls

60 lines (47 loc) · 1.9 KB

get-metadata

This tool is inspired by Evan Lucas's node-review, although it is a CLI implemented with the GitHub GraphQL API.

get-metadata <identifier>

Retrieves metadata for a PR and validates them against nodejs/node PR rules

Options:
  --version         Show version number                                [boolean]
  --owner, -o       GitHub owner of the PR repository                   [string]
  --repo, -r        GitHub repository of the PR                         [string]
  --file, -f        File to write the metadata in                       [string]
  --check-comments  Check for 'LGTM' in comments                       [boolean]
  --max-commits     Number of commits to warn              [number] [default: 3]
  --help, -h        Show help                                          [boolean]

Examples:

PRID=12345

# fetch metadata and run checks on nodejs/node/pull/$PRID
$ get-metadata $PRID
# is equivalent to
$ get-metadata https://github.com/nodejs/node/pull/$PRID
# is equivalent to
$ get-metadata $PRID -o nodejs -r node

# Or, redirect the metadata to a file while see the checks in stderr
$ get-metadata $PRID > msg.txt

# Using it to amend commit messages:
$ get-metadata $PRID -f msg.txt
$ echo -e "$(git show -s --format=%B)\n\n$(cat msg.txt)" > msg.txt
$ git commit --amend -F msg.txt

Git bash for Windows

If you are using git bash and having trouble with output use winpty get-metadata.cmd $PRID.

current known issues with git bash:

  • git bash Lacks colors.
  • git bash output duplicates metadata.

Features

  • Generate PR-URL
  • Generate Reviewed-By
  • Generate Fixes
  • Generate Refs
  • Check for CI runs
  • Check if committers match authors
  • Check 48-hour wait
  • Check two TSC approval for semver-major
  • Warn new commits after reviews
  • Check number of files changed (request pre-backport)