Skip to content

Commit

Permalink
ci(runtime): update GitHub release_and_tagging workflow
Browse files Browse the repository at this point in the history
- Improve curl command for getting latest release with additional headers
- Enhance changelog generation process:
- Add header for changelog
- Handle case when LATEST_RELEASE is "null"
  - Optimize git log formatting
  • Loading branch information
godcong committed Nov 28, 2024
1 parent 6a8007d commit eb1f4d8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/release_and_tagging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ jobs:
- name: Get latest release
id: get_latest_release
run: |
LATEST_RELEASE=$(curl -s -H "Authorization: token ${{ env.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')
LATEST_RELEASE=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Authorization: token ${{ env.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')
echo "LATEST_RELEASE=$LATEST_RELEASE" >> $GITHUB_OUTPUT
- name: Determine next version
Expand All @@ -60,9 +63,10 @@ jobs:
id: generate_changelog
run: |
LATEST_RELEASE=${{ steps.get_latest_release.outputs.LATEST_RELEASE }}
echo "LATEST_RELEASE=$LATEST_RELEASE" >> $GITHUB_OUTPUT
if [[ -z "$LATEST_RELEASE" ]]; then
# If there's no previous release, get only the current commit's log
echo "LATEST_RELEASE is $LATEST_RELEASE"
echo "# Changelog" > changelog.txt
if [[ -z "$LATEST_RELEASE" || "$LATEST_RELEASE" == "null" ]]; then
# If there's no previous release, get only the current commit log
git config --global core.pager cat
# git log --pretty=format:"* %s **by** @%an"
git log --pretty=format:"* %s **by** @%an" >> changelog.txt
Expand Down

0 comments on commit eb1f4d8

Please sign in to comment.