diff --git a/.github/workflows/error-reporting.yaml b/.github/workflows/error-reporting.yaml new file mode 100644 index 0000000000..ab072c8e21 --- /dev/null +++ b/.github/workflows/error-reporting.yaml @@ -0,0 +1,66 @@ +name: error-reporting +on: + push: + branches: + - main + paths: + - "error-reporting/**" + pull_request: + paths: + - "error-reporting/**" + pull_request_target: + types: [labeled] + schedule: + - cron: "0 0 * * 0" +jobs: + test: + if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} + runs-on: ubuntu-latest + timeout-minutes: 60 + permissions: + contents: "write" + pull-requests: "write" + id-token: "write" + steps: + - uses: actions/checkout@v3.1.0 + with: + ref: ${{github.event.pull_request.head.sha}} + - uses: "google-github-actions/auth@v0.8.3" + with: + workload_identity_provider: "projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider" + service_account: "kokoro-system-test@long-door-651.iam.gserviceaccount.com" + create_credentials_file: "true" + access_token_lifetime: 600s + - uses: actions/setup-node@v3.5.1 + with: + node-version: 16 + - run: npm install + working-directory: error-reporting + - run: npm test + working-directory: error-reporting + env: + MOCHA_REPORTER_SUITENAME: error_reporting + MOCHA_REPORTER_OUTPUT: error_reporting_sponge_log.xml + MOCHA_REPORTER: xunit + - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + try { + await github.rest.issues.removeLabel({ + name: 'actions:force-run', + owner: 'GoogleCloudPlatform', + repo: 'nodejs-docs-samples', + issue_number: context.payload.pull_request.number + }); + } catch (e) { + if (!e.message.includes('Label does not exist')) { + throw e; + } + } + - if: ${{ github.event_name == 'schedule'}} + run: | + curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L + chmod +x ./flakybot + ./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} diff --git a/.github/workflows/workflows.json b/.github/workflows/workflows.json index 36ee104fd7..9b8a6675b4 100644 --- a/.github/workflows/workflows.json +++ b/.github/workflows/workflows.json @@ -30,6 +30,7 @@ "datacatalog/quickstart", "endpoints/getting-started", "endpoints/getting-started-grpc", + "error-reporting", "functions/firebase", "functions/helloworld", "functions/http", diff --git a/CODEOWNERS b/CODEOWNERS index 6239d5afb4..902bcca127 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -42,3 +42,6 @@ monitoring/opencensus @GoogleCloudPlatform/nodejs-samples-reviewers # Data & AI contact-center-insights @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/nodejs-samples-reviewers talent @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/nodejs-samples-reviewers + +# DEE-PO +error-reporting @GoogleCloudPlatform/dee-platform-ops @GoogleCloudPlatform/nodejs-samples-reviewers \ No newline at end of file diff --git a/error-reporting/explicitSetup.js b/error-reporting/explicitSetup.js index 27db9fd1fa..afb0830d26 100644 --- a/error-reporting/explicitSetup.js +++ b/error-reporting/explicitSetup.js @@ -20,7 +20,6 @@ 'use strict'; function explicitSetup() { - // [START error_reporting_setup_explicit] // [START error_reporting_setup_nodejs_explicit] // Imports the Google Cloud client library const {ErrorReporting} = require('@google-cloud/error-reporting'); @@ -34,7 +33,6 @@ function explicitSetup() { // Reports a simple error errors.report('Something broke!'); // [END error_reporting_setup_nodejs_explicit] - // [END error_reporting_setup_explicit] } explicitSetup(); diff --git a/error-reporting/express.js b/error-reporting/express.js index 743cf1c41a..685c7d5f04 100644 --- a/error-reporting/express.js +++ b/error-reporting/express.js @@ -20,7 +20,6 @@ 'use strict'; function express() { - // [START error_reporting_express] // [START error_reporting_setup_nodejs_express] const express = require('express'); @@ -51,6 +50,5 @@ function express() { console.log('Press Ctrl+C to quit.'); }); // [END error_reporting_setup_nodejs_express] - // [END error_reporting_express] } express(); diff --git a/error-reporting/implicitSetup.js b/error-reporting/implicitSetup.js index 36ea7e4ed8..f8d7eb80c8 100644 --- a/error-reporting/implicitSetup.js +++ b/error-reporting/implicitSetup.js @@ -20,7 +20,6 @@ 'use strict'; function setupImplicit() { - // [START error_reporting_setup_implicit] // [START error_reporting_setup_nodejs_implicit] // Imports the Google Cloud client library const {ErrorReporting} = require('@google-cloud/error-reporting'); @@ -31,7 +30,6 @@ function setupImplicit() { // Reports a simple error errors.report('Something broke!'); // [END error_reporting_setup_nodejs_implicit] - // [END error_reporting_setup_implicit] } setupImplicit(); diff --git a/error-reporting/manual.js b/error-reporting/manual.js index c15cab8dda..229d881c52 100644 --- a/error-reporting/manual.js +++ b/error-reporting/manual.js @@ -20,7 +20,6 @@ 'use strict'; function manual() { - // [START error_reporting_manual] // [START error_reporting_setup_nodejs_manual] // Imports the Google Cloud client library const {ErrorReporting} = require('@google-cloud/error-reporting'); @@ -50,6 +49,5 @@ function manual() { console.log('Done reporting error string!'); }); // [END error_reporting_setup_nodejs_manual] - // [END error_reporting_manual] } manual();