Skip to content

Commit f7e2806

Browse files
committed
feat: commit-check action first commit
1 parent 74a297d commit f7e2806

File tree

7 files changed

+184
-2
lines changed

7 files changed

+184
-2
lines changed

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
ko_fi: shenxianpeng
3+
# custom: ["https://www.paypal.me/shenxianpeng"]

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: docker
9+
directory: /
10+
schedule:
11+
interval: "weekly"
12+
- package-ecosystem: github-actions
13+
directory: /
14+
schedule:
15+
interval: "weekly"
16+
- package-ecosystem: pip
17+
directory: /
18+
schedule:
19+
interval: "weekly"

.github/stale.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_extends: .github

.github/workflow/main.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: main
2+
3+
on:
4+
release:
5+
branches: [main]
6+
types: [published]
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'which tag to update to'
11+
default: 'v1'
12+
required: true
13+
ref:
14+
description: 'which branch to update the tag on'
15+
default: 'main'
16+
required: true
17+
18+
jobs:
19+
re-tag:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
ref: ${{ inputs.ref }}
26+
- name: Config git name and email
27+
run: |
28+
git config user.name 'github-actions'
29+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
30+
- name: Update tag with parameter
31+
if: github.event.inputs.tag != ''
32+
run: |
33+
git tag --delete ${{ inputs.tag }} || true
34+
git push --delete origin ${{ inputs.tag }} || true
35+
git tag -a ${{ inputs.tag }} -m 'Retag ${{ inputs.tag }}'
36+
git push origin ${{ inputs.tag }}
37+
- name: Update tag to v1
38+
if: github.event.inputs.tag == ''
39+
run: |
40+
git tag --delete v1 || true
41+
git push --delete origin v1 || true
42+
git tag -a v1 -m 'Retag v1'
43+
git push origin v1
44+
45+
commit-check:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v3
49+
- uses: commit-check/commit-check-action@v1
50+
id: check
51+
with:
52+
message: true
53+
branch: true
54+
author-name: true
55+
author-email: true
56+
dry-run: true

README.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,43 @@
1-
# commit-check-action
2-
Commit-Check GitHub Action
1+
# Commit-Check GitHub Action
2+
3+
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/commit-check/commit-check-action)
4+
[![GitHub marketplace](https://img.shields.io/badge/marketplace-C%2FC%2B%2B%20Linter-blue?logo=github)](https://github.com/marketplace/actions/commit-check)
5+
6+
A Github Action for checking commit message formatting, branch naming, referencing Jira tickets, and more.
7+
8+
## Optional Inputs
9+
10+
### `message`
11+
12+
- **Description**: check commit message formatting convention
13+
- By default the rule follows [conventionalcommits](https://www.conventionalcommits.org/)
14+
- Default: 'true'
15+
16+
### `branch`
17+
18+
- **Description**: check git branch naming convention
19+
- By default follow bitbucket [branching model](https://support.atlassian.com/bitbucket-cloud/docs/configure-a-projects-branching-model/)
20+
- Default: 'true'
21+
22+
### `author-name`
23+
24+
- **Description**: check committer author name
25+
- Default: 'true'
26+
27+
### `author-email`
28+
29+
- **Description**: check committer author email
30+
- Default: 'true'
31+
32+
### `dry-run`
33+
34+
- **Description**: run checks without failing
35+
- Default: 'false'
36+
37+
Note: to change the default rules of above inputs, just add your own [`.commit-check.yml`](https://github.com/commit-check/commit-check#usage) config file.
38+
39+
## Versioning
40+
41+
Versioning follows [Semantic Versioning](https://semver.org/).
42+
43+
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/H2H85WC9L)

action.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Commit Check
2+
description: Check commit message formatting, branch naming, referencing Jira tickets, and more
3+
author: shenxianpeng
4+
branding:
5+
icon: "check-circle"
6+
color: "green"
7+
inputs:
8+
message:
9+
description: check commit message formatting convention
10+
required: false
11+
default: true
12+
branch:
13+
description: check git branch naming convention
14+
required: false
15+
default: true
16+
author-name:
17+
description: check committer author name
18+
required: false
19+
default: true
20+
author-email:
21+
description: check committer author email
22+
required: false
23+
default: true
24+
dry-run:
25+
description: run checks without failing
26+
required: false
27+
default: false
28+
runs:
29+
using: "composite"
30+
steps:
31+
- name: Install action dependencies
32+
shell: bash
33+
run: |
34+
if [[ "${{runner.os}}" == "Linux" ]]; then
35+
# https://github.com/pypa/setuptools/issues/3269
36+
export DEB_PYTHON_INSTALL_LAYOUT=deb
37+
fi
38+
python3 -m pip install -r '${{ github.action_path }}/requirements.txt'
39+
- name: Run commit-check
40+
id: commit-check
41+
shell: bash
42+
run: |
43+
args=""
44+
if [ "${{ inputs.message }}" == "true" ]; then
45+
args="$args --message"
46+
fi
47+
if [ "${{ inputs.branch }}" == "true" ]; then
48+
args="$args --branch"
49+
fi
50+
if [ "${{ inputs.author-name }}" == "true" ]; then
51+
args="$args --author-name"
52+
fi
53+
if [ "${{ inputs.author-email }}" == "true" ]; then
54+
args="$args --author-email"
55+
fi
56+
if [ "${{ inputs.dry-run }}" == "true" ]; then
57+
args="$args --dry-run"
58+
fi
59+
commit-check $args

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Install commit-check CLI
2+
# For details please see: https://github.com/commit-check/commit-check
3+
commit-check==0.2.3

0 commit comments

Comments
 (0)