Convert secret-scanning JavaScript files to TypeScript (#55734)
This commit is contained in:
@@ -2,7 +2,8 @@ import { schema } from '#src/frame/lib/frontmatter.js'
|
||||
|
||||
// Secret scanning entries have `versions` blocks that match `versions` frontmatter,
|
||||
// so we can import that part of the FM schema.
|
||||
const versionsProps = Object.assign({}, schema.properties.versions)
|
||||
// Access the versions property which is defined dynamically in frontmatter.js
|
||||
const versionsProps = Object.assign({}, (schema.properties as Record<string, any>).versions)
|
||||
|
||||
// The secret-scanning.json contains an array of objects that look like this:
|
||||
// {
|
||||
@@ -20,6 +21,18 @@ const versionsProps = Object.assign({}, schema.properties.versions)
|
||||
// "hasValidityCheck": false
|
||||
// },
|
||||
|
||||
export interface SecretScanningEntry {
|
||||
provider: string
|
||||
supportedSecret: string
|
||||
secretType: string
|
||||
versions: Record<string, string>
|
||||
isPublic: boolean | string
|
||||
isPrivateWithGhas: boolean | string
|
||||
hasPushProtection: boolean | string
|
||||
hasValidityCheck: boolean | string
|
||||
isduplicate: boolean
|
||||
}
|
||||
|
||||
export default {
|
||||
type: 'array',
|
||||
items: {
|
||||
@@ -12,7 +12,7 @@ import core from '@actions/core'
|
||||
import yaml from 'js-yaml'
|
||||
|
||||
import { getContentAndData, getCommitSha } from '@/workflows/git-utils.js'
|
||||
import schema from '@/secret-scanning/data/public-docs-schema.js'
|
||||
import schema from '@/secret-scanning/data/public-docs-schema'
|
||||
// This is temporarily being imported until the subsequent modules
|
||||
// have beeen converted to TypeScript.
|
||||
import { validateJson } from '@/tests/lib/validate-json-schema.js'
|
||||
|
||||
@@ -3,8 +3,14 @@ import { readFileSync } from 'fs'
|
||||
|
||||
import { get } from '#src/tests/helpers/e2etest.js'
|
||||
|
||||
interface ConfigFile {
|
||||
targetFilename: string
|
||||
}
|
||||
|
||||
describe('secret-scanning pipeline', () => {
|
||||
const { targetFilename } = JSON.parse(readFileSync('src/secret-scanning/lib/config.json'))
|
||||
const { targetFilename } = JSON.parse(
|
||||
readFileSync('src/secret-scanning/lib/config.json', 'utf8'),
|
||||
) as ConfigFile
|
||||
// This test ensures that the configured page exists. If the page moves
|
||||
// this test will fail.
|
||||
test(`check if ${targetFilename} was moved`, async () => {
|
||||
Reference in New Issue
Block a user