mirror of
https://github.com/wagoid/commitlint-github-action.git
synced 2026-04-06 17:46:54 +00:00
feat: use action input instead of env var to get the github token
BREAKING CHANGE: GITHUB_TOKEN env var is now ignored. In case a custom token is needed, it'll be necessary to pass it via the `token` input from now on.
This commit is contained in:
parent
a413a3f439
commit
18e9bff0e6
4 changed files with 26 additions and 19 deletions
24
README.md
24
README.md
|
|
@ -7,19 +7,17 @@ Lints Pull Request commits with commitlint
|
|||
Create a github workflow in the `.github` folder, e.g. `.github/workflows/commitlint.yml`:
|
||||
|
||||
```yaml
|
||||
name: Commitlint
|
||||
name: Lint Commit Messages
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
commitlint:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: wagoid/commitlint-github-action@v1
|
||||
- uses: wagoid/commitlint-github-action@v2
|
||||
```
|
||||
|
||||
Alternatively, you can run on other event types such as `on: [push]`. In that case the action will lint the push event's commit(s) instead of linting commits from a pull request. You can also combine `push` and `pull_request` together in the same workflow.
|
||||
|
|
@ -54,6 +52,14 @@ Link to a page explaining your commit message convention.
|
|||
|
||||
default: `https://github.com/conventional-changelog/commitlint/#what-is-commitlint`
|
||||
|
||||
### `token`
|
||||
|
||||
Personal access token (PAT) used to interact with the GitHub API.
|
||||
By default, the automatic token provided by GitHub is used.
|
||||
You can see more info about GitHub's default token [here](https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token).
|
||||
|
||||
default: `${{ github.token }}`
|
||||
|
||||
## Outputs
|
||||
|
||||
### `results`
|
||||
|
|
@ -114,14 +120,12 @@ Apart from the shared configurations that are included by default, you can also
|
|||
In order to do so, you can use `NODE_PATH` env var to make the action take those dependencies into account. Below is an example workflow that does that.
|
||||
|
||||
```yaml
|
||||
name: Commitlint
|
||||
name: Lint Commit Messages
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
commitlint:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
|
|
@ -134,7 +138,7 @@ jobs:
|
|||
# $GITHUB_WORKSPACE is the path to your repository
|
||||
run: echo "::set-env name=NODE_PATH::$GITHUB_WORKSPACE/node_modules"
|
||||
# Now the commitlint action will run considering its own dependencies and yours as well 🚀
|
||||
- uses: wagoid/commitlint-github-action@v1
|
||||
- uses: wagoid/commitlint-github-action@v2
|
||||
```
|
||||
|
||||
---
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue