-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (27 loc) · 1.59 KB
/
conventional-commits.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# SPDX-License-Identifier: Apache-2.0
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This GitHub Actions workflow validates the title of pull requests (PRs) to ensure they follow conventional commit standards.
name: PR Conventional Commit Validation
on:
# Trigger this workflow on specific events related to pull requests
pull_request:
types: [opened, synchronize, reopened, edited]
jobs:
validate-pr-title:
runs-on: ubuntu-latest # Use the latest Ubuntu runner for the job
steps:
- name: Checkout code
uses: actions/checkout@v4 # Checkout the repository code using the actions/checkout action
- name: PR Conventional Commit Validation
uses: ytanikin/PRConventionalCommits@1.1.0 # Use the PRConventionalCommits action to validate PR titles
with:
# Define the task types that are valid for conventional commits
task_types: '["build","ci","docs","feat","fix","perf","refactor","style","test","feat!"]'
# Map the conventional commit types to corresponding GitHub labels
custom_labels: '{"build": "build", "ci": "CI/CD", "docs": "documentation", "feat": "enhancement", "fix": "bug", "perf": "performance", "refactor": "refactor", "style": "style", "test": "test", "feat!": "enhancement breaking change"}'
# Use a personal access token (GITHUB_TOKEN) stored in GitHub secrets for authentication
token: ${{ secrets.GITHUB_TOKEN }}
add_label: 'true'