Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0e2e866

Browse files
committed
add gh token
1 parent2f5d178 commit0e2e866

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

‎go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ require (
218218
github.com/benbjohnson/clockv1.3.5
219219
github.com/coder/serpentv0.7.0
220220
github.com/gomarkdown/markdownv0.0.0-20231222211730-1d6d20845b47
221+
github.com/google/go-github/v61v61.0.0
221222
)
222223

223224
require (

‎go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
469469
github.com/google/go-cmpv0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
470470
github.com/google/go-github/v43v43.0.1-0.20220414155304-00e42332e405 h1:DdHws/YnnPrSywrjNYu2lEHqYHWp/LnEx56w59esd54=
471471
github.com/google/go-github/v43v43.0.1-0.20220414155304-00e42332e405/go.mod h1:4RgUDSnsxP19d65zJWqvqJ/poJxBCvmna50eXmIvoR8=
472+
github.com/google/go-github/v61v61.0.0 h1:VwQCBwhyE9JclCI+22/7mLB1PuU9eowCXKY5pNlu1go=
473+
github.com/google/go-github/v61v61.0.0/go.mod h1:0WR+KmsWX75G2EbpyGsGmradjo3IiciuI4BmdVCobQY=
472474
github.com/google/go-querystringv1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
473475
github.com/google/go-querystringv1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
474476
github.com/google/gofuzzv1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=

‎scripts/release/main.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"strings"
99

1010
"github.com/google/go-cmp/cmp"
11-
"github.com/google/go-github/v43/github"
11+
"github.com/google/go-github/v61/github"
1212
"golang.org/x/mod/semver"
1313
"golang.org/x/xerrors"
1414

@@ -26,12 +26,19 @@ const (
2626
funcmain() {
2727
logger:=slog.Make(sloghuman.Sink(os.Stderr)).Leveled(slog.LevelDebug)
2828

29+
varghTokenstring
2930
vardryRunbool
3031

3132
cmd:= serpent.Command{
3233
Use:"release <subcommand>",
3334
Short:"Prepare, create and publish releases.",
3435
Options: serpent.OptionSet{
36+
{
37+
Flag:"gh-token",
38+
Description:"GitHub personal access token.",
39+
Env:"GH_TOKEN",
40+
Value:serpent.StringOf(&ghToken),
41+
},
3542
{
3643
Flag:"dry-run",
3744
FlagShorthand:"n",
@@ -48,8 +55,11 @@ func main() {
4855
iflen(inv.Args)==0 {
4956
returnxerrors.New("version argument missing")
5057
}
58+
if!dryRun&&ghToken=="" {
59+
returnxerrors.New("GitHub personal access token is required, use --gh-token or GH_TOKEN")
60+
}
5161

52-
err:=promoteVersionToStable(ctx,inv,logger,dryRun,inv.Args[0])
62+
err:=promoteVersionToStable(ctx,inv,logger,ghToken,dryRun,inv.Args[0])
5363
iferr!=nil {
5464
returnerr
5565
}
@@ -71,8 +81,11 @@ func main() {
7181
}
7282

7383
//nolint:revive // Allow dryRun control flag.
74-
funcpromoteVersionToStable(ctx context.Context,inv*serpent.Invocation,logger slog.Logger,dryRunbool,versionstring)error {
84+
funcpromoteVersionToStable(ctx context.Context,inv*serpent.Invocation,logger slog.Logger,ghTokenstring,dryRunbool,versionstring)error {
7585
client:=github.NewClient(nil)
86+
ifghToken!="" {
87+
client=client.WithAuthToken(ghToken)
88+
}
7689

7790
logger=logger.With(slog.F("dry_run",dryRun),slog.F("version",version))
7891

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp