Skip to content

Add release bot#77

Merged
Tim-herbie merged 22 commits into
mainfrom
feature/add-release-bot
Apr 23, 2026
Merged

Add release bot#77
Tim-herbie merged 22 commits into
mainfrom
feature/add-release-bot

Conversation

@Tim-herbie
Copy link
Copy Markdown
Owner

The bot automatically opens and updates a release PR from changes pushed to main, generates a structured changelog with linked pull requests, bumps the Helm chart version, updates release-related docs, and, once that release PR is merged, creates the git tag, publishes the Helm chart to GHCR, and creates the GitHub release.

Copilot AI review requested due to automatic review settings April 23, 2026 20:14
@Tim-herbie Tim-herbie merged commit 0f6e768 into main Apr 23, 2026
1 check passed
@Tim-herbie Tim-herbie deleted the feature/add-release-bot branch April 23, 2026 20:18
@Tim-herbie Tim-herbie mentioned this pull request Apr 23, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an automated “release bot” GitHub Actions workflow to manage release PR creation/updates, version bumping, and post-merge publishing/tagging, while cleaning up older Helm publishing automation.

Changes:

  • Introduces .github/workflows/release-bot.yml to generate/update a release PR (changelog, Chart.yaml version/appVersion, README updates) and, on merge, tag + publish chart to GHCR + create a GitHub release.
  • Removes the manual Helm publishing workflow (.github/workflows/publish-helm-charts.yml).
  • Minor README formatting fix; adds an empty test.txt.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
README.md Minor formatting adjustment in Quick Start section.
.github/workflows/release-bot.yml New release automation workflow (release PR generation + tagging + Helm publish + GitHub release).
.github/workflows/publish-helm-charts.yml Deletes the old manual Helm publishing workflow in favor of the new bot.
test.txt Adds an empty file (no functional impact).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +229 to +243
BEGIN { skip = 0 }
/<!-- release-bot:start -->/ {
print
print ""
while ((getline line < "CHANGELOG_SECTION.md") > 0) print line
print ""
skip = 1
next
}
/<!-- release-bot:end -->/ {
skip = 0
print
next
}
skip == 0 { print }
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog update logic replaces everything between <!-- release-bot:start --> and <!-- release-bot:end --> with only the newly generated CHANGELOG_SECTION.md. On subsequent releases this will overwrite (and effectively delete) previously generated release sections, so CHANGELOG.md will only ever contain the latest release in that region. Consider prepending the new section while preserving the existing content between the markers (e.g., insert CHANGELOG_SECTION.md immediately after the start marker and then keep the old in-marker content below it).

Suggested change
BEGIN { skip = 0 }
/<!-- release-bot:start -->/ {
print
print ""
while ((getline line < "CHANGELOG_SECTION.md") > 0) print line
print ""
skip = 1
next
}
/<!-- release-bot:end -->/ {
skip = 0
print
next
}
skip == 0 { print }
BEGIN {
in_section = 0
preserved = ""
new_section = ""
while ((getline line < "CHANGELOG_SECTION.md") > 0) {
new_section = new_section line ORS
}
close("CHANGELOG_SECTION.md")
}
/<!-- release-bot:start -->/ {
print
print ""
printf "%s", new_section
print ""
in_section = 1
next
}
/<!-- release-bot:end -->/ {
if (preserved != "") {
printf "%s", preserved
print ""
}
in_section = 0
print
next
}
in_section {
preserved = preserved $0 ORS
next
}
{ print }

Copilot uses AI. Check for mistakes.

jobs:
prepare-release-pr:
if: "${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && !contains(github.event.head_commit.message, 'chore(release): v')) }}"
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The push-trigger guard excludes commits containing chore(release): v, but the workflow creates commits with chore(release): prepare v.... If the release PR is merged using a strategy that preserves commit messages (e.g., rebase/merge), the next push to main may not be filtered and could immediately open another release PR and bump again. Align the filter with the actual commit message/prefix used by the bot (or switch to filtering by branch/PR metadata instead of commit message).

Suggested change
if: "${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && !contains(github.event.head_commit.message, 'chore(release): v')) }}"
if: "${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(release): prepare v')) }}"

Copilot uses AI. Check for mistakes.
Comment on lines +269 to +281
TABLE_ROW="| ${OPENCLOUD_VERSION} | ${NEXT_VERSION} |"
if ! grep -Fq "$TABLE_ROW" README.md; then
awk -v row="$TABLE_ROW" '
{
print
if ($0 ~ /^\|[-]+\|[-]+\|$/) {
print row
}
}
' README.md > README.new.md
mv README.new.md README.md
fi

Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version-table update injects a brand-new row immediately after the table separator line. In the current README the version table groups multiple chart versions per OpenCloud version (e.g., 4.1.0 and 5.0.2 rows), so this automation will create duplicate OpenCloud-version rows and also change the ordering by always inserting at the top. Consider updating the existing row for OPENCLOUD_VERSION (append NEXT_VERSION to the chart-version cell) and only inserting a new row when that OpenCloud version is not present, ideally preserving the table's ordering.

Suggested change
TABLE_ROW="| ${OPENCLOUD_VERSION} | ${NEXT_VERSION} |"
if ! grep -Fq "$TABLE_ROW" README.md; then
awk -v row="$TABLE_ROW" '
{
print
if ($0 ~ /^\|[-]+\|[-]+\|$/) {
print row
}
}
' README.md > README.new.md
mv README.new.md README.md
fi
awk -v opencloud_version="${OPENCLOUD_VERSION}" -v next_version="${NEXT_VERSION}" '
function trim(value) {
gsub(/^[[:space:]]+|[[:space:]]+$/, "", value)
return value
}
function contains_version(list, version, items, i, n) {
n = split(list, items, /,[[:space:]]*/)
for (i = 1; i <= n; i++) {
if (trim(items[i]) == version) {
return 1
}
}
return 0
}
function append_version(list, version) {
list = trim(list)
if (list == "") {
return version
}
if (contains_version(list, version)) {
return list
}
return list ", " version
}
function emit_new_row() {
print "| " opencloud_version " | " next_version " |"
}
BEGIN {
in_version_table = 0
saw_separator = 0
updated_row = 0
inserted_row = 0
}
{
if (saw_separator && in_version_table && $0 !~ /^[[:space:]]*\|/) {
if (!updated_row && !inserted_row) {
emit_new_row()
inserted_row = 1
}
in_version_table = 0
}
if ($0 ~ /^[[:space:]]*\|[[:space:]:-]+(\|[[:space:]:-]+)+\|[[:space:]]*$/ && !saw_separator) {
saw_separator = 1
in_version_table = 1
print
next
}
if (in_version_table && $0 ~ /^[[:space:]]*\|.*\|[[:space:]]*$/) {
split($0, cols, /\|/)
if (trim(cols[2]) == opencloud_version) {
chart_versions = append_version(cols[3], next_version)
print "| " opencloud_version " | " chart_versions " |"
updated_row = 1
next
}
}
print
}
END {
if (saw_separator && in_version_table && !updated_row && !inserted_row) {
emit_new_row()
}
}
' README.md > README.new.md
mv README.new.md README.md

Copilot uses AI. Check for mistakes.
This was referenced Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants