Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8 add issue id to commit #9

Merged
merged 5 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -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
fi
19 changes: 12 additions & 7 deletions .githooks/prepare-commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
5 changes: 2 additions & 3 deletions .github/workflows/check_rust_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Run rust quality checks

on:
push:
branches:
- dev
branches: ['*']
workflow_call:
inputs:
branch:
Expand Down Expand Up @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[#8] 1.0.0 - [#8] 1.0.0 - [#8] 1.0.0 - 1.0.0 - 1.0.0 -
Loading