Co-authored-by: Robert Sese <734194+rsese@users.noreply.github.com>
This commit is contained in:
docs-bot 2024-04-25 14:26:28 -04:00 коммит произвёл GitHub
Родитель e75537d970
Коммит 9eab87a671
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 22 добавлений и 9 удалений

2
.github/workflows/sync-audit-logs.yml поставляемый
Просмотреть файл

@ -33,7 +33,7 @@ jobs:
# need to use a token from a user with access to github/audit-log-allowlists for this step
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
run: |
src/audit-logs/scripts/sync.js
npm run audit-log-sync
- name: Get the audit-log-allowlists SHA being synced
id: audit-log-allowlists

Просмотреть файл

@ -18,6 +18,7 @@
"scripts": {
"analyze-text": "node src/search/scripts/analyze-text.js",
"archive-version": "node --max-old-space-size=8192 src/ghes-releases/scripts/archive-version.js",
"audit-log-sync": "tsx src/audit-logs/scripts/sync.ts",
"build": "next build",
"check-content-type": "node src/workflows/check-content-type.js",
"check-github-github-links": "node src/links/scripts/check-github-github-links.js",

Просмотреть файл

@ -34,13 +34,13 @@ A [workflow](.github/workflows/sync-audit-logs.yml) is used to trigger the autom
The workflow creates a pull request with audit log event updates and the label `audit-log-pipeline`. If there is no updated audit log data, a pull request is not created.
The workflow runs the `src/audit-logs/scripts/sync.js` script.
The workflow runs the `src/audit-logs/scripts/sync.ts` script.
## Local development
To run the audit log events pipeline locally:
1. Run `src/audit-logs/scripts/sync.js`
1. Run `npm run audit-log-sync`
## About this directory
@ -48,7 +48,7 @@ To run the audit log events pipeline locally:
- `src/audit-logs/lib` - The source code used in production to display the audit log event docs and configuration files edited by content and engineering team members.
- `src/audit-logs/lib/config.json` - A configuration file used to specify metadata about the audit logs pipeline.
- `src/audit-logs/scripts` - The scripts and source code used run the audit logs pipeline, which updates the `src/audit-logs/data` directory.
- `src/audit-logs/scripts/sync.js` - The script that runs the audit-logs pipeline.
- `src/audit-logs/scripts/sync.ts` - The script that runs the audit-logs pipeline.
- `src/audit-logs/tests` - The tests used to verify the audit logs pipeline.
## Content team

Просмотреть файл

@ -15,12 +15,12 @@ import { mkdirp } from 'mkdirp'
import path from 'path'
import { filterByAllowlistValues, filterAndUpdateGhesDataByAllowlistValues } from '../lib/index.js'
import { getContents, getCommitSha } from '#src/workflows/git-utils.js'
import { getContents, getCommitSha } from '@/workflows/git-utils.js'
import {
latest,
latestStable,
releaseCandidate,
} from '#src/versions/lib/enterprise-server-releases.js'
} from '@/versions/lib/enterprise-server-releases.js'
if (!process.env.GITHUB_TOKEN) {
throw new Error('GITHUB_TOKEN environment variable must be set to run this script')
@ -34,6 +34,13 @@ const AUDIT_LOG_PAGES = {
ENTERPRISE: 'enterprise',
}
type AuditLogEventT = {
action: string
description: string
}
type AuditLogdata = Record<string, Array<AuditLogEventT>>
async function main() {
// get latest audit log data
//
@ -75,14 +82,19 @@ async function main() {
// data for every supported GHES version including RC releases. Just to be
// extra careful, we also fallback to the latest stable GHES version if
// there's an RC release in the docs site but no audit log data for that version.
const auditLogData = {}
const auditLogData: Record<string, AuditLogdata> = {}
// Wrapper around filterByAllowlistValues() because we always need all the
// schema events and pipeline config data.
const filter = (allowListValues, currentEvents = []) =>
const filter = (allowListValues: string | string[], currentEvents: AuditLogEventT[] = []) =>
filterByAllowlistValues(schemaEvents, allowListValues, currentEvents, pipelineConfig)
// Wrapper around filterGhesByAllowlistValues() because we always need all the
// schema events and pipeline config data.
const filterAndUpdateGhes = (allowListValues, auditLogPage, currentEvents) =>
const filterAndUpdateGhes = (
allowListValues: string | string[],
auditLogPage: string,
currentEvents: AuditLogdata,
) =>
filterAndUpdateGhesDataByAllowlistValues(
schemaEvents,
allowListValues,