diff --git a/README.md b/README.md index 699576e1..323d940d 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ - [Installation](#installation) + - [Semantic Versions](#semantic-versions) - [Features](#features) - [PR Status Checks](#pr-status-checks) - [PR Description & Labels](#pr-description--labels) @@ -16,7 +17,6 @@ - [Soft-validations via comments](#soft-validations-via-comments) - [Options](#options) - [Skipping branches](#skipping-branches) - - [Semantic Versions](#semantic-versions) - [Contributing](#contributing) - [FAQ](#faq) @@ -33,7 +33,7 @@ name: pivotal-lint pivotal-lint: runs-on: ubuntu-latest steps: - - uses: cleartax/pivotal-lint@latest + - uses: cleartax/pivotal-lint@master name: pivotal-lint with: github-token: ${{ secrets.GITHUB_TOKEN }} @@ -45,6 +45,20 @@ name: pivotal-lint It can also be used as part of an existing workflow by adding it as a step. More information about the [options here](#options). +### Semantic Versions + +If you want more stability in versions of `pivotal-lint` than `@master` you can also use the [semantic releases for pivotal-lint](https://github.com/cleartax/pivotal-lint/releases). + +Example: + +```yaml +# ... + steps: + - uses: cleartax/pivotal-lint@v2.3.0 + name: pivotal-lint + # ... +``` + ## Features ### PR Status Checks @@ -112,10 +126,10 @@ When a PR passes the above check, `pivotal-lint` will also add the story details | key | description | required | default | | --------------- | ------------------------------------------------------------------------------------------------ | -------- | ------- | | `github-token` | Token used to update PR description. `GITHUB_TOKEN` is already available [when you use GitHub actions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token#about-the-github_token-secret), so all that is required is to pass it as a param here. | true | null | -| `pivotal-token` | API Token used to fetch Pivotal Story information. Must have read access to your Pivotal boards. Check [here](https://www.pivotaltracker.com/help/articles/api_token/) on how to get a Pivotal API Token| 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 | +| `pivotal-token` | API Token used to fetch Pivotal Story information. Must have read access to your PivotalTracker projects. Check [here](https://www.pivotaltracker.com/help/articles/api_token/) on how to get a Pivotal API Token| true | null | +| `skip-branches` | A regex to ignore running `pivotal-lint` on certain branches, like production etc. | false | ' ' | +| `skip-comments` | A `Boolean` if set to `true` `pivotal-lint` will skip adding lint comments for PR title. | false | false | +| `pr-threshold` | An `Integer` based on which `pivotal-lint` will add a comment discouraging huge PRs. | false | 800 | Since tokens are private, we suggest adding them as [GitHub secrets](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables). @@ -125,20 +139,6 @@ Since GitHub actions take string inputs, `skip-branches` must be a regex which w `pivotal-lint` already skips PRs which are filed by bots (for eg. [dependabot](https://github.com/marketplace/dependabot-preview)). You can add more bots to [this list](https://github.com/cleartax/pivotal-lint/blob/2bb72327ef04ab028caf84a099ffbc08b4dd0959/src/constants.ts#L4-L6), or add the branch-format followed by the bot PRs to the `skip-branches` option. -### Semantic Versions - -If you want more stability in versions of `pivotal-lint` than `@latest` you can also use the [semantic releases for pivotal-lint](https://github.com/cleartax/pivotal-lint/releases). - -Example: - -```yaml -# ... - steps: - - uses: cleartax/pivotal-lint@v2.1.0 - name: pivotal-lint - # ... -``` - ## Contributing Follow the instructions [here](https://help.github.com/en/articles/creating-a-javascript-action#commit-and-push-your-action-to-github) to know more about GitHub actions. diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts index 36ee1fd3..e06cdf01 100644 --- a/__tests__/utils.test.ts +++ b/__tests__/utils.test.ts @@ -146,7 +146,7 @@ describe('shouldUpdatePRDescription()', () => {
diff --git a/action.yml b/action.yml index bd62b423..839b5c46 100644 --- a/action.yml +++ b/action.yml @@ -3,15 +3,21 @@ description: 'Add pivotal story details to pull requests' author: 'cleartax' inputs: github-token: - description: Token used to update PR description. Must have write access to your repository. + description: 'Token used to update PR description and add labels. Can be passed in using {{ secrets.GITHUB_TOKEN }}' required: true pivotal-token: - description: API Token used to fetch Pivotal Story information. Must have read access to your Pivotal boards. + description: 'API Token used to fetch Pivotal Story information. Must have read access to your PivotalTracker Projects.' required: true skip-branches: - description: A regex to ignore running PR lint on certain branches + description: 'A regex to ignore running on certain branches, like production etc.' required: false default: '' + skip-comments: 'A boolean if set to true, will skip adding lint comments for PR title.' + required: false + default: false + pr-threshold: 'An `Integer` based on which pivotal-lint add a comment discouraging huge PRs. Is disabled by `skip-comments`' + required: false + default: 800 runs: using: 'node12' main: 'lib/index.js' diff --git a/lib/index.js b/lib/index.js index 69f43787..8decf3a0 100644 --- a/lib/index.js +++ b/lib/index.js @@ -2325,7 +2325,7 @@ function run() { // github client with given token const client = new github.GitHub(GITHUB_TOKEN); if (!headBranch && !baseBranch) { - const commentBody = 'pr-lint is unable to determine the head and base branch'; + const commentBody = 'pivotal-lint is unable to determine the head and base branch'; const comment = Object.assign(Object.assign({}, commonPayload), { body: commentBody }); yield utils_1.addComment(client, comment); core.setFailed('Unable to get the head and base branch'); @@ -2970,7 +2970,7 @@ exports.getPrDescription = (body = '', story) => {

${description || 'Oops, the story creator did not add any description.'}

diff --git a/package-lock.json b/package-lock.json index 4ce2cf0e..1885f3a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "pivotal-lint", - "version": "2.2.1", + "version": "2.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6342882b..f91b78b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pivotal-lint", - "version": "2.2.1", + "version": "2.3.0", "description": "Add pivotal story details to pull requests", "main": "lib/index.js", "scripts": { @@ -11,7 +11,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/cleartax/pr-lint" + "url": "git+https://github.com/cleartax/pivotal-lint" }, "keywords": [ "actions", diff --git a/src/main.ts b/src/main.ts index 66987895..dd0ac30c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -76,7 +76,7 @@ async function run() { const client: github.GitHub = new github.GitHub(GITHUB_TOKEN); if (!headBranch && !baseBranch) { - const commentBody = 'pr-lint is unable to determine the head and base branch'; + const commentBody = 'pivotal-lint is unable to determine the head and base branch'; const comment: IssuesCreateCommentParams = { ...commonPayload, body: commentBody, diff --git a/src/utils.ts b/src/utils.ts index 066df7ac..ea590d7f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -326,7 +326,7 @@ export const getPrDescription = (body: string = '', story: PivotalStory): string

${description || 'Oops, the story creator did not add any description.'}