From ec5609b18c79ea9fc8183ae78e917801e6a8a3f4 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Sun, 18 Feb 2024 22:43:16 +0100 Subject: chore: convert to esm (#2261) --- .github/workflows/ci.yml | 3 +++ .github/workflows/commentCodeGeneration.ts | 6 +++--- .github/workflows/pr.yml | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6524af14..401eceb9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -173,6 +173,9 @@ jobs: env: CYPRESS_INSTALL_BINARY: 0 + - name: Build types + run: pnpm run build:types + - name: Check scripts run: pnpm run ts-check diff --git a/.github/workflows/commentCodeGeneration.ts b/.github/workflows/commentCodeGeneration.ts index f456e563..ed5258d5 100644 --- a/.github/workflows/commentCodeGeneration.ts +++ b/.github/workflows/commentCodeGeneration.ts @@ -10,11 +10,11 @@ import type { context as ctx, GitHub } from '@actions/github/lib/utils'; * @param context An object containing the context of the workflow run * @param isSuccess A boolean indicating whether the workflow was successful */ -module.exports = async ( +export async function script( github: InstanceType, context: typeof ctx, isSuccess: boolean -) => { +): Promise { const { data: comments } = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, @@ -45,4 +45,4 @@ module.exports = async ( body, }); } -}; +} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e250f9e4..6b913830 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -50,13 +50,13 @@ jobs: continue-on-error: true - name: Transpile ts - run: pnpm exec tsc .github/workflows/commentCodeGeneration.ts --outDir .github/workflows + run: pnpm tsup-node .github/workflows/commentCodeGeneration.ts --format cjs --clean false --out-dir .github/workflows - name: Comment uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: script: | - const script = require('${{ github.workspace }}/.github/workflows/commentCodeGeneration.js') + const { script } = require('${{ github.workspace }}/.github/workflows/commentCodeGeneration.cjs') await script(github, context, ${{ steps.generate.outcome == 'success' && steps.diff.outcome == 'success' }}) - name: Status -- cgit v1.2.3