From 4b9662b21e1cc6bcb751672ee0285aa96a1e670d Mon Sep 17 00:00:00 2001 From: Charis <26616127+charislam@users.noreply.github.com> Date: Thu, 5 Jun 2025 13:16:36 -0400 Subject: [PATCH] ci(docs lint): fix commenting workflow (#36062) * ci(docs): fix sync process GraphQL codegen needs to be run before sync because otherwise the types are missing. Missed this in local testing because codegen had already been run for other reasons. * fix(troubleshooting sync): unresolved import * ci(docs lint): fix commenting workflow --- .github/workflows/docs-lint-v2-comment.yml | 6 +++--- apps/docs/features/docs/Troubleshooting.script.mjs | 4 +--- apps/docs/package.json | 1 + apps/docs/scripts/utils/dotenv.js | 8 ++++++++ apps/docs/scripts/utils/dotenv.ts | 5 ----- 5 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 apps/docs/scripts/utils/dotenv.js delete mode 100644 apps/docs/scripts/utils/dotenv.ts diff --git a/.github/workflows/docs-lint-v2-comment.yml b/.github/workflows/docs-lint-v2-comment.yml index 7194e9e218..cd882ce80b 100644 --- a/.github/workflows/docs-lint-v2-comment.yml +++ b/.github/workflows/docs-lint-v2-comment.yml @@ -28,7 +28,7 @@ jobs: uses: actions/github-script@v7 with: script: | - const artifacts = await github.actions.listWorkflowRunArtifacts({ + const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, run_id: ${{ github.event.workflow_run.id }} @@ -38,7 +38,7 @@ jobs: ); if (matchingArtifact) { core.setOutput('contains_results', 'true') - const download = await github.actions.downloadArtifact({ + const download = await github.rest.actions.downloadArtifact({ owner: context.repo.owner, repo: context.repo.repo, artifact_id: matchingArtifact.id, @@ -59,7 +59,7 @@ jobs: const fs = require('fs'); const prNumber = Number(fs.readFileSync('./pr_number.txt')); const lintResults = fs.readFileSync('./lint_results.txt', 'utf8'); - await github.issues.createComment({ + await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: prNumber, diff --git a/apps/docs/features/docs/Troubleshooting.script.mjs b/apps/docs/features/docs/Troubleshooting.script.mjs index e3a710b874..6f5d00f175 100644 --- a/apps/docs/features/docs/Troubleshooting.script.mjs +++ b/apps/docs/features/docs/Troubleshooting.script.mjs @@ -7,7 +7,7 @@ * Discussions. */ -import _configureDotEnv from '../../scripts/utils/dotenv' +import '../../scripts/utils/dotenv.js' import { createAppAuth } from '@octokit/auth-app' import { Octokit } from '@octokit/core' @@ -27,8 +27,6 @@ import { getArticleSlug, } from './Troubleshooting.utils.common.mjs' -const _ = _configureDotEnv - const REPOSITORY_ID = 'MDEwOlJlcG9zaXRvcnkyMTQ1ODcxOTM=' const TROUBLESHOOTING_CATEGORY_ID = 'DIC_kwDODMpXOc4CUvEr' const REPOSITORY_OWNER = 'supabase' diff --git a/apps/docs/package.json b/apps/docs/package.json index cd728bc036..34ec1444f4 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -26,6 +26,7 @@ "prebuild": "pnpm run codegen:graphql && pnpm run codegen:references && pnpm run codegen:examples", "predev": "pnpm run codegen:graphql && pnpm run codegen:references && pnpm run codegen:examples", "preinstall": "npx only-allow pnpm", + "presync": "pnpm run codegen:graphql", "pretest": "pnpm run codegen:examples", "pretypecheck": "pnpm run codegen:graphql", "start": "next start", diff --git a/apps/docs/scripts/utils/dotenv.js b/apps/docs/scripts/utils/dotenv.js new file mode 100644 index 0000000000..7913e8a5b0 --- /dev/null +++ b/apps/docs/scripts/utils/dotenv.js @@ -0,0 +1,8 @@ +// Must be a .js not a .ts so it can be imported outside of the scripts +// directory without having to compile + +import dotenv from 'dotenv' + +dotenv.config({ path: '.env.local' }) + +export default undefined diff --git a/apps/docs/scripts/utils/dotenv.ts b/apps/docs/scripts/utils/dotenv.ts deleted file mode 100644 index 6a82653106..0000000000 --- a/apps/docs/scripts/utils/dotenv.ts +++ /dev/null @@ -1,5 +0,0 @@ -import dotenv from 'dotenv' - -dotenv.config({ path: '.env.local' }) - -export default undefined