ci: fix changelog step on shallow checkout and small repos
Release / release (push) Failing after 54s
Release / release (push) Failing after 54s
- Set fetch-depth: 0 so previous tag lookups work across full history. - Use `-n 20` instead of HEAD~20..HEAD, which fails when the repo has fewer than 20 commits (e.g. on the first release).
This commit is contained in:
@@ -15,6 +15,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Extract version from tag
|
- name: Extract version from tag
|
||||||
id: version
|
id: version
|
||||||
@@ -69,7 +71,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
PREV_TAG=$(git tag --sort=-v:refname | head -2 | tail -1)
|
PREV_TAG=$(git tag --sort=-v:refname | head -2 | tail -1)
|
||||||
if [ -z "$PREV_TAG" ] || [ "$PREV_TAG" = "${{ gitea.ref_name }}" ]; then
|
if [ -z "$PREV_TAG" ] || [ "$PREV_TAG" = "${{ gitea.ref_name }}" ]; then
|
||||||
CHANGELOG=$(git log --oneline --no-decorate HEAD~20..HEAD)
|
CHANGELOG=$(git log --oneline --no-decorate -n 20)
|
||||||
else
|
else
|
||||||
CHANGELOG=$(git log --oneline --no-decorate ${PREV_TAG}..HEAD)
|
CHANGELOG=$(git log --oneline --no-decorate ${PREV_TAG}..HEAD)
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user