Skip to content

Commit

Permalink
chore(docs): fix dataset delete script (#4906)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
binoy14 committed Sep 11, 2023
1 parent fe761cf commit 50b7976
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/docReport.yml
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docReportTeardown.yml
Expand Up @@ -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
Expand All @@ -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
6 changes: 6 additions & 0 deletions 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) => {
Expand All @@ -17,3 +20,6 @@ studioMetricsClient.datasets
.catch((err) => {
throw new Error(`Something went wrong! ${err?.response?.body?.message}`)
})
.finally(() => {
timer.end()
})

2 comments on commit 50b7976

@vercel
Copy link

@vercel vercel bot commented on 50b7976 Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

performance-studio – ./

performance-studio.sanity.build
performance-studio-git-next.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 50b7976 Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio-git-next.sanity.build
test-studio.sanity.build

Please sign in to comment.