From ddabba9a5e936c981aa69a37c9ea301f6f9a47de Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Sat, 27 Jul 2024 11:19:00 -0700 Subject: [PATCH 1/7] chore: update issu templates and codeowners --- .../templates/node_library/.github/CODEOWNERS | 9 +- .../.github/ISSUE_TEMPLATE/bug_report.md | 135 +++++++++++++----- .../ISSUE_TEMPLATE/documentation_request.yaml | 53 +++++++ .../.github/ISSUE_TEMPLATE/feature_request.md | 64 +++++++-- .../ISSUE_TEMPLATE/processs_request.md | 5 + .../.github/ISSUE_TEMPLATE/question.md | 12 +- .../.github/scripts/close-invalid-link.cjs | 53 +++++++ .../.github/scripts/close-unresponse.cjs | 69 +++++++++ .../.github/scripts/remove-response-label.cjs | 33 +++++ .../.github/workflows/issues-no-repro.yaml | 18 +++ .../.github/workflows/presubmit.yaml | 20 +++ .../.github/workflows/response.yml | 35 +++++ 12 files changed, 440 insertions(+), 66 deletions(-) create mode 100644 synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/documentation_request.yaml create mode 100644 synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/processs_request.md create mode 100644 synthtool/gcp/templates/node_library/.github/scripts/close-invalid-link.cjs create mode 100644 synthtool/gcp/templates/node_library/.github/scripts/close-unresponse.cjs create mode 100644 synthtool/gcp/templates/node_library/.github/scripts/remove-response-label.cjs create mode 100644 synthtool/gcp/templates/node_library/.github/workflows/issues-no-repro.yaml create mode 100644 synthtool/gcp/templates/node_library/.github/workflows/presubmit.yaml create mode 100644 synthtool/gcp/templates/node_library/.github/workflows/response.yml diff --git a/synthtool/gcp/templates/node_library/.github/CODEOWNERS b/synthtool/gcp/templates/node_library/.github/CODEOWNERS index 20d3e6db0..619a56f43 100644 --- a/synthtool/gcp/templates/node_library/.github/CODEOWNERS +++ b/synthtool/gcp/templates/node_library/.github/CODEOWNERS @@ -7,10 +7,7 @@ # The yoshi-nodejs team is the default owner for nodejs repositories. {%- if 'codeowner_team' in metadata['repo'] %} -* @googleapis/yoshi-nodejs {{ metadata['repo']['codeowner_team'] }} +* {{ metadata['repo']['codeowner_team'] }} @googleapis/jsteam {%- else %} -* @googleapis/yoshi-nodejs -{%- endif %} - -# The github automation team is the default owner for the auto-approve file. -.github/auto-approve.yml @googleapis/github-automation +* @googleapis/jsteam +{%- endif %} \ No newline at end of file diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/bug_report.md b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/bug_report.md index 351b8d2a6..791734dfc 100644 --- a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/bug_report.md +++ b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,38 +1,99 @@ ---- -name: Bug report -about: Create a report to help us improve -labels: 'type: bug, priority: p2' ---- +name: Bug Report +description: Create a report to help us improve +labels: + - bug +body: + - type: markdown + attributes: + value: > + **PLEASE READ**: If you have a support contract with Google, please + create an issue in the [support + console](https://cloud.google.com/support/) instead of filing on GitHub. + This will ensure a timely response. Otherwise, please make sure to + follow the steps below. + - type: checkboxes + attributes: + label: Please make sure you have searched for information in the following + guides. + options: + - label: "Search the issues already opened: + https://github.com/GoogleCloudPlatform/google-cloud-node/issues" + required: true + - label: "Search StackOverflow: + http://stackoverflow.com/questions/tagged/google-cloud-platform+nod\ + e.js" + required: true + - label: "Check our Troubleshooting guide: + https://googlecloudplatform.github.io/google-cloud-node/#/docs/guid\ + es/troubleshooting" + required: true + - label: "Check our FAQ: + https://googlecloudplatform.github.io/google-cloud-node/#/docs/guid\ + es/faq" + required: true + - label: "Check our libraries HOW-TO: + https://github.com/googleapis/gax-nodejs/blob/main/client-libraries\ + .md" + required: true + - label: "Check out our authentication guide: + https://github.com/googleapis/google-auth-library-nodejs" + required: true + - label: "Check out handwritten samples for many of our APIs: + https://github.com/GoogleCloudPlatform/nodejs-docs-samples" + required: true + - type: textarea + attributes: + label: > + A screenshot that you have tested with "Try this API". + description: > + As our client libraries are mostly autogenerated, we kindly request + that you test whether your issue is with the client library, or with the + API itself. To do so, please search for your API + here: https://developers.google.com/apis-explorer and attempt to + reproduce the issue in the given method. Please include a screenshot of + the response in "Try this API". This response should NOT match the current + behavior you are experiencing. If the behavior is the same, it means + that you are likely experiencing a bug with the API itself. In that + case, please submit an issue to the API team, either by submitting an + issue in its issue tracker https://cloud.google.com/support/docs/issue-trackers, or by + submitting an issue in its linked tracker in the .repo-metadata.json + file {{ metadata['repo']['issue_tracker'] }} + validations: + required: true + - type: input + attributes: + label: > + Link to the code that reproduces this issue. A link to a **public** Github Repository or gist with a minimal + reproduction. + description: > + **Skipping this or providing an invalid link will result in the issue being closed** + validations: + required: true + - type: textarea + attributes: + label: > + A step-by-step description of how to reproduce the issue, based on + the linked reproduction. + description: > + Screenshots can be provided in the issue body below. + placeholder: | + 1. Start the application in development (next dev) + 2. Click X + 3. Y will happen + validations: + required: true + - type: textarea + attributes: + label: A clear and concise description of what the bug is, and what you + expected to happen. + placeholder: Following the steps from the previous section, I expected A to + happen, but I observed B instead + validations: + required: true -Thanks for stopping by to let us know something could be better! - -**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. - -1) Is this a client library issue or a product issue? -This is the client library for {{metadata['name_pretty']}}. We will only be able to assist with issues that pertain to the behaviors of this library. If the issue you're experiencing is due to the behavior of the product itself, please visit the [{{metadata['name_pretty']}} Support page]({{metadata['support_documentation']}}) to reach the most relevant engineers. - -2) Did someone already solve this? - - Search the issues already opened: https://github.com/{{metadata['repository']}}/issues - - Search the issues on our "catch-all" repository: https://github.com/googleapis/google-cloud-node - - Search or ask on StackOverflow (engineers monitor these tags): http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js - -3) Do you have a support contract? -Please create an issue in the [support console](https://cloud.google.com/support/) to ensure a timely response. - -If the support paths suggested above still do not result in a resolution, please provide the following details. - -#### Environment details - - - OS: - - Node.js version: - - npm version: - - `{{ metadata['name'] }}` version: - -#### Steps to reproduce - - 1. ? - 2. ? - -Making sure to follow these steps will guarantee the quickest resolution possible. - -Thanks! + - type: textarea + attributes: + label: A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. ** + placeholder: 'Documentation here(link) states that B should happen instead of A' + validations: + required: true diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/documentation_request.yaml b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/documentation_request.yaml new file mode 100644 index 000000000..3a439195e --- /dev/null +++ b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/documentation_request.yaml @@ -0,0 +1,53 @@ +name: Documentation Requests +description: Requests for more information +body: + - type: markdown + attributes: + value: > + Please use this issue type to log documentation requests against the library itself. + These requests should involve documentation on Github (`.md` files), and should relate to the library + itself. If you have questions or documentation requests for an API, please + reach out to the API tracker itself. + + Please submit an issue to the API team, either by submitting an + issue in its issue tracker https://cloud.google.com/support/docs/issue-trackers), or by + submitting an issue in its linked tracker in the .repo-metadata.json + file in the API under packages/* ([example]({{ metadata['repo']['issue_tracker'] }})). + You can also submit a request to documentation on cloud.google.com itself with the "Send Feedback" + on the bottom of the page. + + + Please note that documentation requests and questions for specific APIs + will be closed. + - type: checkboxes + attributes: + label: Please make sure you have searched for information in the following + guides. + options: + - label: "Search the issues already opened: + https://github.com/GoogleCloudPlatform/google-cloud-node/issues" + required: true + - label: "Check our Troubleshooting guide: + https://googlecloudplatform.github.io/google-cloud-node/#/docs/guid\ + es/troubleshooting" + required: true + - label: "Check our FAQ: + https://googlecloudplatform.github.io/google-cloud-node/#/docs/guid\ + es/faq" + required: true + - label: "Check our libraries HOW-TO: + https://github.com/googleapis/gax-nodejs/blob/main/client-libraries\ + .md" + required: true + - label: "Check out our authentication guide: + https://github.com/googleapis/google-auth-library-nodejs" + required: true + - label: "Check out handwritten samples for many of our APIs: + https://github.com/GoogleCloudPlatform/nodejs-docs-samples" + required: true + - type: textarea + attributes: + label: > + Documentation Request + validations: + required: true diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.md b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.md index b0327dfa0..a0eb86a66 100644 --- a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.md +++ b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,18 +1,52 @@ ---- -name: Feature request -about: Suggest an idea for this library -labels: 'type: feature request, priority: p3' ---- +name: Feature Request +description: Suggest an idea for this library +labels: + - feature request +body: + - type: markdown + attributes: + value: > + **PLEASE READ**: If you have a support contract with Google, please + create an issue in the [support + console](https://cloud.google.com/support/) instead of filing on GitHub. + This will ensure a timely response. Otherwise, please make sure to + follow the steps below. + - type: textarea + attributes: + label: > + A screenshot that you have tested with "Try this API". + description: > + As our client libraries are mostly autogenerated, we kindly request + that you test whether your feature request is with the client library, or with the + API itself. To do so, please search for your API + here: https://developers.google.com/apis-explorer and attempt to + reproduce the issue in the given method. Please include a screenshot of + the response in "Try this API". This response should NOT match the current + behavior you are experiencing. If the behavior is the same, it means + that you are likely requesting a feature for the API itself. In that + case, please submit an issue to the API team, either by submitting an + issue in its issue tracker https://cloud.google.com/support/docs/issue-trackers, or by + submitting an issue in its linked tracker in the .repo-metadata.json + file in the API under packages/* ([example]({{ metadata['repo']['issue_tracker'] }})) -Thanks for stopping by to let us know something could be better! + Examples of common library-specific issues vs. API issues are: retry strategies, authentication questions, issues with typings. + validations: + required: true + - type: textarea + attributes: + label: > + What would you like to see in the library? + description: > + Screenshots can be provided in the issue body below. + placeholder: | + 1. Set up authentication like so + 2. Run the program like so + 3. X would be nice to happen -**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + - type: textarea + attributes: + label: Describe alternatives you've considered - **Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - **Describe the solution you'd like** -A clear and concise description of what you want to happen. - **Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - **Additional context** -Add any other context or screenshots about the feature request here. + - type: textarea + attributes: + label: Additional context/notes \ No newline at end of file diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/processs_request.md b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/processs_request.md new file mode 100644 index 000000000..9f88fc1f3 --- /dev/null +++ b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/processs_request.md @@ -0,0 +1,5 @@ +--- +name: Process Request +about: Submit a process request to the library. Process requests are any requests related to library infrastructure, including CI/CD, publishing, releasing, etc. This issue template should primarily used by internal members. + +--- \ No newline at end of file diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/question.md b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/question.md index 973231139..6ef1d0208 100644 --- a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/question.md +++ b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/question.md @@ -1,12 +1,8 @@ --- name: Question -about: Ask a question -labels: 'type: question, priority: p3' ---- +about: If you have a question, please use Discussions -Thanks for stopping by to ask us a question! Please make sure to include: -- What you're trying to do -- What code you've already tried -- Any error messages you're getting +--- -**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. +If you have a general question that goes beyond the library itself, we encourage you to use [Discussions](https://github.com/{{ metadata['repo']['repository'] }}/discussions) +to engage with fellow community members! diff --git a/synthtool/gcp/templates/node_library/.github/scripts/close-invalid-link.cjs b/synthtool/gcp/templates/node_library/.github/scripts/close-invalid-link.cjs new file mode 100644 index 000000000..871adf879 --- /dev/null +++ b/synthtool/gcp/templates/node_library/.github/scripts/close-invalid-link.cjs @@ -0,0 +1,53 @@ +// Copyright 2024 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. + +async function closeIssue(github, owner, repo, number) { + await github.rest.issues.createComment({ + owner: owner, + repo: repo, + issue_number: number, + body: "Issue was opened with an invalid reproduction link. Please make sure the repository is a valid, publicly-accessible github repository, and make sure the url is complete (example: https://github.com/googleapis/google-cloud-node)" + }); + await github.rest.issues.update({ + owner: owner, + repo: repo, + issue_number: number, + state: "closed" + }); +} +module.exports = async ({ github, context }) => { + const owner = context.repo.owner; + const repo = context.repo.repo; + const number = context.issue.number; + + const issue = await github.rest.issues.get({ + owner: owner, + repo: repo, + issue_number: number, + }); + + const isBugTemplate = issue.data.body.includes("Link to the code that reproduces this issue"); + + if (isBugTemplate) { + try { + const link = issue.data.body.split("\n")[18].match(/(https?:\/\/g?i?s?t\.?github.com\/.*)/); + const isValidLink = (await fetch(link)).ok; + if (!isValidLink) { + await closeIssue(github, owner, repo, number); + } + } catch (err) { + await closeIssue(github, owner, repo, number); + } + } +}; diff --git a/synthtool/gcp/templates/node_library/.github/scripts/close-unresponse.cjs b/synthtool/gcp/templates/node_library/.github/scripts/close-unresponse.cjs new file mode 100644 index 000000000..d97276334 --- /dev/null +++ b/synthtool/gcp/templates/node_library/.github/scripts/close-unresponse.cjs @@ -0,0 +1,69 @@ +// Copyright 2024 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. + +function labeledEvent(data) { + return data.event === "labeled" && data.label.name === "needs more info"; + } + + const numberOfDaysLimit = 15; + const close_message = `This has been closed since a request for information has \ + not been answered for ${numberOfDaysLimit} days. It can be reopened when the \ + requested information is provided.`; + + module.exports = async ({ github, context }) => { + const owner = context.repo.owner; + const repo = context.repo.repo; + + const issues = await github.rest.issues.listForRepo({ + owner: owner, + repo: repo, + labels: "needs more info", + }); + const numbers = issues.data.map((e) => e.number); + + for (const number of numbers) { + const events = await github.paginate( + github.rest.issues.listEventsForTimeline, + { + owner: owner, + repo: repo, + issue_number: number, + }, + (response) => response.data.filter(labeledEvent) + ); + + const latest_response_label = events[events.length - 1]; + + const created_at = new Date(latest_response_label.created_at); + const now = new Date(); + const diff = now - created_at; + const diffDays = diff / (1000 * 60 * 60 * 24); + + if (diffDays > numberOfDaysLimit) { + await github.rest.issues.update({ + owner: owner, + repo: repo, + issue_number: number, + state: "closed", + }); + + await github.rest.issues.createComment({ + owner: owner, + repo: repo, + issue_number: number, + body: close_message, + }); + } + } + }; diff --git a/synthtool/gcp/templates/node_library/.github/scripts/remove-response-label.cjs b/synthtool/gcp/templates/node_library/.github/scripts/remove-response-label.cjs new file mode 100644 index 000000000..b501cc89d --- /dev/null +++ b/synthtool/gcp/templates/node_library/.github/scripts/remove-response-label.cjs @@ -0,0 +1,33 @@ +// Copyright 2024 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. + +module.exports = async ({ github, context }) => { + const commenter = context.actor; + const issue = await github.rest.issues.get({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + const author = issue.data.user.login; + const labels = issue.data.labels.map((e) => e.name); + + if (author === commenter && labels.includes("needs more info")) { + await github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + name: "needs more info", + }); + } + }; diff --git a/synthtool/gcp/templates/node_library/.github/workflows/issues-no-repro.yaml b/synthtool/gcp/templates/node_library/.github/workflows/issues-no-repro.yaml new file mode 100644 index 000000000..442a46bcc --- /dev/null +++ b/synthtool/gcp/templates/node_library/.github/workflows/issues-no-repro.yaml @@ -0,0 +1,18 @@ +name: invalid_link +on: + issues: + types: [opened, reopened] + +jobs: + close: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + - uses: actions/github-script@v7 + with: + script: | + const script = require('./.github/scripts/close-invalid-link.cjs') + await script({github, context}) diff --git a/synthtool/gcp/templates/node_library/.github/workflows/presubmit.yaml b/synthtool/gcp/templates/node_library/.github/workflows/presubmit.yaml new file mode 100644 index 000000000..51f942e3e --- /dev/null +++ b/synthtool/gcp/templates/node_library/.github/workflows/presubmit.yaml @@ -0,0 +1,20 @@ +on: + pull_request: +name: presubmit +jobs: + units: + runs-on: ubuntu-latest + strategy: + matrix: + node: [14, 16, 18, 20] + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v2 + with: + version: ^6.24.1 + - run: node --version + - run: ci/run_conditional_tests.sh + name: Run unit tests + env: + BUILD_TYPE: presubmit + TEST_TYPE: units diff --git a/synthtool/gcp/templates/node_library/.github/workflows/response.yml b/synthtool/gcp/templates/node_library/.github/workflows/response.yml new file mode 100644 index 000000000..6ed37326f --- /dev/null +++ b/synthtool/gcp/templates/node_library/.github/workflows/response.yml @@ -0,0 +1,35 @@ +name: no_response +on: + schedule: + - cron: '30 1 * * *' # Run every day at 01:30 + workflow_dispatch: + issue_comment: + +jobs: + close: + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + - uses: actions/github-script@v7 + with: + script: | + const script = require('./.github/scripts/close-unresponsive.cjs') + await script({github, context}) + + remove_label: + if: github.event_name == 'issue_comment' + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + - uses: actions/github-script@v7 + with: + script: | + const script = require('./.github/scripts/remove-response-label.cjs') + await script({github, context}) From 7622ce91dae5c70f7801e90ad2fb65d27a516947 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Sat, 27 Jul 2024 11:20:58 -0700 Subject: [PATCH 2/7] remove extra file --- .../.github/workflows/presubmit.yaml | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 synthtool/gcp/templates/node_library/.github/workflows/presubmit.yaml diff --git a/synthtool/gcp/templates/node_library/.github/workflows/presubmit.yaml b/synthtool/gcp/templates/node_library/.github/workflows/presubmit.yaml deleted file mode 100644 index 51f942e3e..000000000 --- a/synthtool/gcp/templates/node_library/.github/workflows/presubmit.yaml +++ /dev/null @@ -1,20 +0,0 @@ -on: - pull_request: -name: presubmit -jobs: - units: - runs-on: ubuntu-latest - strategy: - matrix: - node: [14, 16, 18, 20] - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 - with: - version: ^6.24.1 - - run: node --version - - run: ci/run_conditional_tests.sh - name: Run unit tests - env: - BUILD_TYPE: presubmit - TEST_TYPE: units From 4d3b5f577d7e3320d5b711bec1a1518d4b1f954a Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Sat, 27 Jul 2024 11:53:06 -0700 Subject: [PATCH 3/7] Update close-invalid-link.cjs --- .../node_library/.github/scripts/close-invalid-link.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synthtool/gcp/templates/node_library/.github/scripts/close-invalid-link.cjs b/synthtool/gcp/templates/node_library/.github/scripts/close-invalid-link.cjs index 871adf879..33c98c1e8 100644 --- a/synthtool/gcp/templates/node_library/.github/scripts/close-invalid-link.cjs +++ b/synthtool/gcp/templates/node_library/.github/scripts/close-invalid-link.cjs @@ -41,7 +41,7 @@ module.exports = async ({ github, context }) => { if (isBugTemplate) { try { - const link = issue.data.body.split("\n")[18].match(/(https?:\/\/g?i?s?t\.?github.com\/.*)/); + const link = issue.data.body.split("\n")[18].match(/(https?:\/\/g?i?s?t?\.?github.com\/.*)/); const isValidLink = (await fetch(link)).ok; if (!isValidLink) { await closeIssue(github, owner, repo, number); From 16e9e440e1ba15ab812d193758bc9c12d9011055 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Thu, 15 Aug 2024 15:33:58 -0700 Subject: [PATCH 4/7] respond to comments --- synthtool/gcp/templates/node_library/.github/CODEOWNERS | 2 +- .../.github/ISSUE_TEMPLATE/{bug_report.md => bug_report.yaml} | 0 .../{feature_request.md => feature_request.yaml} | 3 ++- .../.github/ISSUE_TEMPLATE/{question.md => questions.md} | 0 synthtool/gcp/templates/node_library/.github/auto-approve.yml | 4 +--- .../.github/workflows/{response.yml => response.yaml} | 0 6 files changed, 4 insertions(+), 5 deletions(-) rename synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/{bug_report.md => bug_report.yaml} (100%) rename synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/{feature_request.md => feature_request.yaml} (89%) rename synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/{question.md => questions.md} (100%) rename synthtool/gcp/templates/node_library/.github/workflows/{response.yml => response.yaml} (100%) diff --git a/synthtool/gcp/templates/node_library/.github/CODEOWNERS b/synthtool/gcp/templates/node_library/.github/CODEOWNERS index 619a56f43..d623af489 100644 --- a/synthtool/gcp/templates/node_library/.github/CODEOWNERS +++ b/synthtool/gcp/templates/node_library/.github/CODEOWNERS @@ -5,7 +5,7 @@ # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax -# The yoshi-nodejs team is the default owner for nodejs repositories. +# Unless specified, the jsteam is the default owner for nodejs repositories. {%- if 'codeowner_team' in metadata['repo'] %} * {{ metadata['repo']['codeowner_team'] }} @googleapis/jsteam {%- else %} diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/bug_report.md b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/bug_report.yaml similarity index 100% rename from synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/bug_report.md rename to synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/bug_report.yaml diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.md b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.yaml similarity index 89% rename from synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.md rename to synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.yaml index a0eb86a66..d90faada8 100644 --- a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.md +++ b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -29,7 +29,8 @@ body: submitting an issue in its linked tracker in the .repo-metadata.json file in the API under packages/* ([example]({{ metadata['repo']['issue_tracker'] }})) - Examples of common library-specific issues vs. API issues are: retry strategies, authentication questions, issues with typings. + Example of library specific issues would be: retry strategies, authentication questions, or issues with typings. + Examples of API issues would include: expanding method parameter types, adding functionality to an API. validations: required: true - type: textarea diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/question.md b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/questions.md similarity index 100% rename from synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/question.md rename to synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/questions.md diff --git a/synthtool/gcp/templates/node_library/.github/auto-approve.yml b/synthtool/gcp/templates/node_library/.github/auto-approve.yml index ec51b072d..7cba0af63 100644 --- a/synthtool/gcp/templates/node_library/.github/auto-approve.yml +++ b/synthtool/gcp/templates/node_library/.github/auto-approve.yml @@ -1,4 +1,2 @@ processes: - - "NodeDependency" - - "OwlBotTemplateChangesNode" - - "OwlBotPRsNode" \ No newline at end of file + - "NodeDependency" \ No newline at end of file diff --git a/synthtool/gcp/templates/node_library/.github/workflows/response.yml b/synthtool/gcp/templates/node_library/.github/workflows/response.yaml similarity index 100% rename from synthtool/gcp/templates/node_library/.github/workflows/response.yml rename to synthtool/gcp/templates/node_library/.github/workflows/response.yaml From 1029e6e2ac32c7fc03bb0c7b1ebb9816470f9c9c Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:07:06 -0700 Subject: [PATCH 5/7] Update README.md like: https://github.com/googleapis/synthtool/pull/2009/files --- synthtool/gcp/templates/node_library/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synthtool/gcp/templates/node_library/README.md b/synthtool/gcp/templates/node_library/README.md index 15009ea2d..8ce971d03 100644 --- a/synthtool/gcp/templates/node_library/README.md +++ b/synthtool/gcp/templates/node_library/README.md @@ -54,7 +54,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. 1. [Select or create a Cloud Platform project][projects].{% if metadata['repo']['requires_billing'] %} 1. [Enable billing for your project][billing].{% endif %} 1. [Enable the {{ metadata['repo']['name_pretty'] }} API][enable_api]. -1. [Set up authentication with a service account][auth] so you can access the +1. [Set up authentication][auth] so you can access the API from your local workstation. {% endif %} ### Installing the client library @@ -171,4 +171,4 @@ See [LICENSE](https://github.com/{{ metadata['repo']['repo'] }}/blob/{{ metadata [projects]: https://console.cloud.google.com/project [billing]: https://support.google.com/cloud/answer/6293499#enable-billing {% if metadata['repo']['api_id'] %}[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid={{ metadata['repo']['api_id'] }}{% endif %} -[auth]: https://cloud.google.com/docs/authentication/getting-started +[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local From 26ae44e5d789e7ecf279ed4e486c6d7cd82fb22d Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 20 Sep 2024 13:07:20 -0700 Subject: [PATCH 6/7] chore: address comments --- .../ISSUE_TEMPLATE/{bug_report.yaml => bug_report.yml} | 0 .../{feature_request.yaml => feature_request.yml} | 0 .../.github/scripts/close-invalid-link.cjs | 10 +++++----- .../{close-unresponse.cjs => close-unresponsive.cjs} | 8 ++++---- .../.github/scripts/remove-response-label.cjs | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) rename synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/{bug_report.yaml => bug_report.yml} (100%) rename synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/{feature_request.yaml => feature_request.yml} (100%) rename synthtool/gcp/templates/node_library/.github/scripts/{close-unresponse.cjs => close-unresponsive.cjs} (91%) diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/bug_report.yaml b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/bug_report.yml similarity index 100% rename from synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/bug_report.yaml rename to synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/bug_report.yml diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.yaml b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.yml similarity index 100% rename from synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.yaml rename to synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/feature_request.yml diff --git a/synthtool/gcp/templates/node_library/.github/scripts/close-invalid-link.cjs b/synthtool/gcp/templates/node_library/.github/scripts/close-invalid-link.cjs index 33c98c1e8..ba7d51372 100644 --- a/synthtool/gcp/templates/node_library/.github/scripts/close-invalid-link.cjs +++ b/synthtool/gcp/templates/node_library/.github/scripts/close-invalid-link.cjs @@ -17,16 +17,16 @@ async function closeIssue(github, owner, repo, number) { owner: owner, repo: repo, issue_number: number, - body: "Issue was opened with an invalid reproduction link. Please make sure the repository is a valid, publicly-accessible github repository, and make sure the url is complete (example: https://github.com/googleapis/google-cloud-node)" + body: 'Issue was opened with an invalid reproduction link. Please make sure the repository is a valid, publicly-accessible github repository, and make sure the url is complete (example: https://github.com/googleapis/google-cloud-node)' }); await github.rest.issues.update({ owner: owner, repo: repo, issue_number: number, - state: "closed" + state: 'closed' }); } -module.exports = async ({ github, context }) => { +module.exports = async ({github, context}) => { const owner = context.repo.owner; const repo = context.repo.repo; const number = context.issue.number; @@ -37,11 +37,11 @@ module.exports = async ({ github, context }) => { issue_number: number, }); - const isBugTemplate = issue.data.body.includes("Link to the code that reproduces this issue"); + const isBugTemplate = issue.data.body.includes('Link to the code that reproduces this issue'); if (isBugTemplate) { try { - const link = issue.data.body.split("\n")[18].match(/(https?:\/\/g?i?s?t?\.?github.com\/.*)/); + const link = issue.data.body.split('\n')[18].match(/(https?:\/\/g?i?s?t?\.?github.com\/.*)/); const isValidLink = (await fetch(link)).ok; if (!isValidLink) { await closeIssue(github, owner, repo, number); diff --git a/synthtool/gcp/templates/node_library/.github/scripts/close-unresponse.cjs b/synthtool/gcp/templates/node_library/.github/scripts/close-unresponsive.cjs similarity index 91% rename from synthtool/gcp/templates/node_library/.github/scripts/close-unresponse.cjs rename to synthtool/gcp/templates/node_library/.github/scripts/close-unresponsive.cjs index d97276334..142dc1265 100644 --- a/synthtool/gcp/templates/node_library/.github/scripts/close-unresponse.cjs +++ b/synthtool/gcp/templates/node_library/.github/scripts/close-unresponsive.cjs @@ -13,7 +13,7 @@ // limitations under the License. function labeledEvent(data) { - return data.event === "labeled" && data.label.name === "needs more info"; + return data.event === 'labeled' && data.label.name === 'needs more info'; } const numberOfDaysLimit = 15; @@ -21,14 +21,14 @@ function labeledEvent(data) { not been answered for ${numberOfDaysLimit} days. It can be reopened when the \ requested information is provided.`; - module.exports = async ({ github, context }) => { + module.exports = async ({github, context}) => { const owner = context.repo.owner; const repo = context.repo.repo; const issues = await github.rest.issues.listForRepo({ owner: owner, repo: repo, - labels: "needs more info", + labels: 'needs more info', }); const numbers = issues.data.map((e) => e.number); @@ -55,7 +55,7 @@ function labeledEvent(data) { owner: owner, repo: repo, issue_number: number, - state: "closed", + state: 'closed', }); await github.rest.issues.createComment({ diff --git a/synthtool/gcp/templates/node_library/.github/scripts/remove-response-label.cjs b/synthtool/gcp/templates/node_library/.github/scripts/remove-response-label.cjs index b501cc89d..887cf349e 100644 --- a/synthtool/gcp/templates/node_library/.github/scripts/remove-response-label.cjs +++ b/synthtool/gcp/templates/node_library/.github/scripts/remove-response-label.cjs @@ -22,12 +22,12 @@ module.exports = async ({ github, context }) => { const author = issue.data.user.login; const labels = issue.data.labels.map((e) => e.name); - if (author === commenter && labels.includes("needs more info")) { + if (author === commenter && labels.includes('needs more info')) { await github.rest.issues.removeLabel({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, - name: "needs more info", + name: 'needs more info', }); } }; From 61701a2c4d1183e9e269042194b060fd116831d8 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 20 Sep 2024 13:08:26 -0700 Subject: [PATCH 7/7] make last yml consistent --- .../{documentation_request.yaml => documentation_request.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/{documentation_request.yaml => documentation_request.yml} (100%) diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/documentation_request.yaml b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/documentation_request.yml similarity index 100% rename from synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/documentation_request.yaml rename to synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE/documentation_request.yml