-
Notifications
You must be signed in to change notification settings - Fork 5
73 lines (63 loc) · 2.4 KB
/
conventional-commits.yml
File metadata and controls
73 lines (63 loc) · 2.4 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Conventional Commits
on:
workflow_call:
permissions:
pull-requests: write
jobs:
conventional-commits:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
name: Conventional Commits
steps:
- name: Validate PR title follows Conventional Commits
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
docs
style
refactor
perf
test
build
ci
chore
revert
validateSingleCommit: false
- name: Add PR Comment on Failure
if: failure()
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const comment = `## ❌ Conventional Commit Validation Failed
Your PR title doesn't follow the [Conventional Commits](https://www.conventionalcommits.org/) specification.
### Valid format:
\`<type>(<scope>): <subject>\`
### Examples:
- \`feat: add API key management resource\`
- \`fix(provider): handle disabled user field correctly\`
- \`docs: update README with new resources\`
- \`ci(workflow): add Terraform compatibility testing\`
### Allowed types:
- **feat**: A new feature
- **fix**: A bug fix
- **docs**: Documentation only changes
- **style**: Changes that don't affect code meaning (formatting, etc.)
- **refactor**: Code change that neither fixes a bug nor adds a feature
- **perf**: Performance improvement
- **test**: Adding or updating tests
- **build**: Changes to build system or dependencies
- **ci**: Changes to CI configuration files and scripts
- **chore**: Other changes that don't modify src or test files
- **revert**: Reverts a previous commit
Please update your PR title to follow this format.`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});