From edf0fb773b675f28f40285ba82a905c33dd1b5d6 Mon Sep 17 00:00:00 2001 From: Wes Tarle Date: Fri, 31 Jul 2026 09:32:59 +0000 Subject: [PATCH 1/2] build: remove invalid reproduction link issue closing bot --- .github/scripts/close-invalid-link.cjs | 73 ---------------- .github/scripts/fixtures/invalidIssueBody.txt | 50 ----------- .github/scripts/fixtures/validIssueBody.txt | 50 ----------- .../validIssueBodyDifferentLinkLocation.txt | 50 ----------- .github/scripts/package.json | 2 +- .../scripts/tests/close-invalid-link.test.cjs | 86 ------------------- .github/workflows/issues-no-repro.yaml | 28 ------ bin/migrate-split-repo.sh | 2 +- 8 files changed, 2 insertions(+), 339 deletions(-) delete mode 100644 .github/scripts/close-invalid-link.cjs delete mode 100644 .github/scripts/fixtures/invalidIssueBody.txt delete mode 100644 .github/scripts/fixtures/validIssueBody.txt delete mode 100644 .github/scripts/fixtures/validIssueBodyDifferentLinkLocation.txt delete mode 100644 .github/scripts/tests/close-invalid-link.test.cjs delete mode 100644 .github/workflows/issues-no-repro.yaml diff --git a/.github/scripts/close-invalid-link.cjs b/.github/scripts/close-invalid-link.cjs deleted file mode 100644 index ad864838529c..000000000000 --- a/.github/scripts/close-invalid-link.cjs +++ /dev/null @@ -1,73 +0,0 @@ -// 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. - -const fs = require('fs'); -const yaml = require('js-yaml'); -const path = require('path'); -const TEMPLATE_FILE_PATH = path.resolve(__dirname, '../ISSUE_TEMPLATE/bug_report.yml') - -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 yamlData = fs.readFileSync(TEMPLATE_FILE_PATH, 'utf8'); - const obj = yaml.load(yamlData); - const linkMatchingText = (obj.body.find(x => {return x.type === 'input' && x.validations.required === true && x.attributes.label.includes('link')})).attributes.label; - const isBugTemplate = issue.data.body.includes(linkMatchingText); - - if (isBugTemplate) { - console.log(`Issue ${number} is a bug template`) - try { - const text = issue.data.body; - const match = text.indexOf(linkMatchingText); - if (match !== -1) { - const nextLineIndex = text.indexOf('http', match); - if (nextLineIndex == -1) { - await closeIssue(github, owner, repo, number); - return; - } - const link = text.substring(nextLineIndex, text.indexOf('\n', nextLineIndex)); - console.log(`Issue ${number} contains this link: ${link}`); - const isValidLink = (await fetch(link)).ok; - console.log(`Issue ${number} has a ${isValidLink ? "valid" : "invalid"} link`) - if (!isValidLink) { - await closeIssue(github, owner, repo, number); - } - } - } catch (err) { - await closeIssue(github, owner, repo, number); - } - } -}; diff --git a/.github/scripts/fixtures/invalidIssueBody.txt b/.github/scripts/fixtures/invalidIssueBody.txt deleted file mode 100644 index 504bd669022c..000000000000 --- a/.github/scripts/fixtures/invalidIssueBody.txt +++ /dev/null @@ -1,50 +0,0 @@ -### Please make sure you have searched for information in the following guides. - -- [X] Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues -- [X] Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js -- [X] Check our Troubleshooting guide: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/troubleshooting -- [X] Check our FAQ: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/faq -- [X] Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md -- [X] Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs -- [X] Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples - -### A screenshot that you have tested with "Try this API". - - -N/A - -### Link to the code that reproduces this issue. A link to a **public** Github Repository or gist with a minimal reproduction. - -not-a-link - -### A step-by-step description of how to reproduce the issue, based on the linked reproduction. - - -Change MY_PROJECT to your project name, add credentials if needed and run. - -### A clear and concise description of what the bug is, and what you expected to happen. - -The application crashes with the following exception (which there is no way to catch). It should just emit error, and allow graceful handling. -TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object - at _write (node:internal/streams/writable:474:13) - at Writable.write (node:internal/streams/writable:502:10) - at Duplexify._write (/project/node_modules/duplexify/index.js:212:22) - at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) - at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) - at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) - at Pumpify. (/project/node_modules/@google-cloud/speech/build/src/helpers.js:79:27) - at Object.onceWrapper (node:events:633:26) - at Pumpify.emit (node:events:518:28) - at obj. [as _write] (/project/node_modules/stubs/index.js:28:22) - at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) - at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) - at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) - at PassThrough.ondata (node:internal/streams/readable:1007:22) - at PassThrough.emit (node:events:518:28) - at addChunk (node:internal/streams/readable:559:12) { - code: 'ERR_INVALID_ARG_TYPE' - - -### 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. ** - -No library should crash an application this way. \ No newline at end of file diff --git a/.github/scripts/fixtures/validIssueBody.txt b/.github/scripts/fixtures/validIssueBody.txt deleted file mode 100644 index 6e0ace338eb4..000000000000 --- a/.github/scripts/fixtures/validIssueBody.txt +++ /dev/null @@ -1,50 +0,0 @@ -### Please make sure you have searched for information in the following guides. - -- [X] Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues -- [X] Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js -- [X] Check our Troubleshooting guide: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/troubleshooting -- [X] Check our FAQ: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/faq -- [X] Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md -- [X] Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs -- [X] Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples - -### A screenshot that you have tested with "Try this API". - - -N/A - -### Link to the code that reproduces this issue. A link to a **public** Github Repository or gist with a minimal reproduction. - -https://gist.github.com/orgads/13cbf44c91923da27d8772b5f10489c9 - -### A step-by-step description of how to reproduce the issue, based on the linked reproduction. - - -Change MY_PROJECT to your project name, add credentials if needed and run. - -### A clear and concise description of what the bug is, and what you expected to happen. - -The application crashes with the following exception (which there is no way to catch). It should just emit error, and allow graceful handling. -TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object - at _write (node:internal/streams/writable:474:13) - at Writable.write (node:internal/streams/writable:502:10) - at Duplexify._write (/project/node_modules/duplexify/index.js:212:22) - at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) - at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) - at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) - at Pumpify. (/project/node_modules/@google-cloud/speech/build/src/helpers.js:79:27) - at Object.onceWrapper (node:events:633:26) - at Pumpify.emit (node:events:518:28) - at obj. [as _write] (/project/node_modules/stubs/index.js:28:22) - at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) - at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) - at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) - at PassThrough.ondata (node:internal/streams/readable:1007:22) - at PassThrough.emit (node:events:518:28) - at addChunk (node:internal/streams/readable:559:12) { - code: 'ERR_INVALID_ARG_TYPE' - - -### 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. ** - -No library should crash an application this way. \ No newline at end of file diff --git a/.github/scripts/fixtures/validIssueBodyDifferentLinkLocation.txt b/.github/scripts/fixtures/validIssueBodyDifferentLinkLocation.txt deleted file mode 100644 index e66c33226f67..000000000000 --- a/.github/scripts/fixtures/validIssueBodyDifferentLinkLocation.txt +++ /dev/null @@ -1,50 +0,0 @@ -### Please make sure you have searched for information in the following guides. - -- [X] Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues -- [X] Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js -- [X] Check our Troubleshooting guide: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/troubleshooting -- [X] Check our FAQ: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/faq -- [X] Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md -- [X] Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs -- [X] Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples - -### A screenshot that you have tested with "Try this API". - - -N/A - -### A step-by-step description of how to reproduce the issue, based on the linked reproduction. - - -Change MY_PROJECT to your project name, add credentials if needed and run. - -### A clear and concise description of what the bug is, and what you expected to happen. - -The application crashes with the following exception (which there is no way to catch). It should just emit error, and allow graceful handling. -TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object - at _write (node:internal/streams/writable:474:13) - at Writable.write (node:internal/streams/writable:502:10) - at Duplexify._write (/project/node_modules/duplexify/index.js:212:22) - at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) - at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) - at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) - at Pumpify. (/project/node_modules/@google-cloud/speech/build/src/helpers.js:79:27) - at Object.onceWrapper (node:events:633:26) - at Pumpify.emit (node:events:518:28) - at obj. [as _write] (/project/node_modules/stubs/index.js:28:22) - at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) - at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) - at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) - at PassThrough.ondata (node:internal/streams/readable:1007:22) - at PassThrough.emit (node:events:518:28) - at addChunk (node:internal/streams/readable:559:12) { - code: 'ERR_INVALID_ARG_TYPE' - -### Link to the code that reproduces this issue. A link to a **public** Github Repository or gist with a minimal reproduction. - - -https://gist.github.com/orgads/13cbf44c91923da27d8772b5f10489c9 - -### 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. ** - -No library should crash an application this way. \ No newline at end of file diff --git a/.github/scripts/package.json b/.github/scripts/package.json index e7b5938e5528..78f461ec8f63 100644 --- a/.github/scripts/package.json +++ b/.github/scripts/package.json @@ -3,7 +3,7 @@ "private": true, "description": "tests for script", "scripts": { - "test": "mocha tests/close-invalid-link.test.cjs && mocha tests/close-or-remove-response-label.test.cjs", + "test": "mocha tests/close-or-remove-response-label.test.cjs", "samples-test": "echo 'no samples test!'", "system-test": "echo 'no system test!'" }, diff --git a/.github/scripts/tests/close-invalid-link.test.cjs b/.github/scripts/tests/close-invalid-link.test.cjs deleted file mode 100644 index f63ee89c811b..000000000000 --- a/.github/scripts/tests/close-invalid-link.test.cjs +++ /dev/null @@ -1,86 +0,0 @@ -// 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 -// -// https://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. - -'use strict'; - -const { describe, it } = require('mocha'); -const closeInvalidLink = require('../close-invalid-link.cjs'); -const fs = require('fs'); -const sinon = require('sinon'); - -describe('close issues with invalid links', () => { - let octokitStub; - let issuesStub; - - beforeEach(() => { - issuesStub = { - get: sinon.stub(), - createComment: sinon.stub(), - update: sinon.stub(), - }; - octokitStub = { - rest: { - issues: issuesStub, - }, - }; - }); - - afterEach(() => { - sinon.restore(); - }); - - it('does not do anything if it is not a bug', async () => { - const context = { repo: { owner: 'testOrg', repo: 'testRepo' }, issue: { number: 1 } }; - issuesStub.get.resolves({ data: { body: "I'm having a problem with this." } }); - - await closeInvalidLink({ github: octokitStub, context }); - - sinon.assert.calledOnce(issuesStub.get); - sinon.assert.notCalled(issuesStub.createComment); - sinon.assert.notCalled(issuesStub.update); - }); - - it('does not do anything if it is a bug with an appropriate link', async () => { - const context = { repo: { owner: 'testOrg', repo: 'testRepo' }, issue: { number: 1 } }; - issuesStub.get.resolves({ data: { body: fs.readFileSync('./fixtures/validIssueBody.txt', 'utf-8') } }); - - await closeInvalidLink({ github: octokitStub, context }); - - sinon.assert.calledOnce(issuesStub.get); - sinon.assert.notCalled(issuesStub.createComment); - sinon.assert.notCalled(issuesStub.update); - }); - - it('does not do anything if it is a bug with an appropriate link and the template changes', async () => { - const context = { repo: { owner: 'testOrg', repo: 'testRepo' }, issue: { number: 1 } }; - issuesStub.get.resolves({ data: { body: fs.readFileSync('./fixtures/validIssueBodyDifferentLinkLocation.txt', 'utf-8') } }); - - await closeInvalidLink({ github: octokitStub, context }); - - sinon.assert.calledOnce(issuesStub.get); - sinon.assert.notCalled(issuesStub.createComment); - sinon.assert.notCalled(issuesStub.update); - }); - - it('closes the issue if the link is invalid', async () => { - const context = { repo: { owner: 'testOrg', repo: 'testRepo' }, issue: { number: 1 } }; - issuesStub.get.resolves({ data: { body: fs.readFileSync('./fixtures/invalidIssueBody.txt', 'utf-8') } }); - - await closeInvalidLink({ github: octokitStub, context }); - - sinon.assert.calledOnce(issuesStub.get); - sinon.assert.calledOnce(issuesStub.createComment); - sinon.assert.calledOnce(issuesStub.update); - }); -}); \ No newline at end of file diff --git a/.github/workflows/issues-no-repro.yaml b/.github/workflows/issues-no-repro.yaml deleted file mode 100644 index f65c54ea1dbd..000000000000 --- a/.github/workflows/issues-no-repro.yaml +++ /dev/null @@ -1,28 +0,0 @@ -permissions: - contents: read - -name: invalid_link -on: - issues: - types: [opened, reopened] - -jobs: - close: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - with: - persist-credentials: false - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: 18 - - run: npm install - working-directory: ./.github/scripts - - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 - with: - script: | - const script = require('./.github/scripts/close-invalid-link.cjs') - await script({github, context}) diff --git a/bin/migrate-split-repo.sh b/bin/migrate-split-repo.sh index 61dfc0f4c796..a866f710c088 100755 --- a/bin/migrate-split-repo.sh +++ b/bin/migrate-split-repo.sh @@ -37,7 +37,7 @@ ${SCRIPT_DIR}/migrate-git-history.sh \ "googleapis/google-cloud-node" \ "" \ "${PACKAGE_PATH}" \ - "samples",".github/workflows/ci.yaml,.github/workflows/issues-no-repro.yaml,.github/workflows/response.yaml,SECURITY.md,renovate.json" \ + "samples",".github/workflows/ci.yaml,.github/workflows/response.yaml,SECURITY.md,renovate.json" \ "samples/generated",".github/.OwlBot.yaml,system-test/test/quickstart.js,system-test/test/quickstart.test.js" From 892c3831a60f9fa9697218820ebbc3727a145036 Mon Sep 17 00:00:00 2001 From: Wes Tarle Date: Fri, 31 Jul 2026 10:32:54 +0000 Subject: [PATCH 2/2] docs: remove obsolete issue templates and replace with config.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 -- .github/ISSUE_TEMPLATE/config.yml | 8 ++++++++ .github/ISSUE_TEMPLATE/process_request.md | 5 ----- .github/ISSUE_TEMPLATE/questions.md | 8 -------- .github/ISSUE_TEMPLATE/support_request.md | 7 ------- 5 files changed, 8 insertions(+), 22 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/process_request.md delete mode 100644 .github/ISSUE_TEMPLATE/questions.md delete mode 100644 .github/ISSUE_TEMPLATE/support_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 483ef9b5a717..0141fe0b4d85 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -76,8 +76,6 @@ body: 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 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000000..29ebf5a886ea --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Support Request + url: https://cloud.google.com/support/ + about: If you have a support contract with Google, please file an issue in the Google Cloud Support console instead of GitHub. + - name: Question + url: https://github.com/googleapis/google-cloud-node/discussions + about: If you have a general question that goes beyond the library itself, please use Discussions to engage with fellow community members. diff --git a/.github/ISSUE_TEMPLATE/process_request.md b/.github/ISSUE_TEMPLATE/process_request.md deleted file mode 100644 index 93ef0b7449ba..000000000000 --- a/.github/ISSUE_TEMPLATE/process_request.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -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, broken links. - ---- diff --git a/.github/ISSUE_TEMPLATE/questions.md b/.github/ISSUE_TEMPLATE/questions.md deleted file mode 100644 index 1cc8d742520a..000000000000 --- a/.github/ISSUE_TEMPLATE/questions.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: Question -about: If you have a question, please use Discussions - ---- - -If you have a general question that goes beyond the library itself, we encourage you to use [Discussions](https://github.com/googleapis/google-cloud-node/discussions) -to engage with fellow community members! diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md deleted file mode 100644 index e3b47958958b..000000000000 --- a/.github/ISSUE_TEMPLATE/support_request.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: Support request -about: If you have a support contract with Google, please use this issue type. - ---- - -**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.