From 1578ea9f6de4e9b6bfcb8a099c37e35b65f30dc0 Mon Sep 17 00:00:00 2001 From: umignon Date: Tue, 27 May 2025 08:26:13 +0200 Subject: [PATCH] feat(conventional-commits): update workflow to validate PR titles against Conventional Commits --- .github/workflows/conventional-commits.yaml | 21 +++++++++------- README.md | 5 +++- conventional-commits/README.md | 28 +++++++++++++++++++++ 3 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 conventional-commits/README.md diff --git a/.github/workflows/conventional-commits.yaml b/.github/workflows/conventional-commits.yaml index 3f77ac3..e0f82a0 100644 --- a/.github/workflows/conventional-commits.yaml +++ b/.github/workflows/conventional-commits.yaml @@ -1,15 +1,18 @@ -name: Conventional Commits +name: "Lint PR" on: - pull_request: - branches: - - main + workflow_call: + secrets: + GITHUB_TOKEN: + required: true jobs: - build: - name: Conventional Commits + validate-pr-title: + name: Validate PR title runs-on: ubuntu-latest + permissions: + pull-requests: read steps: - - uses: actions/checkout@v4 - - - uses: webiny/action-conventional-commits@v1.3.0 \ No newline at end of file + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index fad9696..922aa50 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,7 @@ This workflow builds a Docker image from a Dockerfile. It is a reusable workflow This workflow uses the [release-please-action](https://github.com/googleapis/release-please-action) to automate the release of a project. ### [Publish NPM Package](./publish-npm) -This workflow publishes an NPM package to the NPM registry. \ No newline at end of file +This workflow publishes an NPM package to the NPM registry. + +### [Conventional Commits](./conventional-commits) +This workflow checks that pull request titles follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. diff --git a/conventional-commits/README.md b/conventional-commits/README.md new file mode 100644 index 0000000..3a60f47 --- /dev/null +++ b/conventional-commits/README.md @@ -0,0 +1,28 @@ +# Conventional Commits + +This workflow checks that pull request titles follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. + +## Secrets + +### `GITHUB_TOKEN` + +**Required** The GitHub token to use for authentication. + +## Example usage + +```yaml +name: Lint PR Title + +on: + pull_request_target: + types: + - opened + - edited + - reopened + +jobs: + lint-pr-title: + uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/conventional-commits.yaml@conventional-commits-v1.0.0 + secrets: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +``` \ No newline at end of file