diff --git a/.github/workflows/discovery.yaml b/.github/workflows/discovery.yaml index 4ad59789f616..64e6e98289f7 100644 --- a/.github/workflows/discovery.yaml +++ b/.github/workflows/discovery.yaml @@ -1,32 +1,41 @@ +name: Update Discovery Generated Types + permissions: contents: read +concurrency: + group: discovery-types-sync + cancel-in-progress: false + on: schedule: - cron: '0 12 * * TUE' workflow_dispatch: -name: Update Discovery Generated Types + jobs: sync: runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: read issues: write # Added for creating issues on failure steps: - - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: persist-credentials: false - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: 22 - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 - # Install all deps, including dev dependencies. - - run: cd handwritten/bigquery && pnpm install --filter . - # Generate types - - run: cd handwritten/bigquery && pnpm run types - # Fix formatting (scoped to generated types.d.ts and clean up untracked pnpm-lock.yaml) - - run: cd handwritten/bigquery && pnpm run fix && git checkout src/bigquery.ts system-test/ 2>/dev/null || true && rm -f pnpm-lock.yaml + # Install root and BigQuery dependencies from the frozen workspace lockfile. + - run: pnpm install --frozen-lockfile --ignore-scripts --filter google-cloud-node --filter @google-cloud/bigquery + # Generate types and format only the generated declaration file. + - run: pnpm --dir handwritten/bigquery run types + - run: pnpm --dir handwritten/bigquery exec prettier --write src/types.d.ts + # Verify updated types compile and pass BigQuery unit tests before opening a PR. + - run: pnpm --dir handwritten/bigquery run compile + - run: pnpm --dir handwritten/bigquery test # Submit pull request - uses: googleapis/code-suggester@f9fef85aa02459e30e62526abe950341cbbd768b # v5 env: @@ -48,4 +57,4 @@ jobs: with: title: "Update Discovery Generated Types failed" body: "The weekly scheduled task to update Discovery Generated Types failed." - mention: "@googleapis/cloud-sdk-nodejs-team" # Can be updated to @googleapis/bigquery-team if preferred + mention: "@googleapis/cloud-sdk-nodejs-team @googleapis/bigquery-team"