Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
check-square

GitHub Action

pivotal-lint

v2.2.0

pivotal-lint

check-square

pivotal-lint

Add pivotal story details to pull requests

Installation

Copy and paste the following snippet into your .yml file.

              

- name: pivotal-lint

uses: ClearTax/[email protected]

Learn more about this action in ClearTax/pivotal-lint

Choose a version

pr-lint 🧹

A light-weight lint workflow when using GitHub along with PivotalTracker for project management. Works well when used alongside pivotal-flow.

GitHub

Features

  1. Validates branches that are filed as PRs. It uses the pivotal API to provide GitHub status checks that help you avoid merging PRs without valid story IDs.
  2. Adds a summary of the story details to the beginning of the PR's description for better documentation & linking from GitHub → Pivotal. pr-lint
  3. Automatically labels PRs based on:
    1. Team name label based on the pivotal board name. if your pivotal board name is Escher POD then it will add escher as a label. Pivotal board name is fetched from the given story id.
    2. HOTFIX-PROD - if the PR is raised against production-release
    3. HOTFIX-PRE-PROD - if the PR is raised against release/v*
    4. Pivotal story type (feature, chore, bug).
  4. Can add comments to a PR to encourage better PR practices in terms of:
    1. A good PR title (compared to the story title)
    2. Discourages PRs which are too large (SLOC)

Usage

To make pr-lint a part of your workflow, just add a pr-lint.yml file in your .github/workflows/ directory in your git repo.

name: PR lint
 on: [pull_request]
 jobs:
  pr_lint:
    runs-on: ubuntu-latest
    steps:
    - name: Verify Pivotal story ID & add relevant labels
      uses: cleartax/pr-lint@master
      with:
        github-token: ${{ secrets.GITHUB_ACCESS_TOKEN }}
        pivotal-token: ${{ secrets.PIVOTAL_TOKEN }}
        skip-branches: '^(production-release|master|release\/v\d+)$'
        skip-comments: true
        pr-threshold: 1000

Options

key description required default
github-token Token used to update PR description. Must have write access to your repository. true null
pivotal-token API Token used to fetch Pivotal Story information. Must have read access to your Pivotal boards. true null
skip-branches A regex to ignore running PR lint on certain branches, like production etc. false ' '
skip-comments A Boolean if set to true PR lint will skip adding lint comments for PR title. false false
pr-threshold An Integer based on which PR lint will add commets for a huge PR. false 800

Since tokens are private, we suggest adding them as GitHub secrets.

Skipping branches

Since GitHub actions take string inputs, you must generate a regex which will work for all sets of branches you want to ignore. This is useful for merging protected/default branches into other branches. Check out some examples in the tests.

pr-lint already skips PRs which are filed by bots (eg dependabot). You can add more bots to this list.

Versions

If you want more stability in versions than @master you can also use the semantic releases for pr-lint.

Example:

# ...
  pr_lint:
    steps:
    - name: Verify Pivotal story ID & add relevant labels
      uses: cleartax/[email protected]
      # ...

Contributing

Follow the instructions here to know more about GitHub actions.

FAQ

Why is a Pivotal ID required in branch names?

Pivotal id is required in order to:

  • Automate change-logs and release notes ⚙️.
  • Automate alerts to QA/Product teams and/or other external stake-holders 🔊.
  • Help us retrospect the sprint progress 📈.
Is there a way to get around this? Nope 🙅
Are there any tools to automate this?

Yes, check out pivotal-flow 🚀