From 50b79769deee6a2f2f3320cf9d9ad0b2b2f9f239 Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Mon, 11 Sep 2023 10:55:45 -0400 Subject: [PATCH] chore(docs): fix dataset delete script (#4906) * chore(docs): fix dataset delete script - add more logging in delete script - use PR numbers as dataset names instead of github ref * chore(docs): prefix dataset name with pr * chore(docs): fix turbo token --- .github/workflows/docReport.yml | 8 ++++---- .github/workflows/docReportTeardown.yml | 6 +++--- scripts/doc-report/docReportCleanup.ts | 6 ++++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docReport.yml b/.github/workflows/docReport.yml index f08bf6108e9..0eb05d26fe5 100644 --- a/.github/workflows/docReport.yml +++ b/.github/workflows/docReport.yml @@ -11,8 +11,8 @@ jobs: report: runs-on: ubuntu-latest env: - TURBO_TOKEN: ${{ secrets.VERCEL_TOKEN }} - TURBO_TEAM: sanity-io + TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} + TURBO_TEAM: ${{ vars.TURBO_TEAM }} steps: - name: Checkout @@ -51,14 +51,14 @@ jobs: if: ${{ github.event_name == 'pull_request' }} env: DOCS_REPORT_TOKEN: ${{ secrets.DOCS_REPORT_DATASET_TOKEN }} - DOCS_REPORT_DATASET: ${{ github.ref_name }} + DOCS_REPORT_DATASET: pr-${{ github.event.number }} run: yarn docs:report:create - name: Compare Docs Coverage on PR if: ${{ github.event_name == 'pull_request' }} env: DOCS_REPORT_TOKEN: ${{ secrets.DOCS_REPORT_DATASET_TOKEN }} - DOCS_REPORT_DATASET: ${{ github.ref_name }} + DOCS_REPORT_DATASET: pr-${{ github.event.number }} run: yarn docs:report - name: PR comment with report diff --git a/.github/workflows/docReportTeardown.yml b/.github/workflows/docReportTeardown.yml index c629c92cffa..34930c01db3 100644 --- a/.github/workflows/docReportTeardown.yml +++ b/.github/workflows/docReportTeardown.yml @@ -9,8 +9,8 @@ jobs: reportTeardown: runs-on: ubuntu-latest env: - TURBO_TOKEN: ${{ secrets.VERCEL_TOKEN }} - TURBO_TEAM: sanity-io + TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} + TURBO_TEAM: ${{ vars.TURBO_TEAM }} steps: - name: Checkout @@ -36,5 +36,5 @@ jobs: - name: Remove datasets for closed PRs env: DOCS_REPORT_TOKEN: ${{ secrets.DOCS_REPORT_DATASET_TOKEN }} - DOCS_REPORT_DATASET: ${{ github.ref_name }} + DOCS_REPORT_DATASET: pr-${{ github.event.number }} run: yarn docs:report:cleanup diff --git a/scripts/doc-report/docReportCleanup.ts b/scripts/doc-report/docReportCleanup.ts index 89c1ccea07c..6d0871792de 100644 --- a/scripts/doc-report/docReportCleanup.ts +++ b/scripts/doc-report/docReportCleanup.ts @@ -1,10 +1,13 @@ import {sanityIdify} from '../utils/sanityIdify' +import {startTimer} from '../utils/startTimer' import {createDocClient} from './docClient' import {readEnv} from './envVars' const DATASET = readEnv('DOCS_REPORT_DATASET') const studioMetricsClient = createDocClient(DATASET) +const timer = startTimer(`Deleting dataset ${DATASET}`) + studioMetricsClient.datasets .delete(sanityIdify(DATASET)) .then((res) => { @@ -17,3 +20,6 @@ studioMetricsClient.datasets .catch((err) => { throw new Error(`Something went wrong! ${err?.response?.body?.message}`) }) + .finally(() => { + timer.end() + })