Skip to content

Commit 50d96ec

Browse files
committed
Refactor GitHub release retrieval logic to use API response for latest release name and tag
1 parent e8488c4 commit 50d96ec

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/build_packages_info.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ jobs:
6868
gh_last_commit=$(git log -1 --format=%cs)
6969
echo "last commit: $gh_last_commit"
7070
71-
# Last release
72-
if [ $(git rev-list --tags --max-count=1) ]; then
73-
gh_last_release=$(git describe --tags $(git rev-list --tags --max-count=1))
74-
else
75-
gh_last_release=""
76-
fi
71+
# Last release. Really this is the last tag.
72+
#if [ $(git rev-list --tags --max-count=1) ]; then
73+
# gh_last_release=$(git describe --tags $(git rev-list --tags --max-count=1))
74+
#else
75+
# gh_last_release=""
76+
#fi
7777

78-
echo "last GitHub release: $gh_last_release"
78+
#echo "last GitHub release: $gh_last_release"
7979

8080
# If there is a NAMES file then parse it to get the functino list and save the output
8181
if [ -f "NAMESPACE" ]; then
@@ -95,8 +95,15 @@ jobs:
9595
echo "API response:"
9696
cat gh_repo_info.json
9797

98+
# Get the last release name or tag name from the API response
9899
gh_last_release=$(cat gh_repo_info.json | jq '.latestRelease.name')
99-
echo "GitHub last release: $gh_last_release"
100+
if [ -z "${gh_last_release}" ] || [ "${gh_last_release}" = '""' ]; then
101+
gh_last_release=$(cat gh_repo_info.json | jq '.latestRelease.tagName')
102+
if [ -z "${gh_last_release}" ] || [ "${gh_last_release}" = '""' ]; then
103+
gh_last_release=""
104+
fi
105+
fi
106+
echo "GitHub last release: $gh_last_release"
100107

101108

102109
# Get the license as it appears in GitHub

0 commit comments

Comments
 (0)