Skip to content

label

Get the labels for a pull request. Doesn't do much, but the return value lets you write you own scripts based off of the PR labels!

Options

FlagTypeDescription
--prNumberThe pull request the command should use. Detects PR number in CI (defaults to last merged PR)
--existsStringChecks for existence of a specific label

Examples

auto label --pr 123
auto label --pr 123

Using in scripts

The following will only run the test:visual script when the PR has has the
Visual label.

export PATH=$(npm bin):$PATH

if auto label --pr $PR_NUMBER --exists Visual;
then
  npm run test:visual
fi
export PATH=$(npm bin):$PATH

if auto label --pr $PR_NUMBER --exists Visual;
then
  npm run test:visual
fi

Without PR Number

Running auto label without the PR number will:

  • When run in baseBranch will get the labels for the last merged PR
  • When run for a PR in CI will use the PR's number