ci/github-script: use real @actions/core
This allows building markdown summaries, which is hard to mock.
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
package-lock-only = true
|
package-lock-only = true
|
||||||
|
save-exact = true
|
||||||
|
|||||||
1
ci/github-script/package-lock.json
generated
1
ci/github-script/package-lock.json
generated
@@ -6,6 +6,7 @@
|
|||||||
"": {
|
"": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/artifact": "2.3.2",
|
"@actions/artifact": "2.3.2",
|
||||||
|
"@actions/core": "1.11.1",
|
||||||
"@actions/github": "6.0.1",
|
"@actions/github": "6.0.1",
|
||||||
"bottleneck": "2.19.5",
|
"bottleneck": "2.19.5",
|
||||||
"commander": "14.0.0"
|
"commander": "14.0.0"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/artifact": "2.3.2",
|
"@actions/artifact": "2.3.2",
|
||||||
|
"@actions/core": "1.11.1",
|
||||||
"@actions/github": "6.0.1",
|
"@actions/github": "6.0.1",
|
||||||
"bottleneck": "2.19.5",
|
"bottleneck": "2.19.5",
|
||||||
"commander": "14.0.0"
|
"commander": "14.0.0"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { mkdtempSync, rmSync } from 'node:fs'
|
|||||||
import { tmpdir } from 'node:os'
|
import { tmpdir } from 'node:os'
|
||||||
import { join } from 'node:path'
|
import { join } from 'node:path'
|
||||||
import { program } from 'commander'
|
import { program } from 'commander'
|
||||||
|
import * as core from '@actions/core'
|
||||||
import { getOctokit } from '@actions/github'
|
import { getOctokit } from '@actions/github'
|
||||||
|
|
||||||
async function run(action, owner, repo, pull_number, dry) {
|
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-'))
|
const tmp = mkdtempSync(join(tmpdir(), 'github-script-'))
|
||||||
try {
|
try {
|
||||||
process.env.GITHUB_WORKSPACE = tmp
|
process.env.GITHUB_WORKSPACE = tmp
|
||||||
|
process.env['INPUT_GITHUB-TOKEN'] = token
|
||||||
process.chdir(tmp)
|
process.chdir(tmp)
|
||||||
|
|
||||||
await action({
|
await action({
|
||||||
@@ -33,18 +35,7 @@ async function run(action, owner, repo, pull_number, dry) {
|
|||||||
repo,
|
repo,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
core: {
|
core,
|
||||||
getInput() {
|
|
||||||
return token
|
|
||||||
},
|
|
||||||
error: console.error,
|
|
||||||
info: console.log,
|
|
||||||
notice: console.log,
|
|
||||||
setFailed(msg) {
|
|
||||||
console.error(msg)
|
|
||||||
process.exitCode = 1
|
|
||||||
},
|
|
||||||
},
|
|
||||||
dry,
|
dry,
|
||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user