mirror of
https://github.com/beclab/Olares
synced 2026-04-21 13:37:46 +00:00
ci: add validating step to workflow and git-hook to the code committing (#61)
* ci: add validate step to workflow and git-hook to commit * ci: add validate step to workflow and git-hook to commit --------- Co-authored-by: liuyu <>
This commit is contained in:
parent
6b12243c5b
commit
af39f0bb23
4 changed files with 46 additions and 3 deletions
30
.githooks/commit-msg
Normal file
30
.githooks/commit-msg
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# @author : Mak Sophea
|
||||
# @version : 1.0#
|
||||
# Create a regex for a conventional commit.
|
||||
commit_types="(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|wip)"
|
||||
convetional_commit_regex="^${commit_types}(\([a-z \-]+\))?!?: .+$"
|
||||
|
||||
# Get the commit message (the parameter we're given is just the path to the
|
||||
# temporary file which holds the message).
|
||||
commit_message=$(cat "$1")
|
||||
|
||||
# Check the message, if we match, all good baby.
|
||||
if [[ "$commit_message" =~ $convetional_commit_regex ]]; then
|
||||
echo -e "\e[32mCommit message meets Conventional Commit standards...\e[0m"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Uh-oh, this is not a conventional commit, show an example and link to the spec.
|
||||
echo -e "\e[31mThe commit message does not meet the Conventional Commit standard\e[0m"
|
||||
echo "An example of a valid message is: "
|
||||
echo " feat(login): add the 'remember me' button"
|
||||
echo "More details at: https://www.conventionalcommits.org/en/v1.0.0/#summary"
|
||||
echo "***********************************************************************"
|
||||
echo "Here are the list of message type : ${commit_types}"
|
||||
echo " <type>: <subject> max 50char ex :- fix: invalid request for login api"
|
||||
echo " <type(<scope>):> <subject> (Max 50 char) - <scope> is option ex: - fix(user): email address is empty on profile api"
|
||||
echo "***********************************************************************"
|
||||
|
||||
exit 1
|
||||
7
.githooks/git-hooks-config.sh
Normal file
7
.githooks/git-hooks-config.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
# This script will config git hook path into specific folder in your project. This script will invoked by maven build.
|
||||
# @author : Mak Sophea
|
||||
# @version : 1.0#
|
||||
#
|
||||
echo "config git hooksPath to .githooks folder for commit-msg and pre-push"
|
||||
git config core.hooksPath .githooks
|
||||
10
.github/workflows/check.yaml
vendored
10
.github/workflows/check.yaml
vendored
|
|
@ -2,15 +2,21 @@ name: Lint and Test Charts
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
branches: [ "main", "release-*" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
branches: [ "main", "release-*" ]
|
||||
|
||||
|
||||
jobs:
|
||||
lint-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: PR Conventional Commit Validation
|
||||
uses: ytanikin/PRConventionalCommits@1.1.0
|
||||
with:
|
||||
task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert"]'
|
||||
add_label: 'true'
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
|
|
|||
2
.github/workflows/release-daily.yaml
vendored
2
.github/workflows/release-daily.yaml
vendored
|
|
@ -21,7 +21,7 @@ jobs:
|
|||
run: |
|
||||
v=1.5.0-$(date +"%Y%m%d")
|
||||
echo "tag_version=$v" >> $GITHUB_OUTPUT
|
||||
echo "latest_version=1.4.1"
|
||||
echo "latest_version=1.4.2"
|
||||
|
||||
- name: Package installer
|
||||
run: |
|
||||
|
|
|
|||
Loading…
Reference in a new issue