From adddcc972075bad35b4fcc671dc8fba2d8de78fe Mon Sep 17 00:00:00 2001 From: Ben Hodgson Date: Fri, 30 Aug 2024 11:59:06 +0100 Subject: [PATCH] Update docs --- README.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fe358b2..0115ec0 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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.