diff --git a/.github/actions/predict-next-version/git_predict_next_version.sh b/.github/actions/predict-next-version/git_predict_next_version.sh index 01b38c3..bfc17c1 100755 --- a/.github/actions/predict-next-version/git_predict_next_version.sh +++ b/.github/actions/predict-next-version/git_predict_next_version.sh @@ -30,15 +30,17 @@ git fetch function get_logs() { if [ "$GIT_LOGS" == "" ]; then - git log origin/main.. + git log $(git merge-base HEAD origin/main)..HEAD else echo "$GIT_LOGS" fi } -BREAKING_CHANGES="$(get_logs | grep "^\s*BREAKING CHANGE:")" -MINOR_CHANGES="$(get_logs | grep "^\s*feat[(:]")" -PATCH_CHANGES="$(get_logs | grep "^\s*fix[(:]")" +GIT_LOGS="$(get_logs)" + +BREAKING_CHANGES="$(echo "$GIT_LOGS" | grep "^\s*BREAKING CHANGE:")" +MINOR_CHANGES="$(echo "$GIT_LOGS" | grep "^\s*feat[(:]")" +PATCH_CHANGES="$(echo "$GIT_LOGS" | grep "^\s*fix[(:]")" function print_changes() { local title=$1 diff --git a/.github/actions/tag-jira-release/git_predict_next_version.sh b/.github/actions/tag-jira-release/git_predict_next_version.sh index 024243a..96cc291 100755 --- a/.github/actions/tag-jira-release/git_predict_next_version.sh +++ b/.github/actions/tag-jira-release/git_predict_next_version.sh @@ -30,15 +30,17 @@ git fetch function get_logs() { if [ "$GIT_LOGS" == "" ]; then - git log ${TARGET_BRANCH}.. + git log $(git merge-base HEAD ${TARGET_BRANCH})..HEAD else echo "$GIT_LOGS" fi } -BREAKING_CHANGES="$(get_logs | grep "^\s*BREAKING CHANGE:")" -MINOR_CHANGES="$(get_logs | grep "^\s*feat[(:]")" -PATCH_CHANGES="$(get_logs | grep "^\s*fix[(:]")" +GIT_LOGS="$(get_logs)" + +BREAKING_CHANGES="$(echo "$GIT_LOGS" | grep "^\s*BREAKING CHANGE:")" +MINOR_CHANGES="$(echo "$GIT_LOGS" | grep "^\s*feat[(:]")" +PATCH_CHANGES="$(echo "$GIT_LOGS" | grep "^\s*fix[(:]")" function print_changes() { local title=$1 diff --git a/.github/actions/tag-jira-release/ticket_status.sh b/.github/actions/tag-jira-release/ticket_status.sh index a0e3733..c90b275 100755 --- a/.github/actions/tag-jira-release/ticket_status.sh +++ b/.github/actions/tag-jira-release/ticket_status.sh @@ -12,13 +12,16 @@ CURRENT_BRANCH=$1 if [ "$CURRENT_BRANCH" == "" ]; then echo "Usage: [current_branch] [(optional) target_branch]" exit 1 +elif [ "$CURRENT_BRANCH" == "." ]; then + CURRENT_BRANCH=$(git branch --show-current) fi TARGET_BRANCH=main if [ "$2" != "" ]; then TARGET_BRANCH=$2 fi -HASHES=$(git log $TARGET_BRANCH..$CURRENT_BRANCH --pretty=format:'%H') +COMMON_BRANCH=$(git merge-base $TARGET_BRANCH $CURRENT_BRANCH) +HASHES=$(git log $COMMON_BRANCH..$CURRENT_BRANCH --pretty=format:'%H') if [ ! -d ~/temp ]; then mkdir ~/temp diff --git a/.github/workflows/tag-tickets-with-release.yml b/.github/workflows/tag-tickets-with-release.yml index 8cdc554..b84cfad 100644 --- a/.github/workflows/tag-tickets-with-release.yml +++ b/.github/workflows/tag-tickets-with-release.yml @@ -41,7 +41,8 @@ jobs: - name: create prompt id: create_prompt run: | - DIFF="$(git log --pretty=format:'%s' ${TARGET_BRANCH}..HEAD)" + COMMON_BRANCH=$(git merge-base HEAD ${TARGET_BRANCH}) + DIFF="$(git log --pretty=format:'%s' ${COMMON_BRANCH}..HEAD)" LLM_PROMPT_PREFIX="Create a fun release description in 100 characters or less in one line without identifiers for the following data: " LLM_PROMPT="$LLM_PROMPT_PREFIX$DIFF" diff --git a/package.json b/package.json index d40e293..883629c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-actions", - "version": "2.5.1", + "version": "2.5.2", "description": "Used to store GitHub actions for use across the enterprise", "scripts": { "test": "./tooling/scripts/run_tests.sh", diff --git a/tooling/scripts/git_predict_next_version.sh b/tooling/scripts/git_predict_next_version.sh index 01b38c3..bfc17c1 100755 --- a/tooling/scripts/git_predict_next_version.sh +++ b/tooling/scripts/git_predict_next_version.sh @@ -30,15 +30,17 @@ git fetch function get_logs() { if [ "$GIT_LOGS" == "" ]; then - git log origin/main.. + git log $(git merge-base HEAD origin/main)..HEAD else echo "$GIT_LOGS" fi } -BREAKING_CHANGES="$(get_logs | grep "^\s*BREAKING CHANGE:")" -MINOR_CHANGES="$(get_logs | grep "^\s*feat[(:]")" -PATCH_CHANGES="$(get_logs | grep "^\s*fix[(:]")" +GIT_LOGS="$(get_logs)" + +BREAKING_CHANGES="$(echo "$GIT_LOGS" | grep "^\s*BREAKING CHANGE:")" +MINOR_CHANGES="$(echo "$GIT_LOGS" | grep "^\s*feat[(:]")" +PATCH_CHANGES="$(echo "$GIT_LOGS" | grep "^\s*fix[(:]")" function print_changes() { local title=$1