Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/audit-logs/data/fpt/organization.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,27 @@
"action"
]
},
{
"action": "billing.overage_policy_updated",
"description": "The premium request paid usage policy for your GitHub account was changed.",
"docs_reference_links": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage",
"fields": [
"actor",
"actor_id",
"user_agent",
"request_id",
"request_access_security_header",
"business",
"business_id",
"action",
"_document_id",
"@timestamp",
"created_at",
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage"
},
{
"action": "billing.unlock",
"description": "N/A",
Expand Down Expand Up @@ -1387,7 +1408,7 @@
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "GitHub Copilot billing"
"docs_reference_titles": "GitHub Copilot licenses"
},
{
"action": "copilot.plan_downgrade_scheduled",
Expand Down
21 changes: 21 additions & 0 deletions src/audit-logs/data/fpt/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,27 @@
"action"
]
},
{
"action": "billing.overage_policy_updated",
"description": "The premium request paid usage policy for your GitHub account was changed.",
"docs_reference_links": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage",
"fields": [
"actor",
"actor_id",
"user_agent",
"request_id",
"request_access_security_header",
"business",
"business_id",
"action",
"_document_id",
"@timestamp",
"created_at",
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage"
},
{
"action": "billing.unlock",
"description": "N/A",
Expand Down
23 changes: 22 additions & 1 deletion src/audit-logs/data/ghec/enterprise.json
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,27 @@
"action"
]
},
{
"action": "billing.overage_policy_updated",
"description": "The premium request paid usage policy for your GitHub account was changed.",
"docs_reference_links": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage",
"fields": [
"actor",
"actor_id",
"user_agent",
"request_id",
"request_access_security_header",
"business",
"business_id",
"action",
"_document_id",
"@timestamp",
"created_at",
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage"
},
{
"action": "billing.unlock",
"description": "N/A",
Expand Down Expand Up @@ -4319,7 +4340,7 @@
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "GitHub Copilot billing"
"docs_reference_titles": "GitHub Copilot licenses"
},
{
"action": "copilot.plan_downgrade_scheduled",
Expand Down
23 changes: 22 additions & 1 deletion src/audit-logs/data/ghec/organization.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,27 @@
"action"
]
},
{
"action": "billing.overage_policy_updated",
"description": "The premium request paid usage policy for your GitHub account was changed.",
"docs_reference_links": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage",
"fields": [
"actor",
"actor_id",
"user_agent",
"request_id",
"request_access_security_header",
"business",
"business_id",
"action",
"_document_id",
"@timestamp",
"created_at",
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage"
},
{
"action": "billing.unlock",
"description": "N/A",
Expand Down Expand Up @@ -1387,7 +1408,7 @@
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "GitHub Copilot billing"
"docs_reference_titles": "GitHub Copilot licenses"
},
{
"action": "copilot.plan_downgrade_scheduled",
Expand Down
21 changes: 21 additions & 0 deletions src/audit-logs/data/ghec/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,27 @@
"action"
]
},
{
"action": "billing.overage_policy_updated",
"description": "The premium request paid usage policy for your GitHub account was changed.",
"docs_reference_links": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage",
"fields": [
"actor",
"actor_id",
"user_agent",
"request_id",
"request_access_security_header",
"business",
"business_id",
"action",
"_document_id",
"@timestamp",
"created_at",
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage"
},
{
"action": "billing.unlock",
"description": "N/A",
Expand Down
2 changes: 1 addition & 1 deletion src/audit-logs/data/ghes-3.14/organization.json
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "GitHub Copilot billing"
"docs_reference_titles": "GitHub Copilot licenses"
},
{
"action": "custom_hosted_runner.create",
Expand Down
2 changes: 1 addition & 1 deletion src/audit-logs/data/ghes-3.15/organization.json
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "GitHub Copilot billing"
"docs_reference_titles": "GitHub Copilot licenses"
},
{
"action": "copilot.plan_downgrade_scheduled",
Expand Down
2 changes: 1 addition & 1 deletion src/audit-logs/data/ghes-3.16/organization.json
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "GitHub Copilot billing"
"docs_reference_titles": "GitHub Copilot licenses"
},
{
"action": "copilot.plan_downgrade_scheduled",
Expand Down
2 changes: 1 addition & 1 deletion src/audit-logs/data/ghes-3.17/organization.json
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "GitHub Copilot billing"
"docs_reference_titles": "GitHub Copilot licenses"
},
{
"action": "copilot.plan_downgrade_scheduled",
Expand Down
2 changes: 1 addition & 1 deletion src/audit-logs/data/ghes-3.19/organization.json
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@
"operation_type",
"actor_is_bot"
],
"docs_reference_titles": "GitHub Copilot billing"
"docs_reference_titles": "GitHub Copilot licenses"
},
{
"action": "copilot.plan_downgrade_scheduled",
Expand Down
2 changes: 1 addition & 1 deletion src/audit-logs/lib/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"git": "Note: Git events have special access requirements and retention policies that differ from other audit log events. For GitHub Enterprise Cloud, access Git events via the REST API only with 7-day retention. For GitHub Enterprise Server, Git events must be enabled in audit log configuration and are not included in search results.",
"sso_redirect": "Note: Automatically redirecting users to sign in is currently in beta for Enterprise Managed Users and subject to change."
},
"sha": "ff2be4f24eaeb83e0d054bcf1f2d36c5f8add0af"
"sha": "73af758b3ef22814e29e064415327dc0840f5ec8"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import fs from 'fs'
import { spawn } from 'child_process'

const rule = process.argv[2]
const rule: string | undefined = process.argv[2]
if (!rule) {
console.error('Please specify a rule to disable.')
process.exit(1)
Expand Down Expand Up @@ -38,36 +38,40 @@ const childProcess = spawn('npm', [
rule,
])

childProcess.stdout.on('data', (data) => {
childProcess.stdout.on('data', (data: Buffer) => {
if (verbose) console.log(data.toString())
})

childProcess.stderr.on('data', function (data) {
childProcess.stderr.on('data', function (data: Buffer) {
if (verbose) console.log(data.toString())
})

let matchingRulesFound = 0
childProcess.on('close', (code) => {
childProcess.on('close', (code: number | null) => {
if (code === 0) {
console.log(`No violations for rule, "${rule}" found.`)
process.exit(0)
}

const markdownViolations = JSON.parse(fs.readFileSync('markdown-violations.json', 'utf8'))
const markdownViolations: Record<string, Array<{ lineNumber: number }>> = JSON.parse(
fs.readFileSync('markdown-violations.json', 'utf8'),
)
console.log(`${Object.values(markdownViolations).flat().length} violations found.`)

Object.entries(markdownViolations).forEach(([fileName, results]) => {
console.log(fileName)
console.log(results)
const fileLines = fs.readFileSync(fileName, 'utf8').split('\n')
results.forEach((result) => {
matchingRulesFound++
const lineIndex = result.lineNumber - 1
const offendingLine = fileLines[lineIndex]
fileLines[lineIndex] = offendingLine.concat(` <!-- markdownlint-disable-line ${rule} -->`)
})
fs.writeFileSync(fileName, fileLines.join('\n'), 'utf8')
})
Object.entries(markdownViolations).forEach(
([fileName, results]: [string, Array<{ lineNumber: number }>]) => {
console.log(fileName)
console.log(results)
const fileLines = fs.readFileSync(fileName, 'utf8').split('\n')
results.forEach((result) => {
matchingRulesFound++
const lineIndex = result.lineNumber - 1
const offendingLine = fileLines[lineIndex]
fileLines[lineIndex] = offendingLine.concat(` <!-- markdownlint-disable-line ${rule} -->`)
})
fs.writeFileSync(fileName, fileLines.join('\n'), 'utf8')
},
)

console.log(`${matchingRulesFound} violations ignored.`)
})
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from 'path'
import { afterAll, beforeAll, describe, expect, test } from 'vitest'

import { runRule } from '../../lib/init-test'
import type { Rule } from '@/content-linter/types'
import {
liquidDataReferencesDefined,
liquidDataTagFormat,
Expand Down Expand Up @@ -31,7 +32,7 @@ describe(liquidDataReferencesDefined.names.join(' - '), () => {
'{% data ui.nested.nested.not-there %}',
'{% data some.random.path %}',
]
const result = await runRule(liquidDataReferencesDefined, {
const result = await runRule(liquidDataReferencesDefined as Rule, {
strings: { markdown: markdown.join('\n') },
})
const errors = result.markdown
Expand All @@ -45,7 +46,7 @@ describe(liquidDataReferencesDefined.names.join(' - '), () => {
'{% data variables.location.product_location %}',
'{% data ui.header.notices.release_candidate %}',
].join('\n')
const result = await runRule(liquidDataReferencesDefined, { strings: { markdown } })
const result = await runRule(liquidDataReferencesDefined as Rule, { strings: { markdown } })
const errors = result.markdown
expect(errors.length).toBe(0)
})
Expand All @@ -57,7 +58,7 @@ describe(liquidDataReferencesDefined.names.join(' - '), () => {
'{% data %}',
'{% indented_data_reference %}',
]
const result = await runRule(liquidDataTagFormat, {
const result = await runRule(liquidDataTagFormat as Rule, {
strings: { markdown: markdown.join('\n') },
})
const errors = result.markdown
Expand All @@ -69,7 +70,7 @@ describe(liquidDataReferencesDefined.names.join(' - '), () => {
'{% data ui.header.notices.release_candidate %}',
'{% indented_data_reference ui.header.notices.release_candidate spaces=3 %}',
]
const result = await runRule(liquidDataTagFormat, {
const result = await runRule(liquidDataTagFormat as Rule, {
strings: { markdown: markdown.join('\n') },
})
const errors = result.markdown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { execSync } from 'child_process'

import { renderLiquid } from '@/content-render/liquid/index'
import shortVersionsMiddleware from '@/versions/middleware/short-versions'
import type { ExtendedRequest } from '@/types'

const { loadPages } = await import('@/frame/lib/page-data.js')
const { allVersions } = await import('@/versions/lib/all-versions.js')
Expand Down Expand Up @@ -32,20 +33,20 @@ for (const page of pages) {
console.log(`---\nStart: Creating directories for: ${page.relativePath}`)
const dirnames = page.relativePath.substring(0, page.relativePath.lastIndexOf('/'))

fs.mkdirSync(`${contentCopilotDir}/${dirnames}`, { recursive: true }, (err) => {
if (err) throw err
})
fs.mkdirSync(`${contentCopilotDir}/${dirnames}`, { recursive: true })
// Context needed to render the content liquid
const req = { language: 'en' }
const contextualize = (req) => {
req.context.currentVersionObj = req.context.allVersions[req.context.currentVersion]
const req = { language: 'en' } as ExtendedRequest
const contextualize = (req: ExtendedRequest): void => {
if (!req.context) return
if (!req.context.currentVersion) return
req.context.currentVersionObj = req.context.allVersions?.[req.context.currentVersion]
shortVersionsMiddleware(req, null, () => {})
}

req.context = {
currentLanguage: 'en',
currentVersion: 'free-pro-team@latest',
page: {},
page: {} as any, // Empty page object used only for context initialization
allVersions,
}
contextualize(req)
Expand Down Expand Up @@ -77,7 +78,8 @@ for (const page of pages) {
'utf8',
)
console.log(`Done: written file\n---`)
} catch (err) {
} catch (err: any) {
// Standard catch-all for error handling in scripts
console.log(err)
}
}
Expand Down
Loading
Loading