cmd/gopherbot: only milestone new vscode-go issues as Untriaged

Transferred issues are getting categorized as part of this set and
returning errors when the milestone is applied, causing GitHub to rate
limit Gopherbot. Only try to milestone newly created issues as a result.

And re-enable that task now that the number of transferred issues should
be lower.

For golang/go#40640

Change-Id: I7e772d1bcda46e982f0f375481108ff10c064ae9
Reviewed-on: https://go-review.googlesource.com/c/build/+/309069
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/cmd/gopherbot/gopherbot.go b/cmd/gopherbot/gopherbot.go
index c56164b..5a474c8 100644
--- a/cmd/gopherbot/gopherbot.go
+++ b/cmd/gopherbot/gopherbot.go
@@ -965,13 +965,6 @@
 }
 
 func (b *gopherbot) setVSCodeGoMilestones(ctx context.Context) error {
-	// Disabled in production for golang.org/issue/45461.
-	// Only run this task if it was explicitly requested
-	// via the --only-run flag.
-	if *onlyRun == "" {
-		return nil
-	}
-
 	vscode := b.corpus.GitHub().Repo("golang", "vscode-go")
 	if vscode == nil {
 		return nil
@@ -980,6 +973,10 @@
 		if gi.Closed || gi.PullRequest || !gi.Milestone.IsNone() || gi.HasEvent("demilestoned") || gi.HasEvent("milestoned") {
 			return nil
 		}
+		// Work-around golang/go#40640 by only milestoning new issues.
+		if time.Since(gi.Created) > 24*time.Hour {
+			return nil
+		}
 		return b.setMilestone(ctx, vscode.ID(), gi, vscodeUntriaged)
 	})
 }