Files
rpm-changelog/action.yml
rob thijssen 328101f247 feat: add source-dir and repo-url inputs for external repo support
Allow changelog generation from upstream repositories instead of only
the current working directory. Supports packaging repos that contain
only rpm spec files while the source lives in an external git repo.

- source-dir: point at an existing local checkout
- repo-url: action clones a bare copy automatically
- source-dir takes precedence if both are set

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 10:36:00 +03:00

81 lines
2.6 KiB
YAML

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
source-dir:
description: >
Path to a local git checkout to collect commits from, instead
of the current working directory. Useful when your packaging
repo is separate from the upstream source repo and you have
already cloned the source elsewhere in the workflow.
required: false
default: ''
repo-url:
description: >
URL of an external git repository to collect commits from.
The action will clone (bare, tags-only) this repo into a
temporary directory and read its history. Mutually exclusive
with source-dir — if both are set, source-dir wins.
required: false
default: ''
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 }}
SOURCE_DIR: ${{ inputs.source-dir }}
REPO_URL: ${{ inputs.repo-url }}
run: |
bash "${{ github.action_path }}/scripts/generate-rpm-changelog.sh" \
"$SPEC" "$VERSION"