mirror of
https://github.com/taiki-e/install-action.git
synced 2026-05-06 21:20:26 +00:00
codegen: Improve changelog handling
This commit is contained in:
3
.github/workflows/manifest.yml
vendored
3
.github/workflows/manifest.yml
vendored
@@ -32,7 +32,7 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
manifest:
|
||||
uses: taiki-e/github-actions/.github/workflows/gen.yml@75415970465917c31d702710acd9c9248b9af314 # main
|
||||
uses: taiki-e/github-actions/.github/workflows/gen.yml@a6df8c9ea0038c730f138f0f849d692cf387ea4e # main
|
||||
permissions:
|
||||
contents: write # for creating branch for pr
|
||||
pull-requests: write # for gh pr review --approve
|
||||
@@ -46,3 +46,4 @@ jobs:
|
||||
automerge: true
|
||||
install-rust: true
|
||||
install-cosign: true
|
||||
install-parse-changelog: true
|
||||
|
||||
@@ -30,9 +30,14 @@ for manifest in manifests/*.json; do
|
||||
git stash pop
|
||||
new_version=$(jq -r '.latest.version' "${manifest}")
|
||||
if [[ "${old_version}" != "${new_version}" ]]; then
|
||||
# TODO: If there is a line about updating the same tool in the "Unreleased" section, replace it.
|
||||
unreleased=$(parse-changelog CHANGELOG.md Unreleased)
|
||||
msg="Update \`${name}@latest\` to ${new_version}"
|
||||
sed -Ei "s/^## \\[Unreleased\\]/## [Unreleased]\\n\\n- ${msg}./" CHANGELOG.md
|
||||
if grep -Eq "^- Update \`${name}@latest\` to " <<<"${unreleased}"; then
|
||||
# If there is a line about updating the same tool in the "Unreleased" section, replace it.
|
||||
sed -Ei "0,/^- Update \`${name}@latest\` to .*/s//- ${msg}./" CHANGELOG.md
|
||||
else
|
||||
sed -Ei "s/^## \\[Unreleased\\]/## [Unreleased]\\n\\n- ${msg}./" CHANGELOG.md
|
||||
fi
|
||||
git add "${manifest}" CHANGELOG.md
|
||||
else
|
||||
msg="Update ${name} manifest"
|
||||
|
||||
Reference in New Issue
Block a user