From 2433050fb7e8130a9b421f09cad2daca19414fe1 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 13 Jul 2025 21:11:43 +0200 Subject: [PATCH] ci/github-script: use real @actions/core This allows building markdown summaries, which is hard to mock. --- ci/github-script/.npmrc | 1 + ci/github-script/package-lock.json | 1 + ci/github-script/package.json | 1 + ci/github-script/run | 15 +++------------ 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/ci/github-script/.npmrc b/ci/github-script/.npmrc index f91a336f47b6..fb41d64f4679 100644 --- a/ci/github-script/.npmrc +++ b/ci/github-script/.npmrc @@ -1 +1,2 @@ package-lock-only = true +save-exact = true diff --git a/ci/github-script/package-lock.json b/ci/github-script/package-lock.json index 538083dcea93..0dcc9b68e259 100644 --- a/ci/github-script/package-lock.json +++ b/ci/github-script/package-lock.json @@ -6,6 +6,7 @@ "": { "dependencies": { "@actions/artifact": "2.3.2", + "@actions/core": "1.11.1", "@actions/github": "6.0.1", "bottleneck": "2.19.5", "commander": "14.0.0" diff --git a/ci/github-script/package.json b/ci/github-script/package.json index 4671dd41f0cd..860bb09cdd95 100644 --- a/ci/github-script/package.json +++ b/ci/github-script/package.json @@ -2,6 +2,7 @@ "private": true, "dependencies": { "@actions/artifact": "2.3.2", + "@actions/core": "1.11.1", "@actions/github": "6.0.1", "bottleneck": "2.19.5", "commander": "14.0.0" diff --git a/ci/github-script/run b/ci/github-script/run index cbf3ea9315e0..03309352aeee 100755 --- a/ci/github-script/run +++ b/ci/github-script/run @@ -4,6 +4,7 @@ import { mkdtempSync, rmSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { program } from 'commander' +import * as core from '@actions/core' import { getOctokit } from '@actions/github' async function run(action, owner, repo, pull_number, dry) { @@ -22,6 +23,7 @@ async function run(action, owner, repo, pull_number, dry) { const tmp = mkdtempSync(join(tmpdir(), 'github-script-')) try { process.env.GITHUB_WORKSPACE = tmp + process.env['INPUT_GITHUB-TOKEN'] = token process.chdir(tmp) await action({ @@ -33,18 +35,7 @@ async function run(action, owner, repo, pull_number, dry) { repo, }, }, - core: { - getInput() { - return token - }, - error: console.error, - info: console.log, - notice: console.log, - setFailed(msg) { - console.error(msg) - process.exitCode = 1 - }, - }, + core, dry, }) } finally {