helm-gitea/.gitea/workflows/changelog.yml
pat-s 724ebc5258 ci: fetch tags during checkout (#806)
Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/806
Reviewed-by: justusbunsi <justusbunsi@noreply.gitea.com>
Co-authored-by: pat-s <patrick.schratz@gmail.com>
Co-committed-by: pat-s <patrick.schratz@gmail.com>
2025-02-23 14:43:29 +00:00

33 lines
1.3 KiB
YAML

name: changelog
on:
push:
branches:
- main
jobs:
changelog:
runs-on: ubuntu-latest
container: docker.io/thegeeklab/git-sv:1.0.11
steps:
- name: install tools
run: |
apk add -q --update --no-cache nodejs curl jq sed
- uses: actions/checkout@v4
with:
fetch-tags: true
- name: Generate upcoming changelog
run: |
git sv rn -o changelog.md
export RELEASE_NOTES=$(cat changelog.md)
export ISSUE_NUMBER=$(curl -s "${{ gitea.event.repository.html_url }}/api/v1/repos/${{ gitea.repository }}/issues?state=open&q=Changelog%20for%20upcoming%20version" | jq '.[].number')
echo $RELEASE_NOTES
JSON_DATA=$(echo "" | jq -Rs --arg title 'Changelog for upcoming version' --arg body "$(cat changelog.md)" '{title: $title, body: $body}')
if [ -z "$ISSUE_NUMBER" ]; then
curl -s -X POST "${{ gitea.event.repository.html_url }}/api/v1/repos/${{ gitea.repository }}/issues?token=${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA"
else
curl -s -X PATCH "${{ gitea.event.repository.html_url }}/api/v1/repos/${{ gitea.repository }}/issues/$ISSUE_NUMBER?token=${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA"
fi