mirror of https://github.com/actions/toolkit
Explicitly import `crypto` (#1842)
* Explicitly import `crypto` * Add release notes for 1.11.1 * Fix crypto mock in test * Fix `crypto` mock * Lintpull/1843/head
parent
22a72ac3d7
commit
d14afd7973
|
@ -2,6 +2,7 @@ import * as core from '@actions/core'
|
|||
import * as exec from '@actions/exec'
|
||||
import * as glob from '@actions/glob'
|
||||
import * as io from '@actions/io'
|
||||
import * as crypto from 'crypto'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import * as semver from 'semver'
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
# @actions/core Releases
|
||||
|
||||
### 1.11.1
|
||||
- Fix uses of `crypto.randomUUID` on Node 18 and earlier [#1842](https://github.com/actions/toolkit/pull/1842)
|
||||
|
||||
### 1.11.0
|
||||
- Add platform info utilities [#1551](https://github.com/actions/toolkit/pull/1551)
|
||||
- Remove dependency on `uuid` package [#1824](https://github.com/actions/toolkit/pull/1824)
|
||||
|
|
|
@ -46,6 +46,11 @@ const testEnvVars = {
|
|||
const UUID = '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
|
||||
const DELIMITER = `ghadelimiter_${UUID}`
|
||||
|
||||
jest.mock('crypto', () => ({
|
||||
...jest.requireActual('crypto'),
|
||||
randomUUID: jest.fn(() => UUID)
|
||||
}))
|
||||
|
||||
const TEMP_DIR = path.join(__dirname, '_temp')
|
||||
|
||||
describe('@actions/core', () => {
|
||||
|
@ -66,10 +71,6 @@ describe('@actions/core', () => {
|
|||
process.env[key] = testEnvVars[key as keyof typeof testEnvVars]
|
||||
}
|
||||
process.stdout.write = jest.fn()
|
||||
|
||||
jest.spyOn(crypto, 'randomUUID').mockImplementation(() => {
|
||||
return UUID
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
{
|
||||
"name": "@actions/core",
|
||||
"version": "1.11.0",
|
||||
"version": "1.11.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@actions/core",
|
||||
"version": "1.11.0",
|
||||
"version": "1.11.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/http-client": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
"@types/node": "^16.18.112"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/exec": {
|
||||
|
@ -38,9 +38,9 @@
|
|||
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "12.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.2.tgz",
|
||||
"integrity": "sha512-5tabW/i+9mhrfEOUcLDu2xBPsHJ+X5Orqy9FKpale3SjDA17j5AEpYq5vfy3oAeAHGcvANRCO3NV3d2D6q3NiA==",
|
||||
"version": "16.18.112",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.112.tgz",
|
||||
"integrity": "sha512-EKrbKUGJROm17+dY/gMi31aJlGLJ75e1IkTojt9n6u+hnaTBDs+M1bIdOawpk2m6YUAXq/R2W0SxCng1tndHCg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/tunnel": {
|
||||
|
@ -75,9 +75,9 @@
|
|||
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "12.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.2.tgz",
|
||||
"integrity": "sha512-5tabW/i+9mhrfEOUcLDu2xBPsHJ+X5Orqy9FKpale3SjDA17j5AEpYq5vfy3oAeAHGcvANRCO3NV3d2D6q3NiA==",
|
||||
"version": "16.18.112",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.112.tgz",
|
||||
"integrity": "sha512-EKrbKUGJROm17+dY/gMi31aJlGLJ75e1IkTojt9n6u+hnaTBDs+M1bIdOawpk2m6YUAXq/R2W0SxCng1tndHCg==",
|
||||
"dev": true
|
||||
},
|
||||
"tunnel": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@actions/core",
|
||||
"version": "1.11.0",
|
||||
"version": "1.11.1",
|
||||
"description": "Actions core lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
|
@ -40,6 +40,6 @@
|
|||
"@actions/http-client": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
"@types/node": "^16.18.112"
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import * as crypto from 'crypto'
|
||||
import * as fs from 'fs'
|
||||
import * as os from 'os'
|
||||
import {toCommandValue} from './utils'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import * as core from '@actions/core'
|
||||
import * as io from '@actions/io'
|
||||
import * as crypto from 'crypto'
|
||||
import * as fs from 'fs'
|
||||
import * as mm from './manifest'
|
||||
import * as os from 'os'
|
||||
|
|
Loading…
Reference in New Issue