From eb297ebf909dc51980640865ef617fe09cdb990e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 12 Aug 2020 09:34:13 -0700 Subject: [PATCH 1/7] chore: update cloud rad kokoro build job (#449) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/b742586e-df31-4aac-8092-78288e9ea8e7/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/bd0deaa1113b588d70449535ab9cbf0f2bd0e72f --- .kokoro/release/docs-devsite.sh | 5 +++++ synth.metadata | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.kokoro/release/docs-devsite.sh b/.kokoro/release/docs-devsite.sh index 3b93137..fa089cf 100755 --- a/.kokoro/release/docs-devsite.sh +++ b/.kokoro/release/docs-devsite.sh @@ -36,6 +36,11 @@ NAME=$(cat .repo-metadata.json | json name) mkdir ./_devsite cp ./yaml/$NAME/* ./_devsite + +# Delete SharePoint item, see https://github.com/microsoft/rushstack/issues/1229 +sed -i -e '1,3d' ./yaml/toc.yml +sed -i -e 's/^ //' ./yaml/toc.yml + cp ./yaml/toc.yml ./_devsite/toc.yml # create docs.metadata, based on package.json and .repo-metadata.json. diff --git a/synth.metadata b/synth.metadata index 2a019c7..5102522 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/github-repo-automation.git", - "sha": "3b5f955b24722fa883e6d5b423da3f11217be64a" + "sha": "e750435a4a6d2c6def2107301e948c67df569364" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "94421c47802f56a44c320257b2b4c190dc7d6b68" + "sha": "bd0deaa1113b588d70449535ab9cbf0f2bd0e72f" } } ] From 526dafabbf8b6fd35e9f42991b7f7b47d89969d6 Mon Sep 17 00:00:00 2001 From: Jeffrey Rennie Date: Wed, 12 Aug 2020 21:22:07 -0700 Subject: [PATCH 2/7] build: perform publish using Node 12 (#450) Source-Author: Benjamin E. Coe Source-Date: Wed Aug 12 12:12:29 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 5747555f7620113d9a2078a48f4c047a99d31b3e Source-Link: https://github.com/googleapis/synthtool/commit/5747555f7620113d9a2078a48f4c047a99d31b3e --- .kokoro/release/publish.cfg | 2 +- synth.metadata | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.kokoro/release/publish.cfg b/.kokoro/release/publish.cfg index d4600c6..0e0f6da 100644 --- a/.kokoro/release/publish.cfg +++ b/.kokoro/release/publish.cfg @@ -61,7 +61,7 @@ build_file: "github-repo-automation/.kokoro/trampoline.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" } env_vars: { diff --git a/synth.metadata b/synth.metadata index 5102522..fce6d58 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/github-repo-automation.git", - "sha": "e750435a4a6d2c6def2107301e948c67df569364" + "sha": "eb297ebf909dc51980640865ef617fe09cdb990e" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "bd0deaa1113b588d70449535ab9cbf0f2bd0e72f" + "sha": "5747555f7620113d9a2078a48f4c047a99d31b3e" } } ] From afeb7ab3cd4b0c174483bc57d6f7b209691dde68 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 19 Aug 2020 09:42:41 -0700 Subject: [PATCH 3/7] chore: start tracking obsolete files (#451) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/7a1b0b96-8ddb-4836-a1a2-d2f73b7e6ffe/targets - [ ] To automatically regenerate this PR, check this box. --- synth.metadata | 57 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/synth.metadata b/synth.metadata index fce6d58..8ca0fbc 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,68 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/github-repo-automation.git", - "sha": "eb297ebf909dc51980640865ef617fe09cdb990e" + "sha": "526dafabbf8b6fd35e9f42991b7f7b47d89969d6" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5747555f7620113d9a2078a48f4c047a99d31b3e" + "sha": "1a60ff2a3975c2f5054431588bd95db9c3b862ba" } } + ], + "generatedFiles": [ + ".eslintignore", + ".eslintrc.json", + ".gitattributes", + ".github/ISSUE_TEMPLATE/bug_report.md", + ".github/ISSUE_TEMPLATE/feature_request.md", + ".github/ISSUE_TEMPLATE/support_request.md", + ".github/PULL_REQUEST_TEMPLATE.md", + ".github/publish.yml", + ".github/release-please.yml", + ".github/workflows/ci.yaml", + ".kokoro/.gitattributes", + ".kokoro/common.cfg", + ".kokoro/continuous/node10/common.cfg", + ".kokoro/continuous/node10/docs.cfg", + ".kokoro/continuous/node10/lint.cfg", + ".kokoro/continuous/node10/samples-test.cfg", + ".kokoro/continuous/node10/system-test.cfg", + ".kokoro/continuous/node10/test.cfg", + ".kokoro/continuous/node12/common.cfg", + ".kokoro/continuous/node12/test.cfg", + ".kokoro/docs.sh", + ".kokoro/lint.sh", + ".kokoro/populate-secrets.sh", + ".kokoro/presubmit/node10/common.cfg", + ".kokoro/presubmit/node10/samples-test.cfg", + ".kokoro/presubmit/node10/system-test.cfg", + ".kokoro/presubmit/node12/common.cfg", + ".kokoro/presubmit/node12/test.cfg", + ".kokoro/publish.sh", + ".kokoro/release/docs-devsite.cfg", + ".kokoro/release/docs-devsite.sh", + ".kokoro/release/docs.cfg", + ".kokoro/release/docs.sh", + ".kokoro/release/publish.cfg", + ".kokoro/samples-test.sh", + ".kokoro/system-test.sh", + ".kokoro/test.bat", + ".kokoro/test.sh", + ".kokoro/trampoline.sh", + ".mocharc.js", + ".nycrc", + ".prettierignore", + ".prettierrc.js", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.md", + "LICENSE", + "api-extractor.json", + "package-lock.json.3173150797", + "renovate.json", + "samples/README.md", + "samples/package-lock.json.2241309409" ] } \ No newline at end of file From ad7eac25d74add9b7b0c856e25578bf6bb68fc9f Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 21 Aug 2020 09:26:41 -0700 Subject: [PATCH 4/7] build: move system and samples test from Node 10 to Node 12 (#452) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/ba2d388f-b3b2-4ad7-a163-0c6b4d86894f/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/05de3e1e14a0b07eab8b474e669164dbd31f81fb --- .kokoro/continuous/{node10 => node12}/lint.cfg | 0 .../{node10 => node12}/samples-test.cfg | 0 .../{node10 => node12}/system-test.cfg | 0 .../{node10 => node12}/samples-test.cfg | 0 .../{node10 => node12}/system-test.cfg | 0 synth.metadata | 18 ++++++++---------- 6 files changed, 8 insertions(+), 10 deletions(-) rename .kokoro/continuous/{node10 => node12}/lint.cfg (100%) rename .kokoro/continuous/{node10 => node12}/samples-test.cfg (100%) rename .kokoro/continuous/{node10 => node12}/system-test.cfg (100%) rename .kokoro/presubmit/{node10 => node12}/samples-test.cfg (100%) rename .kokoro/presubmit/{node10 => node12}/system-test.cfg (100%) diff --git a/.kokoro/continuous/node10/lint.cfg b/.kokoro/continuous/node12/lint.cfg similarity index 100% rename from .kokoro/continuous/node10/lint.cfg rename to .kokoro/continuous/node12/lint.cfg diff --git a/.kokoro/continuous/node10/samples-test.cfg b/.kokoro/continuous/node12/samples-test.cfg similarity index 100% rename from .kokoro/continuous/node10/samples-test.cfg rename to .kokoro/continuous/node12/samples-test.cfg diff --git a/.kokoro/continuous/node10/system-test.cfg b/.kokoro/continuous/node12/system-test.cfg similarity index 100% rename from .kokoro/continuous/node10/system-test.cfg rename to .kokoro/continuous/node12/system-test.cfg diff --git a/.kokoro/presubmit/node10/samples-test.cfg b/.kokoro/presubmit/node12/samples-test.cfg similarity index 100% rename from .kokoro/presubmit/node10/samples-test.cfg rename to .kokoro/presubmit/node12/samples-test.cfg diff --git a/.kokoro/presubmit/node10/system-test.cfg b/.kokoro/presubmit/node12/system-test.cfg similarity index 100% rename from .kokoro/presubmit/node10/system-test.cfg rename to .kokoro/presubmit/node12/system-test.cfg diff --git a/synth.metadata b/synth.metadata index 8ca0fbc..ebf33d8 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/github-repo-automation.git", - "sha": "526dafabbf8b6fd35e9f42991b7f7b47d89969d6" + "sha": "afeb7ab3cd4b0c174483bc57d6f7b209691dde68" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "1a60ff2a3975c2f5054431588bd95db9c3b862ba" + "sha": "05de3e1e14a0b07eab8b474e669164dbd31f81fb" } } ], @@ -30,19 +30,19 @@ ".kokoro/common.cfg", ".kokoro/continuous/node10/common.cfg", ".kokoro/continuous/node10/docs.cfg", - ".kokoro/continuous/node10/lint.cfg", - ".kokoro/continuous/node10/samples-test.cfg", - ".kokoro/continuous/node10/system-test.cfg", ".kokoro/continuous/node10/test.cfg", ".kokoro/continuous/node12/common.cfg", + ".kokoro/continuous/node12/lint.cfg", + ".kokoro/continuous/node12/samples-test.cfg", + ".kokoro/continuous/node12/system-test.cfg", ".kokoro/continuous/node12/test.cfg", ".kokoro/docs.sh", ".kokoro/lint.sh", ".kokoro/populate-secrets.sh", ".kokoro/presubmit/node10/common.cfg", - ".kokoro/presubmit/node10/samples-test.cfg", - ".kokoro/presubmit/node10/system-test.cfg", ".kokoro/presubmit/node12/common.cfg", + ".kokoro/presubmit/node12/samples-test.cfg", + ".kokoro/presubmit/node12/system-test.cfg", ".kokoro/presubmit/node12/test.cfg", ".kokoro/publish.sh", ".kokoro/release/docs-devsite.cfg", @@ -63,9 +63,7 @@ "CONTRIBUTING.md", "LICENSE", "api-extractor.json", - "package-lock.json.3173150797", "renovate.json", - "samples/README.md", - "samples/package-lock.json.2241309409" + "samples/README.md" ] } \ No newline at end of file From 3715f6dcc1e25d539c413c33b3b494ad57ca9ecc Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 27 Aug 2020 09:26:35 -0700 Subject: [PATCH 5/7] build: track flaky tests for "nightly", add new secrets for tagging (#453) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/742277d3-5124-43f1-b35f-37558686e819/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/8cf6d2834ad14318e64429c3b94f6443ae83daf9 --- .github/publish.yml | 0 .kokoro/release/publish.cfg | 2 +- .kokoro/samples-test.sh | 2 +- .kokoro/system-test.sh | 2 +- .kokoro/test.sh | 2 +- synth.metadata | 5 ++--- 6 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 .github/publish.yml diff --git a/.github/publish.yml b/.github/publish.yml deleted file mode 100644 index e69de29..0000000 diff --git a/.kokoro/release/publish.cfg b/.kokoro/release/publish.cfg index 0e0f6da..37f07b6 100644 --- a/.kokoro/release/publish.cfg +++ b/.kokoro/release/publish.cfg @@ -49,7 +49,7 @@ before_action { env_vars: { key: "SECRET_MANAGER_KEYS" - value: "npm_publish_token" + value: "npm_publish_token,releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" } # Download trampoline resources. diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index 86e83c9..c0c4013 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -41,7 +41,7 @@ if [ -f samples/package.json ]; then cd .. # If tests are running against master, configure Build Cop # to open issues on failures: - if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then + if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml export MOCHA_REPORTER=xunit cleanup() { diff --git a/.kokoro/system-test.sh b/.kokoro/system-test.sh index dfae142..283f170 100755 --- a/.kokoro/system-test.sh +++ b/.kokoro/system-test.sh @@ -35,7 +35,7 @@ npm install # If tests are running against master, configure Build Cop # to open issues on failures: -if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then +if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml export MOCHA_REPORTER=xunit cleanup() { diff --git a/.kokoro/test.sh b/.kokoro/test.sh index 8d9c295..47be59b 100755 --- a/.kokoro/test.sh +++ b/.kokoro/test.sh @@ -23,7 +23,7 @@ cd $(dirname $0)/.. npm install # If tests are running against master, configure Build Cop # to open issues on failures: -if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then +if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml export MOCHA_REPORTER=xunit cleanup() { diff --git a/synth.metadata b/synth.metadata index ebf33d8..f1b4acc 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/github-repo-automation.git", - "sha": "afeb7ab3cd4b0c174483bc57d6f7b209691dde68" + "sha": "ad7eac25d74add9b7b0c856e25578bf6bb68fc9f" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "05de3e1e14a0b07eab8b474e669164dbd31f81fb" + "sha": "8cf6d2834ad14318e64429c3b94f6443ae83daf9" } } ], @@ -23,7 +23,6 @@ ".github/ISSUE_TEMPLATE/feature_request.md", ".github/ISSUE_TEMPLATE/support_request.md", ".github/PULL_REQUEST_TEMPLATE.md", - ".github/publish.yml", ".github/release-please.yml", ".github/workflows/ci.yaml", ".kokoro/.gitattributes", From 2cb06b7174e89aea6d4bbecac7638990afd97c16 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Thu, 27 Aug 2020 21:48:25 -0700 Subject: [PATCH 6/7] feat: add functionality to remove labels (#454) --- src/cli.ts | 5 +++++ src/lib/github.ts | 18 ++++++++++++++++++ src/untag-prs.ts | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 src/untag-prs.ts diff --git a/src/cli.ts b/src/cli.ts index fbe5c87..344f506 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -27,6 +27,7 @@ import {sync, exec} from './sync'; import * as meow from 'meow'; import * as updateNotifier from 'update-notifier'; import {tag} from './tag-prs'; +import {untag} from './untag-prs'; /* eslint-disable @typescript-eslint/no-var-requires */ const pkg = require('../../package.json'); @@ -81,6 +82,7 @@ const cli = meow( $ repo reject [--branch branch] [--author author] [--title title] $ repo rename [--branch branch] [--author author] [--title title] 'new PR title' $ repo tag [--branch branch] [--author author] [--title title] label1 label2 ... + $ repo untag [--branch branch] [--author author] [--title title] label1 $ repo apply --branch branch --message message --comment comment [--reviewers username[,username...]] [--silent] command $ repo check $ repo sync @@ -120,6 +122,9 @@ switch (cli.input[0]) { case 'apply': p = apply(cli); break; + case 'untag': + p = untag(cli); + break; case 'tag': p = tag(cli); break; diff --git a/src/lib/github.ts b/src/lib/github.ts index 354129d..e5be43b 100644 --- a/src/lib/github.ts +++ b/src/lib/github.ts @@ -503,6 +503,24 @@ export class GitHubRepository { return result.data; } + /** + * Removes label with a given name to a given pull request. + * @param {Object} pr Pull request object, as returned by GitHib API. + * @param {Array} labels Labels to apply to the PR + * @returns A list of labels that was added to the issue.. + */ + async unTagPullRequest(pr: PullRequest, name: string) { + const owner = this.repository.owner.login; + const repo = this.repository.name; + const url = `/repos/${owner}/${repo}/issues/${pr.number}/labels/${name}`; + const result = await this.client.request({ + url, + method: 'DELETE', + data: {name}, + }); + return result.data; + } + /** * Closes the given pull request without merging it. * @param {Object} pr Pull request object, as returned by GitHub API. diff --git a/src/untag-prs.ts b/src/untag-prs.ts new file mode 100644 index 0000000..bcb7745 --- /dev/null +++ b/src/untag-prs.ts @@ -0,0 +1,46 @@ +// Copyright 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import * as meow from 'meow'; +import {meowFlags} from './cli'; + +import {GitHubRepository, PullRequest} from './lib/github'; +import {processPRs} from './lib/asyncItemIterator'; + +let name: string; + +async function processMethod(repository: GitHubRepository, pr: PullRequest) { + try { + await repository.unTagPullRequest(pr, name); + } catch (err) { + console.warn( + ` error trying to untag PR ${pr.html_url}:`, + err.toString() + ); + return false; + } + return true; +} + +export async function untag(cli: meow.Result) { + name = cli.input[1]; + return processPRs(cli, { + commandName: 'untag', + commandActive: 'untagging', + commandNamePastTense: 'untagged', + commandDesc: + 'Will remove label(s) to all open PRs with title matching regex.', + processMethod, + }); +} From 54d489734f428c187091647a92835231f6fd1f06 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 28 Aug 2020 08:46:09 -0700 Subject: [PATCH 7/7] chore: release 4.2.0 (#455) * chore: updated samples/package.json [ci skip] * chore: updated CHANGELOG.md [ci skip] * chore: updated package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ package.json | 2 +- samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6f4802..5124780 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ [1]: https://www.npmjs.com/package/@google/repo?activeTab=versions +## [4.2.0](https://www.github.com/googleapis/github-repo-automation/compare/v4.1.0...v4.2.0) (2020-08-28) + + +### Features + +* add functionality to remove labels ([#454](https://www.github.com/googleapis/github-repo-automation/issues/454)) ([2cb06b7](https://www.github.com/googleapis/github-repo-automation/commit/2cb06b7174e89aea6d4bbecac7638990afd97c16)) + ## [4.1.0](https://www.github.com/googleapis/github-repo-automation/compare/v4.0.2...v4.1.0) (2020-08-11) diff --git a/package.json b/package.json index 4c425de..411fa57 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@google/repo", - "version": "4.1.0", + "version": "4.2.0", "repository": "googleapis/github-repo-automation", "description": "A tool for automating multiple GitHub repositories.", "engines": { diff --git a/samples/package.json b/samples/package.json index cb437ba..5414a1f 100644 --- a/samples/package.json +++ b/samples/package.json @@ -14,7 +14,7 @@ "test": "mocha system-test" }, "dependencies": { - "@google/repo": "^4.1.0" + "@google/repo": "^4.2.0" }, "devDependencies": { "mocha": "^8.0.0"