From 895d9f3f73f541076012c5572ffa9249c42aed65 Mon Sep 17 00:00:00 2001 From: Wagner Santos Date: Sat, 22 Feb 2020 09:41:32 -0300 Subject: [PATCH 1/2] feat: add support for additional dependencies This feature resolves #27 --- entrypoint.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 9e6586b..a80ce64 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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 From a2c91577420affbed92d248ffc858e65d3979375 Mon Sep 17 00:00:00 2001 From: Wagner Santos Date: Sat, 22 Feb 2020 09:41:54 -0300 Subject: [PATCH 2/2] docs: explain how to use custom configs and plugins --- README.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e7f5b99..35d902e 100644 --- a/README.md +++ b/README.md @@ -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). + +---