Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): fix dataset delete script #4906

Merged
merged 3 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/docReport.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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()
})