diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 35b79b3..533aba4 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -5,4 +5,4 @@ branch=$(git branch --show-current) if [ "$branch" = "main" ] || [ "$branch" = "master" ]; then echo "🚨🚨 You can not commit to the master branch. Please switch to the dev branch." exit 1 -fi \ No newline at end of file +fi diff --git a/.githooks/prepare-commit-msg b/.githooks/prepare-commit-msg index d676a75..7abad70 100755 --- a/.githooks/prepare-commit-msg +++ b/.githooks/prepare-commit-msg @@ -9,19 +9,24 @@ echo "Running prepare-commit-msg hook" # get the current branch name BRANCH_NAME=$(git branch --show-current) -# return if not in dev branch -if [ "$BRANCH_NAME" != "dev" ]; then - exit 0 -fi - # read the content of the README.md file PHIL_PROJECT_FILE=$(cat .phil-project) # get the version of the project VERSION=$(echo $PHIL_PROJECT_FILE | grep -oP 'version:\K[0-9]+\.[0-9]+\.[0-9]+') -echo "v$VERSION - $(cat $COMMIT_MSG_FILE)" > $COMMIT_MSG_FILE +# get the branch name and split it by '-' and get the first element +issue_id=$(echo $BRANCH_NAME | cut -d'-' -f1) + +if [ ! -z "$issue_id" ]; then + echo "Found Issue ID: $issue_id" + issue_id="[#$issue_id] $VERSION -" +else + issue_id="$VERSION -" +fi + +echo "$issue_id $(cat $COMMIT_MSG_FILE)" > $COMMIT_MSG_FILE -echo "$(cat $COMMIT_MSG_FILE)" +echo "Updated commit message: $(cat $COMMIT_MSG_FILE)" echo "prepare-commit-msg hook finished" \ No newline at end of file diff --git a/.github/workflows/check_rust_quality.yml b/.github/workflows/check_rust_quality.yml index c51d0f0..f5168aa 100644 --- a/.github/workflows/check_rust_quality.yml +++ b/.github/workflows/check_rust_quality.yml @@ -2,8 +2,7 @@ name: Run rust quality checks on: push: - branches: - - dev + branches: ['*'] workflow_call: inputs: branch: @@ -35,7 +34,7 @@ jobs: run: ./scripts/test - name: Merge to master branch - if: ${{ inputs.branch != 'master' }} + if: ${{ inputs.branch == 'dev' }} uses: peter-evans/create-pull-request@v3 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/test b/test new file mode 100644 index 0000000..b4a6a5f --- /dev/null +++ b/test @@ -0,0 +1 @@ +[#8] 1.0.0 - [#8] 1.0.0 - [#8] 1.0.0 - 1.0.0 - 1.0.0 -