From 8020ad83badeb10a2e1960590180f36c2bd731f7 Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Mon, 6 Mar 2023 15:47:05 +0800 Subject: [PATCH 1/2] docs: add link from README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index c73ecc93b4..d82adb6fa6 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,10 @@ A number of shared configurations are available to install and use with `commitl > ⚠️ If you want to publish your own shareable config then make sure it has a name aligning with the pattern `commitlint-config-emoji-log` or `commitlint-config-your-config-name` — then in extend all you have to write is `emoji-log` or `your-config-name`. +## Documentation + +Check the [main website](https://commitlint.js.org/). + ## API - Alternative, programmatic way to interact with `commitlint` From 9e81427ca0f6b4512f292d9e1afcadb64a2ffb50 Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Mon, 6 Mar 2023 16:14:09 +0800 Subject: [PATCH 2/2] docs(ci): add GitHub Actions section --- docs/guides-ci-setup.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/docs/guides-ci-setup.md b/docs/guides-ci-setup.md index 78db20b277..a59b12d7ff 100644 --- a/docs/guides-ci-setup.md +++ b/docs/guides-ci-setup.md @@ -6,6 +6,47 @@ This guide assumes you have already configured `commitlint` for local usage. Follow the [Getting Started](./?id=getting-started) for basic installation and configuration instructions. +## GitHub Actions + +An example of how a GitHub Actions workflow could validate the last commit message or all commit messages inside a Pull Request: + +```yml +name: CI + +on: [push, pull_request] + +jobs: + commitlint: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v2 + - name: Install required dependencies + run: | + apt update + apt install -y sudo + sudo apt install -y git curl + curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - + sudo DEBIAN_FRONTEND=noninteractive apt install -y nodejs + - name: Print versions + run: | + git --version + node --version + npm --version + npx commitlint --version + - name: Install commitlint + run: | + npm install conventional-changelog-conventionalcommits + npm install commitlint@latest + + - name: Validate current commit (last commit) with commitlint + if: github.event_name == 'push' + run: npx commitlint --from HEAD~1 --to HEAD --verbose + + - name: Validate PR commits with commitlint + if: github.event_name == 'pull_request' + run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose +``` + ## Travis ```bash