GitHub Action
pivotal-lint
A light-weight lint workflow when using GitHub along with PivotalTracker for project management. Works well when used alongside pivotal-flow.
- 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.
- Adds a summary of the story details to the beginning of the PR's description for better documentation & linking from GitHub → Pivotal.
- Automatically labels PRs based on:
- Team name label based on the pivotal board name. if your pivotal board name is
Escher POD
then it will addescher
as a label. Pivotal board name is fetched from the given story id. HOTFIX-PROD
- if the PR is raised againstproduction-release
HOTFIX-PRE-PROD
- if the PR is raised againstrelease/v*
- Pivotal story type (feature, chore, bug).
- Team name label based on the pivotal board name. if your pivotal board name is
- Can add comments to a PR to encourage better PR practices in terms of:
- A good PR title (compared to the story title)
- Discourages PRs which are too large (SLOC)
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
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.
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.
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]
# ...
Follow the instructions here to know more about GitHub actions.
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 🚀