From 4c1b92992e687dcc1073af21741bdd55f2bf51d1 Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Thu, 7 Sep 2023 16:29:37 -0400 Subject: [PATCH 1/3] chore(docs): fix dataset delete script - add more logging in delete script - use PR numbers as dataset names instead of github ref --- .github/workflows/docReport.yml | 4 ++-- .github/workflows/docReportTeardown.yml | 2 +- scripts/doc-report/docReportCleanup.ts | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docReport.yml b/.github/workflows/docReport.yml index f08bf6108e9..d3e811aa993 100644 --- a/.github/workflows/docReport.yml +++ b/.github/workflows/docReport.yml @@ -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: ${{ 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: ${{ 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..7ba281f45bc 100644 --- a/.github/workflows/docReportTeardown.yml +++ b/.github/workflows/docReportTeardown.yml @@ -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: ${{ 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() + }) From 2fc400dae1dfd8bb2ea7bb747dd1281259ed07fe Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Fri, 8 Sep 2023 09:02:12 -0400 Subject: [PATCH 2/3] chore(docs): prefix dataset name with pr --- .github/workflows/docReport.yml | 4 ++-- .github/workflows/docReportTeardown.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docReport.yml b/.github/workflows/docReport.yml index d3e811aa993..c315a00c49e 100644 --- a/.github/workflows/docReport.yml +++ b/.github/workflows/docReport.yml @@ -51,14 +51,14 @@ jobs: if: ${{ github.event_name == 'pull_request' }} env: DOCS_REPORT_TOKEN: ${{ secrets.DOCS_REPORT_DATASET_TOKEN }} - DOCS_REPORT_DATASET: ${{ github.event.number }} + 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.event.number }} + 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 7ba281f45bc..b84e0c11c83 100644 --- a/.github/workflows/docReportTeardown.yml +++ b/.github/workflows/docReportTeardown.yml @@ -36,5 +36,5 @@ jobs: - name: Remove datasets for closed PRs env: DOCS_REPORT_TOKEN: ${{ secrets.DOCS_REPORT_DATASET_TOKEN }} - DOCS_REPORT_DATASET: ${{ github.event.number }} + DOCS_REPORT_DATASET: pr-${{ github.event.number }} run: yarn docs:report:cleanup From 29e1aac40fb138cc00a70876b94f30862b205589 Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Fri, 8 Sep 2023 09:08:38 -0400 Subject: [PATCH 3/3] chore(docs): fix turbo token --- .github/workflows/docReport.yml | 4 ++-- .github/workflows/docReportTeardown.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docReport.yml b/.github/workflows/docReport.yml index c315a00c49e..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 diff --git a/.github/workflows/docReportTeardown.yml b/.github/workflows/docReportTeardown.yml index b84e0c11c83..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