diff --git a/.github/workflows/manifest.yml b/.github/workflows/manifest.yml index 05a73440..1d9775f8 100644 --- a/.github/workflows/manifest.yml +++ b/.github/workflows/manifest.yml @@ -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 diff --git a/tools/ci/manifest.sh b/tools/ci/manifest.sh index 112babcb..29b2696e 100755 --- a/tools/ci/manifest.sh +++ b/tools/ci/manifest.sh @@ -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"