5
0
Fork 0
mirror of https://github.com/wagoid/commitlint-github-action.git synced 2025-11-07 16:06:56 +00:00

Merge pull request #29 from wagoid/feat/add-support-additional-dependencies

feat: add support additional dependencies
This commit is contained in:
Wagner Santos 2020-02-22 09:48:24 -03:00 committed by GitHub
commit 1741cc07dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 3 deletions

View file

@ -65,4 +65,36 @@ This is a [`Docker` action](https://github.com/actions/toolkit/blob/e2adf403d6d1
- [conventional-changelog-lint-config-canonical](https://github.com/gajus/conventional-changelog-lint-config-canonical)
- [commitlint-config-jira](https://github.com/Gherciu/commitlint-jira)
If you have a custom shared config that lies in a private registry, let us know! We will be happy to cover this case if necessary.
Apart from the shared configurations that are included by default, you can also include extra dependencies for other configs and plugins that you want to use.
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
on: [pull_request]
jobs:
lint:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: '10.x'
- run: npm install
- name: Add dependencies for commitlint action
# $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
```
---
💡 You can see other ways to install your dependencies (including private ones) in [the Setup Node action's docs](https://github.com/actions/setup-node).
---

View file

@ -2,6 +2,10 @@
set -e
cd ${GITHUB_WORKSPACE}
if [ -z "$NODE_PATH" ]; then
export NODE_PATH=/node_modules
else
export NODE_PATH=$NODE_PATH:/node_modules
fi
NODE_PATH=/node_modules node /run.js
node /run.js