Skip to content

Commit 635c53d

Browse files
committed
feat(GH) adding new workflow for 🚀 CloudDrove–Conventional-Commits-StandardL
1 parent 63feb55 commit 635c53d

7 files changed

+794
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: đź“‹ Conventional Commits Example
3+
4+
# This is an example workflow showing how to use all three conventional commits workflows
5+
# Copy this to your repository and customize as needed
6+
7+
on:
8+
pull_request:
9+
branches: [ main, master ]
10+
types: [opened, edited, reopened, synchronize]
11+
push:
12+
branches: [ main, master ]
13+
14+
jobs:
15+
# Validate commit messages in PRs
16+
validate-commits:
17+
if: github.event_name == 'pull_request'
18+
uses: clouddrove/github-shared-workflows/.github/workflows/conventional-commits-lint.yml@master
19+
with:
20+
allowed_types: "feat,fix,docs,style,refactor,perf,test,chore,ci,build,revert"
21+
scopes: "api,ui,docs,config,deploy,infra"
22+
breaking_change_token: "BREAKING CHANGE"
23+
secrets:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
26+
# Validate PR titles
27+
validate-pr-title:
28+
if: github.event_name == 'pull_request'
29+
uses: clouddrove/github-shared-workflows/.github/workflows/conventional-commits-pr-title.yml@master
30+
with:
31+
allowed_types: "feat,fix,docs,style,refactor,perf,test,chore,ci,build,revert"
32+
scopes: "api,ui,docs,config,deploy,infra"
33+
secrets:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
# Create releases on push to main/master
37+
release:
38+
if: github.event_name == 'push'
39+
uses: clouddrove/github-shared-workflows/.github/workflows/conventional-commits-release.yml@master
40+
with:
41+
target_branch: master
42+
initial_version: "1.0.0"
43+
prerelease: false
44+
changelog_file: "CHANGELOG.md"
45+
version_prefix: "v"
46+
secrets:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: 🔍 Conventional Commits Lint
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
allowed_types:
8+
required: false
9+
type: string
10+
default: "feat,fix,docs,style,refactor,perf,test,chore,ci,build,revert"
11+
description: 'Comma-separated list of allowed commit types'
12+
scopes:
13+
required: false
14+
type: string
15+
default: ""
16+
description: 'Comma-separated list of allowed scopes (optional)'
17+
breaking_change_token:
18+
required: false
19+
type: string
20+
default: "BREAKING CHANGE"
21+
description: 'Token to identify breaking changes'
22+
secrets:
23+
GITHUB_TOKEN:
24+
required: false
25+
description: 'GitHub token for private repositories'
26+
27+
jobs:
28+
conventional-commits-check:
29+
runs-on: ubuntu-latest
30+
if: github.event_name == 'pull_request'
31+
32+
steps:
33+
- name: 📦 Checkout repository
34+
uses: actions/checkout@v5
35+
with:
36+
fetch-depth: 0
37+
token: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: 🔍 Validate Conventional Commits
40+
uses: webiny/[email protected]
41+
with:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
allowed-commit-types: ${{ inputs.allowed_types }}
44+
scopes: ${{ inputs.scopes }}
45+
breaking-change-token: ${{ inputs.breaking_change_token }}
46+
47+
- name: đź“‹ Summary
48+
run: |
49+
echo "âś… All commit messages follow Conventional Commits specification"
50+
echo "📝 Allowed types: ${{ inputs.allowed_types }}"
51+
if [ -n "${{ inputs.scopes }}" ]; then
52+
echo "🎯 Allowed scopes: ${{ inputs.scopes }}"
53+
fi
54+
echo "đź’Ą Breaking change token: ${{ inputs.breaking_change_token }}"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: 📝 PR Title Conventional Commits Check
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
allowed_types:
8+
required: false
9+
type: string
10+
default: "feat,fix,docs,style,refactor,perf,test,chore,ci,build,revert"
11+
description: 'Comma-separated list of allowed commit types'
12+
scopes:
13+
required: false
14+
type: string
15+
default: ""
16+
description: 'Comma-separated list of allowed scopes (optional)'
17+
secrets:
18+
GITHUB_TOKEN:
19+
required: false
20+
description: 'GitHub token for private repositories'
21+
22+
jobs:
23+
pr-title-check:
24+
runs-on: ubuntu-latest
25+
if: github.event_name == 'pull_request'
26+
27+
steps:
28+
- name: 📦 Checkout repository
29+
uses: actions/checkout@v5
30+
with:
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: 🔍 Validate PR Title
34+
uses: Namchee/[email protected]
35+
with:
36+
access_token: ${{ secrets.GITHUB_TOKEN }}
37+
allowed_types: ${{ inputs.allowed_types }}
38+
scopes: ${{ inputs.scopes }}
39+
40+
- name: đź“‹ Summary
41+
run: |
42+
echo "âś… PR title follows Conventional Commits specification"
43+
echo "📝 Allowed types: ${{ inputs.allowed_types }}"
44+
if [ -n "${{ inputs.scopes }}" ]; then
45+
echo "🎯 Allowed scopes: ${{ inputs.scopes }}"
46+
fi
47+
echo "đź“„ PR Title: ${{ github.event.pull_request.title }}"
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
name: 🚀 Conventional Commits Release
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
target_branch:
8+
required: true
9+
type: string
10+
default: master
11+
description: 'Target branch for releases'
12+
initial_version:
13+
required: false
14+
type: string
15+
default: "1.0.0"
16+
description: 'Initial version if no tags exist'
17+
prerelease:
18+
required: false
19+
type: boolean
20+
default: false
21+
description: 'Create prerelease versions'
22+
changelog_file:
23+
required: false
24+
type: string
25+
default: "CHANGELOG.md"
26+
description: 'Changelog file path'
27+
version_prefix:
28+
required: false
29+
type: string
30+
default: "v"
31+
description: 'Version prefix (e.g., v for v1.0.0)'
32+
secrets:
33+
GITHUB_TOKEN:
34+
required: true
35+
description: 'GitHub token for creating releases and tags'
36+
37+
jobs:
38+
conventional-release:
39+
runs-on: ubuntu-latest
40+
if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', inputs.target_branch)
41+
42+
steps:
43+
- name: 📦 Checkout repository
44+
uses: actions/checkout@v5
45+
with:
46+
fetch-depth: 0
47+
token: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: đź§© Install dependencies
50+
run: |
51+
sudo apt-get update
52+
sudo apt-get install -y jq
53+
54+
- name: 🔍 Determine next version
55+
id: version
56+
uses: smlx/[email protected]
57+
with:
58+
write-tag: false
59+
initial-version: ${{ inputs.initial_version }}
60+
prerelease: ${{ inputs.prerelease }}
61+
version-prefix: ${{ inputs.version_prefix }}
62+
63+
- name: 📝 Generate changelog
64+
id: changelog
65+
uses: requarks/changelog-action@v1
66+
with:
67+
token: ${{ secrets.GITHUB_TOKEN }}
68+
tag: ${{ steps.version.outputs.version }}
69+
includeInvalidCommits: false
70+
writeToFile: true
71+
changelogFilePath: ${{ inputs.changelog_file }}
72+
includeRefIssues: true
73+
useGitmojis: true
74+
reverseOrder: false
75+
76+
- name: 🏷️ Create and push tag
77+
if: steps.version.outputs.version != ''
78+
run: |
79+
git config user.name "clouddrove-ci"
80+
git config user.email "[email protected]"
81+
git tag ${{ steps.version.outputs.version }}
82+
git push origin ${{ steps.version.outputs.version }}
83+
84+
- name: 🚀 Create GitHub release
85+
if: steps.version.outputs.version != ''
86+
uses: ncipollo/release-action@v1
87+
with:
88+
token: ${{ secrets.GITHUB_TOKEN }}
89+
tag: ${{ steps.version.outputs.version }}
90+
name: ${{ steps.version.outputs.version }}
91+
allowUpdates: true
92+
draft: false
93+
prerelease: ${{ inputs.prerelease }}
94+
makeLatest: true
95+
body: |
96+
${{ steps.changelog.outputs.changes }}
97+
98+
**Release Type:** ${{ steps.version.outputs.version_type }}
99+
100+
[Compare changes](https://github.com/${{ github.repository }}/compare/${{ steps.version.outputs.previous_version }}...${{ steps.version.outputs.version }})
101+
102+
- name: đź’ľ Commit changelog
103+
if: steps.version.outputs.version != ''
104+
uses: stefanzweifel/git-auto-commit-action@v6
105+
with:
106+
branch: ${{ inputs.target_branch }}
107+
commit_user_name: clouddrove-ci
108+
commit_user_email: [email protected]
109+
commit_author: "CloudDrove CI <[email protected]>"
110+
commit_message: 'docs: update ${{ inputs.changelog_file }} for ${{ steps.version.outputs.version }}'
111+
file_pattern: ${{ inputs.changelog_file }}
112+
113+
- name: đź“‹ Release summary
114+
run: |
115+
if [ -n "${{ steps.version.outputs.version }}" ]; then
116+
echo "âś… Released ${{ steps.version.outputs.version }} successfully"
117+
echo "🏷️ Version type: ${{ steps.version.outputs.version_type }}"
118+
echo "📝 Changelog updated: ${{ inputs.changelog_file }}"
119+
if [ "${{ inputs.prerelease }}" == "true" ]; then
120+
echo "đź”– This is a prerelease"
121+
fi
122+
else
123+
echo "ℹ️ No new version to release"
124+
fi

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Above example is just a simple example to call workflow from github shared workf
124124
27. [Terraform Workflow](./docs/27.terraform_workflow.md)
125125
28. [Terraform Module Tag Release Workflow (Shared)](./docs/28.tf-monorepo-tag-release.md)
126126
29. [Terraform PR Plan Diff workflow](./docs/29.tf-pr-checks.md)
127+
30. [Conventional Commits Workflows](./docs/30.conventional-commits.md)
127128
128129
## Feedback
129130
If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/github-shared-workflows/issues), or feel free to drop us an email at [[email protected]](mailto:[email protected]).

0 commit comments

Comments
 (0)