File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919 with :
2020 fetch-depth : 0
2121
22- - name : Set $TAG env var
23- run : echo "${{github.ref}}" | sed 's/refs\/tags\///' | xargs -I $ echo "::set-env name=TAG::$"
24-
2522 - name : Generate list of changes
2623 run : scripts/generate_release_notes.sh > .release.md
2724
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- if [ -z " $TAG " ]
3+ GITHUB_REF=${GITHUB_REF:- refs/ heads/ master}
4+
5+ git rev-parse $GITHUB_REF > /dev/null 2>&1
6+ if [ $? != 0 ]
47then
5- echo " \$ TAG is empty "
8+ echo " \$ GITHUB_REF is invalid "
69 exit 1
710fi
811
9- export PREVIOUS_TAG=$( git tag --sort=refname | grep $TAG -B 1 | grep -m1 " " )
12+ if [[ $GITHUB_REF = refs/tags/* ]]
13+ then
14+ # previous tag
15+ export PREVIOUS_REF=$( git tag --sort=refname --format=' %(refname)' | grep $GITHUB_REF -B 1 | grep -m1 " " )
16+ else
17+ # latest tag
18+ export PREVIOUS_REF=$( git tag --sort=-refname --format=' %(refname)' | grep -m1 " " )
19+ fi
1020
1121cat << EOF
1222## Changes
13- $( git log $TAG ...$PREVIOUS_TAG --format=" - [%h](../../commit/%h) %s" )
23+ $( git log $GITHUB_REF ...$PREVIOUS_REF --format=" - [%h](../../commit/%h) %s" )
1424EOF
You can’t perform that action at this time.
0 commit comments