Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
benhodgson87 committed Aug 30, 2024
1 parent 3561e3d commit adddcc9
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ jobs:
## Arguments
| Argument | Required | Example | Purpose |
| --------------------- | -------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `commitlintRulesPath` | No | `'./commitlint.rules.js'` | A relative path from the repo root to a file containing custom Commitlint rules to override the default ([docs](#customising-lint-rules)) |
| `scopeRegex` | No | `'[A-Z]+-[0-9]+'` | A JS regex (without slashes or flags) used to lint the PR scope ([docs](#linting-scope)) |
| `enforcedScopeTypes` | No | `'feat\|fix'` | A list of PR types where the scope is always required and linted ([docs](#skipping-scope-linting)) |
| Argument | Required | Example | Purpose |
| --------------------- | -------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `prTitle` | No | `${{ github.event.pull_request.title }}` | The title of the pull request if not using a Github token ([docs](#arguments-vs-api-for-pr-title)) |
| `commitlintRulesPath` | No | `'./commitlint.rules.js'` | A relative path from the repo root to a file containing custom Commitlint rules to override the default ([docs](#customising-lint-rules)) |
| `scopeRegex` | No | `'[A-Z]+-[0-9]+'` | A JS regex (without slashes or flags) used to lint the PR scope ([docs](#linting-scope)) |
| `enforcedScopeTypes` | No | `'feat\|fix'` | A list of PR types where the scope is always required and linted ([docs](#skipping-scope-linting)) |

## Usage

Expand All @@ -55,6 +56,17 @@ You can find the option in the root General settings of your Github repo.

> Pull Requests > Allow Squash Merging > Default Commit Message > Pull Request Title

### Arguments vs. API for PR title

The action allows you to provide the PR title in two ways. You can either include `GITHUB_TOKEN` as an environment variable, which will use the Github API to retrieve the title of the PR, or you can manually pass the title of the pull request as an argument.

```yaml
with:
prTitle: ${{ github.event.pull_request.title }}
```

If a `prTitle` arg is provided, the API request will be skipped. This can be useful to avoid API rate limiting with shared Github access tokens.

### Customising lint rules

Out of the box the action follows the [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) rules, however you can pass a config of override rules to customise to your needs, using the `commitlintRulesPath` arg.
Expand Down

0 comments on commit adddcc9

Please sign in to comment.