Skip to content

Commit

Permalink
ci: calculate the release notes correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredrik Arvidsson committed Feb 12, 2022
1 parent 7e9fdb4 commit a880855
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,26 @@ jobs:
- name: Determine Release Info
id: release
run: |
from_tag=$(git tag --points-at ${{ steps.gitversion.outputs.versionSourceSha }} | grep -m 1 ^v[0-9]*\.[0-9]*\.[0-9]* | head -1)
[[ -z "$from_tag" ]] && \
from_ref_exclusive=${{ steps.gitversion.outputs.versionSourceSha }} || \
from_ref_exclusive=$from_tag
default_branch=$(git remote show origin | awk '/HEAD branch/ {print $NF}')
if [ "${{ github.ref_name }}" == "$default_branch" ]; then
# Extract the branch name of the branch that merged into the current commit
commit_subject=$(git log -1 --pretty=format:%s)
regex='Merge pull request #[0-9]+ from .+/(.+)$'
[[ $commit_subject =~ $regex ]]
merged_branch=${BASH_REMATCH[1]}
[[ -z "$merged_branch" ]] && \
# Committed directly on default branch, use the previous commit
from_ref_exclusive=$(git log -2 --pretty=format:"%H" | tail -1)
# Find what commit the merged branch branched from originally
from_ref_exclusive=$(diff -u <(git rev-list --first-parent $merged_branch) \
<(git rev-list --first-parent $default_branch) | \
sed -ne 's/^ //p' | head -1)
else
# Get the commit this branch branched from
from_ref_exclusive=$(git rev-list $(git rev-list $default_branch.. | tail -1)^ -n 1)
fi
[[ -z "${{ steps.gitversion.outputs.preReleaseTag }}" ]] && \
is_prerelease=false || \
Expand Down

0 comments on commit a880855

Please sign in to comment.