Update previous version for 'git compare'

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>
This commit is contained in:
Sachin Sahu 2024-05-30 13:54:38 +00:00
parent eac0ae0a4f
commit 790fa2a391
2 changed files with 5 additions and 2 deletions

View File

@ -31,11 +31,12 @@ jobs:
id: tag_name
run: |
echo "tag_name=$(cat VERSION)" >> $GITHUB_ENV
echo "prev_tag_name=$(git show HEAD~1:VERSION)" >> $GITHUB_ENV
- name: Get Base SHA from Tag
id: base_sha
run: |
echo "base_sha=$(git rev-list -n 1 "v${{ env.tag_name }}")" >> $GITHUB_ENV
echo "base_sha=$(git rev-list -n 1 "v${{ env.prev_tag_name }}")" >> $GITHUB_ENV
continue-on-error: true
- name: Create Pull Request

View File

@ -7,12 +7,14 @@ CURR_DIR=$(pwd)
VERSION=$(cat VERSION)
TAG_NAME="v${VERSION}"
PREVIOUS_VERSION=$(git show HEAD~1:VERSION)
MANUAL_START_SHA=$1
MANUAL_END_SHA=$2
# Get the start SHA based on the tag, if not manually provided
if [ -z "$MANUAL_START_SHA" ]; then
START_SHA=$(git rev-list -n 1 "${TAG_NAME}")
START_SHA=$(git rev-list -n 1 "v${PREVIOUS_VERSION}")
else
START_SHA=$MANUAL_START_SHA
fi