feat: initial rpm-changelog composite action

Generates an rpm %changelog entry from git history and prepends it
to the target spec file. Runs in release CI so every tag push gets
a fresh dated entry covering the commits since the previous matching
tag. Avoids stale dates, forgotten bumps, and bogus-weekday warnings.

Inputs: spec path, version, optional release suffix, author,
tag-pattern, exclude-patterns. The last two make the defaults (v*
tags, filter bump-version chores and merges) tweakable for projects
with different conventions.

Migrated from inline logic in helexa/cortex so any project can
adopt the same pattern with a single uses: reference.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-16 15:20:30 +03:00
commit 21de5b2b87
3 changed files with 251 additions and 0 deletions

62
action.yml Normal file
View File

@@ -0,0 +1,62 @@
name: 'Generate RPM %changelog entry'
description: >
Collect commits since the previous release tag and prepend a
properly-formatted %changelog entry to an rpm spec file. Keeps
the changelog in sync with git history automatically on every
release, avoiding stale dates and forgotten bumps.
author: 'helexa'
branding:
icon: file-text
color: blue
inputs:
spec:
description: 'Path to the rpm spec file to update.'
required: true
version:
description: >
Version string for the new entry (without release suffix).
Typically derived from the git tag, e.g. "0.1.10".
required: true
release:
description: 'Release suffix to append after the version.'
required: false
default: '1'
author:
description: >
Name and email for the changelog entry, formatted as
"Name <email@example.com>".
required: false
default: 'Gitea Actions <actions@git.lair.cafe>'
tag-pattern:
description: >
Glob pattern for release tags, used to locate the previous
release. Default matches the conventional "v*" scheme.
required: false
default: 'v*'
exclude-patterns:
description: >
Newline-separated list of grep -E patterns (anchored on the
bullet "- " prefix) to drop from the generated log. Defaults
filter out bump-version bot commits and merge commits.
required: false
default: |
^- chore: bump version
^- Merge
runs:
using: composite
steps:
- name: Generate changelog entry
shell: bash
env:
SPEC: ${{ inputs.spec }}
VERSION: ${{ inputs.version }}
RELEASE: ${{ inputs.release }}
CHANGELOG_AUTHOR: ${{ inputs.author }}
TAG_PATTERN: ${{ inputs.tag-pattern }}
EXCLUDE_PATTERNS: ${{ inputs.exclude-patterns }}
run: |
bash "${{ github.action_path }}/scripts/generate-rpm-changelog.sh" \
"$SPEC" "$VERSION"