Skip to content

Commit 40651dd

Browse files
committed
chore(scripts): fix stable release promote script
1 parent 06dd656 commit 40651dd

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

scripts/release/main.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ func main() {
6262
Value: serpent.BoolOf(&r.debug),
6363
},
6464
{
65-
Flag: "gh-token",
65+
Flag: "github-token",
6666
Description: "GitHub personal access token.",
67-
Env: "GH_TOKEN",
67+
Env: "GITHUB_TOKEN",
6868
Value: serpent.StringOf(&r.ghToken),
6969
},
7070
{
@@ -245,7 +245,7 @@ func (r *releaseCommand) promoteVersionToStable(ctx context.Context, inv *serpen
245245
updatedNewStable.Prerelease = github.Bool(false)
246246
updatedNewStable.Draft = github.Bool(false)
247247
if !r.dryRun {
248-
_, _, err = client.Repositories.EditRelease(ctx, owner, repo, newStable.GetID(), newStable)
248+
_, _, err = client.Repositories.EditRelease(ctx, owner, repo, newStable.GetID(), updatedNewStable)
249249
if err != nil {
250250
return xerrors.Errorf("edit release failed: %w", err)
251251
}
@@ -268,6 +268,10 @@ func cloneRelease(r *github.RepositoryRelease) *github.RepositoryRelease {
268268
//
269269
// > ## Stable (since April 23, 2024)
270270
func addStableSince(date time.Time, body string) string {
271+
// Protect against adding twice.
272+
if strings.Contains(body, "> ## Stable (since") {
273+
return body
274+
}
271275
return fmt.Sprintf("> ## Stable (since %s)\n\n", date.Format("January 02, 2006")) + body
272276
}
273277

scripts/release_promote_stable.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ set -euo pipefail
44
# shellcheck source=scripts/lib.sh
55
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
66

7+
# Make sure GITHUB_TOKEN is set for the release command.
8+
gh_auth
9+
710
# This script is a convenience wrapper around the release promote command.
811
#
912
# Sed hack to make help text look like this script.

0 commit comments

Comments
 (0)