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 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docReport.yml
Original file line number Diff line number Diff line change
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: ${{ github.event.number }}
Copy link
Member

Choose a reason for hiding this comment

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

should we prefx it so it's easy to identify as a temporary dataset?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure I can take a look at how to do that

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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docReportTeardown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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()
})
Loading