Skip to content

Commit

Permalink
Add User-Agent to identify action users
Browse files Browse the repository at this point in the history
  • Loading branch information
markusthoemmes committed Jul 30, 2024
1 parent b404033 commit ee8e544
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions delete/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ func main() {
a.Fatalf("failed to get GitHub context: %v", err)
}

do := godo.NewFromToken(in.token).Apps
do := godo.NewFromToken(in.token)
do.UserAgent = "do-app-action-delete"

appID := in.appID
if appID == "" {
Expand All @@ -39,7 +40,7 @@ func main() {
appName = utils.GenerateAppName(repoOwner, repo, ghCtx.RefName)
}

app, err := utils.FindAppByName(ctx, do, appName)
app, err := utils.FindAppByName(ctx, do.Apps, appName)
if err != nil {
a.Fatalf("failed to find app: %v", err)
}
Expand All @@ -53,7 +54,7 @@ func main() {
appID = app.ID
}

if resp, err := do.Delete(ctx, appID); err != nil {
if resp, err := do.Apps.Delete(ctx, appID); err != nil {
if resp.StatusCode == http.StatusNotFound && in.ignoreNotFound {
a.Infof("app %q not found, ignoring", appID)
return
Expand Down
4 changes: 3 additions & 1 deletion deploy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ func main() {
// Mask the DO token to avoid accidentally leaking it.
a.AddMask(in.token)

do := godo.NewFromToken(in.token)
do.UserAgent = "do-app-action-deploy"
d := &deployer{
action: a,
apps: godo.NewFromToken(in.token).Apps,
apps: do.Apps,
httpClient: http.DefaultClient,
inputs: in,
}
Expand Down

0 comments on commit ee8e544

Please sign in to comment.