Skip to content

Commit

Permalink
Merge branch 'github:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurry-gee authored Sep 20, 2023
2 parents 1293b55 + 3899ef0 commit 69299a2
Show file tree
Hide file tree
Showing 1,786 changed files with 570,818 additions and 331,685 deletions.
89 changes: 48 additions & 41 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,58 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/javascript-node
// -
{
"name": "docs.github.com",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version
"args": { "VARIANT": "18" }
},
"name": "docs.github.com",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version
"args": { "VARIANT": "18" }
},

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"cSpell.language": ",en"
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"cSpell.language": ",en"
},

// Install features. Type 'feature' in the VS Code command palette for a full list.
"features": {
"sshd": "latest"
},
// Install features. Type 'feature' in the VS Code command palette for a full list.
"features": {
"sshd": "latest"
},

// Visual Studio Code extensions which help authoring for docs.github.com.
"extensions": [
"dbaeumer.vscode-eslint",
"sissel.shopify-liquid",
"davidanson.vscode-markdownlint",
"bierner.markdown-preview-github-styles",
"streetsidesoftware.code-spell-checker",
"alistairchristie.open-reusables"
],
"customizations": {
"vscode": {
"settings": {},
// Visual Studio Code extensions which help authoring for docs.github.com.
"extensions": [
"dbaeumer.vscode-eslint",
"sissel.shopify-liquid",
"davidanson.vscode-markdownlint",
"bierner.markdown-preview-github-styles",
"streetsidesoftware.code-spell-checker",
"alistairchristie.open-reusables",
"GitHub.copilot",
"GitHub.copilot-chat"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [4000],

"portsAttributes": {
"4000": {
"label": "Preview",
"onAutoForward": "openPreview"
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [4000],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm ci",
"portsAttributes": {
"4000": {
"label": "Preview",
"onAutoForward": "openPreview"
}
},

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
,
"hostRequirements": {
"memory": "8gb"
}
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm ci",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node",

"hostRequirements": {
"memory": "8gb"
}
}
9 changes: 7 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ module.exports = {
"!/.*",
"/.next/",
"script/bookmarklets/*",
"src/open-source/scripts/add-pr-links.js",
"src/open-source/scripts/pr-link-source.js",
"rest-api-description/",
],
rules: {
Expand All @@ -35,8 +37,11 @@ module.exports = {
},
{
files: ["**/*.tsx", "**/*.ts"],
plugins: ["@typescript-eslint", "jsx-a11y"],
extends: ["plugin:jsx-a11y/recommended"],
plugins: ["@typescript-eslint", "primer-react", "jsx-a11y"],
extends: [
"plugin:primer-react/recommended",
"plugin:jsx-a11y/recommended",
],
parser: "@typescript-eslint/parser",
rules: {
camelcase: "off",
Expand Down
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

# Enterprise
/data/release-notes/**/*.yml @github/docs-content-enterprise
src/ghes-releases/lib/enterprise-dates.json @github/docs-content-enterprise

# Requires review of #actions-oidc-integration, docs-engineering/issues/1506
content/actions/deployment/security-hardening-your-deployments/** @github/oidc

# Temporary, so @lecoursen can copy any changes to the audit log reference
# to the JSON file that will soon be used to auto-generate this content
/content/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise.md @lecoursen
/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/audit-log-events-for-your-organization.md @lecoursen
/content/authentication/keeping-your-account-and-data-secure/security-log-events.md @lecoursen
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/improve-existing-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ body:
description: |
- Give as much detail as you can to help us understand the change you want to see.
- Why should the docs be changed? What use cases does it support?
- What is the expected outcome?
- What is the expected outcome or behavior?
validations:
required: true

- type: textarea
attributes:
label: Additional information
description: Add any other context or screenshots about the feature request here.
description: |
- Are you able to reliably reproduce the problem? How often does it occur? How many users are affected?
- Add any other context or screenshots about the feature here.
validations:
required: false
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ body:
attributes:
value: |
Once all tasks are completed, please mention `@github/docs-content` for next steps.
/cc @github/partner-engineering for :eyes:.
/cc @github/technology-partnerships-and-engineering for :eyes:.
6 changes: 3 additions & 3 deletions .github/actions-scripts/content-changes-table-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import core from '@actions/core'

import { getContents } from '../../script/helpers/git-utils.js'
import parse from '../../lib/read-frontmatter.js'
import getApplicableVersions from '../../lib/get-applicable-versions.js'
import nonEnterpriseDefaultVersion from '../../lib/non-enterprise-default-version.js'
import { allVersionShortnames } from '../../lib/all-versions.js'
import getApplicableVersions from '#src/versions/lib/get-applicable-versions.js'
import nonEnterpriseDefaultVersion from '#src/versions/lib/non-enterprise-default-version.js'
import { allVersionShortnames } from '#src/versions/lib/all-versions.js'
import { waitUntilUrlIsHealthy } from './lib/wait-until-url-is-healthy.js'

const { GITHUB_TOKEN, APP_URL } = process.env
Expand Down
125 changes: 125 additions & 0 deletions .github/actions-scripts/lib/issue-report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
export async function createReportIssue({
core,
octokit,
reportTitle,
reportBody,
reportRepository,
reportLabel,
}) {
const [owner, repo] = reportRepository.split('/')
// Create issue
let newReport
try {
const { data } = await octokit.request('POST /repos/{owner}/{repo}/issues', {
owner,
repo,
title: reportTitle,
body: reportBody,
labels: [reportLabel],
})
newReport = data
core.info(`Created new report issue at ${newReport.html_url}\n`)
} catch (error) {
core.error(error)
core.setFailed('Error creating new issue')
throw error
}

return newReport
}

export async function linkReports({
core,
octokit,
newReport,
reportRepository,
reportAuthor,
reportLabel,
}) {
const [owner, repo] = reportRepository.split('/')

core.info('Attempting to link reports...')
// Find previous report issue
let previousReports
try {
previousReports = await octokit.rest.issues.listForRepo({
owner,
repo,
creator: reportAuthor,
labels: reportLabel,
state: 'all', // We want to get the previous report, even if it is closed
sort: 'created',
direction: 'desc',
per_page: 25,
})
previousReports = previousReports.data
} catch (error) {
core.setFailed('Error listing issues for repo')
throw error
}
core.info(`Found ${previousReports.length} previous reports`)

if (previousReports.length <= 1) {
core.info('No previous reports to link to')
return
}

// 2nd report should be most recent previous report
const previousReport = previousReports[1]

// Comment the old report link on the new report
try {
await octokit.rest.issues.createComment({
owner,
repo,
issue_number: newReport.number,
body: `⬅️ [Previous report](${previousReport.html_url})`,
})
core.info(`Linked old report to new report via comment on new report, #${newReport.number}`)
} catch (error) {
core.setFailed(`Error commenting on newReport, #${newReport.number}`)
throw error
}

// Comment on all previous reports that are still open
for (const previousReport of previousReports) {
if (previousReport.state === 'closed' || previousReport.html_url === newReport.html_url) {
continue
}

// If an old report is not assigned to someone we close it
const shouldClose = !previousReport.assignees.length
let body = `➡️ [Newer report](${newReport.html_url})`
if (shouldClose) {
body += '\n\nClosing in favor of newer report since there are no assignees on this issue'
}
try {
await octokit.rest.issues.createComment({
owner,
repo,
issue_number: previousReport.number,
body,
})
core.info(
`Linked old report to new report via comment on old report: #${previousReport.number}.`,
)
} catch (error) {
core.setFailed(`Error commenting on previousReport, #${previousReport.number}`)
throw error
}
if (shouldClose) {
try {
await octokit.rest.issues.update({
owner,
repo,
issue_number: previousReport.number,
state: 'closed',
})
core.info(`Closing old report: #${previousReport.number} because it doesn't have assignees`)
} catch (error) {
core.setFailed(`Error closing previousReport, #${previousReport.number}`)
throw error
}
}
}
}
75 changes: 75 additions & 0 deletions .github/actions-scripts/post-lints.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env node

import { program } from 'commander'
import fs from 'fs'
import coreLib from '@actions/core'

import github from '../../script/helpers/github.js'
import { getEnvInputs } from './lib/get-env-inputs.js'
import { createReportIssue, linkReports } from './lib/issue-report.js'

// [start-readme]
//
// This script runs once a week via a scheduled GitHub Action to lint
// the entire content and data directories based on our
// markdownlint.js rules.
//
// If errors are found, it will open up a new issue in the
// docs-content repo with the label "broken content markdown report".
//
// The Content FR will go through the issue and update the content and
// data files accordingly.
//
// [end-readme]

program
.description('Opens an issue for Content FR with the errors from the weekly content/data linter.')
.option(
'-p, --path <path>',
'provide a path to the errors output json file that will be in the issue body',
)
.parse(process.argv)

const { path } = program.opts()

main()
async function main() {
const errors = fs.readFileSync(`${path}`, 'utf8')
const core = coreLib
const { REPORT_REPOSITORY, REPORT_AUTHOR, REPORT_LABEL } = process.env

const octokit = github()
// `GITHUB_TOKEN` is optional. If you need the token to post a comment
// or open an issue report, you might get cryptic error messages from Octokit.
getEnvInputs(['GITHUB_TOKEN'])

core.info(`Creating issue for errors...`)

let reportBody = 'The following files have markdown lint warnings/errors:\n\n'
for (const [file, flaws] of Object.entries(JSON.parse(errors))) {
reportBody += `File: \`${file}\`:\n`
reportBody += `\`\`\`json\n${JSON.stringify(flaws, null, 2)}\n\`\`\`\n`
}

const reportProps = {
core,
octokit,
reportTitle: `Error(s) in content markdown file(s)`,
reportBody,
reportRepository: REPORT_REPOSITORY,
reportLabel: REPORT_LABEL,
}

await createReportIssue(reportProps)

const linkProps = {
core,
octokit,
newReport: await createReportIssue(reportProps),
reportRepository: REPORT_REPOSITORY,
reportAuthor: REPORT_AUTHOR,
reportLabel: REPORT_LABEL,
}

await linkReports(linkProps)
}
2 changes: 2 additions & 0 deletions .github/actions-scripts/purge-old-deployment-environments.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ async function main() {
repo,
})

console.log(`Found ${environments.length.toLocaleString()} environments in total`)

let countDeletions = 0
for (const environment of environments) {
const ageDays = (Date.now() - Date.parse(environment.created_at)) / 1000 / 60 / 60 / 24
Expand Down
Loading

0 comments on commit 69299a2

Please sign in to comment.