1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Convert secret-scanning JavaScript files to TypeScript (#55734)

This commit is contained in:
Kevin Heis
2025-05-22 13:13:53 -07:00
committed by GitHub
parent ab79adb93a
commit 0fba8c9de7
3 changed files with 22 additions and 3 deletions

View File

@@ -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: {

View File

@@ -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'

View File

@@ -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 () => {