Run issue_reviver via GitHub.

PiperOrigin-RevId: 311600872
This commit is contained in:
Adin Scannell
2020-05-14 14:02:43 -07:00
committed by gVisor bot
parent bdf7bb71d2
commit f589a85889
3 changed files with 32 additions and 5 deletions
+14
View File
@@ -0,0 +1,14 @@
name: "Issue reviver"
on:
schedule:
- cron: '0 0 * * *'
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: make run TARGETS="//tools/issue_reviver"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
+2
View File
@@ -59,6 +59,8 @@ SHELL=/bin/bash -o pipefail
## DOCKER_SOCKET - The Docker socket (default: detected).
##
bazel-server-start: load-default ## Starts the bazel server.
@mkdir -p $(BAZEL_CACHE)
@mkdir -p $(GCLOUD_CONFIG)
docker run -d --rm \
--init \
--name $(DOCKER_NAME) \
+16 -5
View File
@@ -20,6 +20,7 @@ import (
"fmt"
"io/ioutil"
"os"
"strings"
"gvisor.dev/gvisor/tools/issue_reviver/github"
"gvisor.dev/gvisor/tools/issue_reviver/reviver"
@@ -35,14 +36,22 @@ var (
// Keep the options simple for now. Supports only a single path and repo.
func init() {
flag.StringVar(&owner, "owner", "google", "Github project org/owner to look for issues")
flag.StringVar(&repo, "repo", "gvisor", "Github repo to look for issues")
flag.StringVar(&owner, "owner", "", "Github project org/owner to look for issues")
flag.StringVar(&repo, "repo", "", "Github repo to look for issues")
flag.StringVar(&tokenFile, "oauth-token-file", "", "Path to file containing the OAUTH token to be used as credential to github")
flag.StringVar(&path, "path", "", "Path to scan for TODOs")
flag.StringVar(&path, "path", ".", "Path to scan for TODOs")
flag.BoolVar(&dryRun, "dry-run", false, "If set to true, no changes are made to issues")
}
func main() {
// Set defaults from the environment.
repository := os.Getenv("GITHUB_REPOSITORY")
if parts := strings.SplitN(repository, "/", 2); len(parts) == 2 {
owner = parts[0]
repo = parts[1]
}
// Parse flags.
flag.Parse()
// Check for mandatory parameters.
@@ -62,8 +71,10 @@ func main() {
os.Exit(1)
}
// Token is passed as a file so it doesn't show up in command line arguments.
var token string
// The access token may be passed as a file so it doesn't show up in
// command line arguments. It also may be provided through the
// environment to faciliate use through GitHub's CI system.
token := os.Getenv("GITHUB_TOKEN")
if len(tokenFile) != 0 {
bytes, err := ioutil.ReadFile(tokenFile)
if err != nil {