Skip to content

Commit

Permalink
Merge branch 'main' into issue/5848
Browse files Browse the repository at this point in the history
  • Loading branch information
mchammer01 authored Jul 15, 2021
2 parents 204ce61 + 1a9af0c commit 274e499
Show file tree
Hide file tree
Showing 2,581 changed files with 362,932 additions and 71,443 deletions.
17 changes: 0 additions & 17 deletions .devcontainer.json

This file was deleted.

16 changes: 16 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/javascript-node/.devcontainer/base.Dockerfile

# [Choice] Node.js version: 16, 14, 12
ARG VARIANT="16-buster"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"

# [Optional] Uncomment if you want to install more global node modules
# RUN su node -c "npm install -g <your-package-list-here>"
35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// 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: 12, 14, 16
"args": { "VARIANT": "16" }
},

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

// 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",
"yzhang.markdown-all-in-one",
"streetsidesoftware.code-spell-checker"
],

// 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 && npm run build",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
39 changes: 16 additions & 23 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,40 @@ module.exports = {
browser: true,
commonjs: true,
es2020: true,
node: true
node: true,
},
parser: '@babel/eslint-parser',
extends: [
'eslint:recommended',
'standard',
'prettier'
],
extends: ['eslint:recommended', 'standard', 'prettier'],
parserOptions: {
ecmaVersion: 11
ecmaVersion: 11,
requireConfigFile: 'false',
babelOptions: { configFile: './.babelrc' },
},
rules: {
'import/no-extraneous-dependencies': ['error']
'import/no-extraneous-dependencies': ['error', { packageDir: '.' }],
'node/global-require': ['error'],
'import/no-dynamic-require': ['error'],
},
overrides: [
{
files: [
'**/tests/**/*.js'
],
files: ['**/tests/**/*.js'],
env: {
jest: true
}
jest: true,
},
},
{
files: [
'**/*.tsx', '**/*.ts'
],
plugins: [
'@typescript-eslint',
'jsx-a11y'
],
files: ['**/*.tsx', '**/*.ts'],
plugins: ['@typescript-eslint', 'jsx-a11y'],
extends: ['plugin:jsx-a11y/recommended'],
parser: '@typescript-eslint/parser',
rules: {
'camelcase': 'off',
camelcase: 'off',
'no-unused-vars': 'off',
'no-undef': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
'jsx-a11y/no-onchange': 'off',
}
},
},
]
],
}
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/improve-existing-docs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Improve existing docs
about: Make a suggestion to improve our existing documentation.
name: Improve existing content
about: Make a suggestion to improve the content in an existing article.
title: ''
labels:
- content
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/improve-the-site.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Improve the docs.github.com site
about: Make a suggestions or report a problem on the docs.github.com website.
about: Make a suggestion or report a problem about the technical implementation of docs.github.com.
title: ''
labels: engineering
assignees: ''
Expand Down
39 changes: 22 additions & 17 deletions .github/actions-scripts/check-for-enterprise-issues-by-label.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
#!/usr/bin/env node

const github = require('@actions/github')
const core = require('@actions/core')
import { getOctokit } from '@actions/github'
import { setOutput } from '@actions/core'

async function run () {
async function run() {
const token = process.env.GITHUB_TOKEN
const octokit = github.getOctokit(token)
const octokit = getOctokit(token)
const query = encodeURIComponent('is:open repo:github/docs-internal is:issue')

const deprecationIssues = await octokit.request(`GET /search/issues?q=${query}+label:"enterprise%20deprecation"`)
const releaseIssues = await octokit.request(`GET /search/issues?q=${query}+label:"enterprise%20release"`)

const deprecationIssues = await octokit.request(
`GET /search/issues?q=${query}+label:"enterprise%20deprecation"`
)
const releaseIssues = await octokit.request(
`GET /search/issues?q=${query}+label:"enterprise%20release"`
)
const isDeprecationIssue = deprecationIssues.data.items.length === 0 ? 'false' : 'true'
const isReleaseIssue = releaseIssues.data.items.length === 0 ? 'false' : 'true'
core.setOutput('deprecationIssue', isDeprecationIssue)
core.setOutput('releaseIssue', isReleaseIssue)
setOutput('deprecationIssue', isDeprecationIssue)
setOutput('releaseIssue', isReleaseIssue)
return `Set outputs deprecationIssue: ${isDeprecationIssue}, releaseIssue: ${isReleaseIssue}`
}

run()
.then(
(response) => { console.log(`Finished running: ${response}`) },
(error) => {
console.log(`#ERROR# ${error}`)
process.exit(1)
}
)
run().then(
(response) => {
console.log(`Finished running: ${response}`)
},
(error) => {
console.log(`#ERROR# ${error}`)
process.exit(1)
}
)
94 changes: 52 additions & 42 deletions .github/actions-scripts/create-enterprise-issue.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env node

const fs = require('fs')
const path = require('path')
const github = require('@actions/github')
const enterpriseDates = require('../../lib/enterprise-dates')
const { latest, oldestSupported } = require('../../lib/enterprise-server-releases')
import fs from 'fs'
import path from 'path'
import { getOctokit } from '@actions/github'
import enterpriseDates from '../../lib/enterprise-dates.js'
import { latest, oldestSupported } from '../../lib/enterprise-server-releases.js'

const acceptedMilestones = ['release', 'deprecation']
const teamsToCC = '/cc @github/docs-content @github/docs-engineering'

Expand All @@ -19,47 +20,46 @@ const numberOfdaysBeforeDeprecationToOpenIssue = 15
// number of days.
//
// When a milestone is within the specified number of days, a new issue is
// created using the templates in
// .github/actions-scripts/enterprise-server-issue-templates.
// created using the templates in
// .github/actions-scripts/enterprise-server-issue-templates.
//
// Release issues are then added to the docs content squad board for triage.
// Deprecations issues are owned by docs engineering and are added to the
// Deprecations issues are owned by docs engineering and are added to the
// docs engineering squad board automatically when the engineering label is added.
//
// [end-readme]

run()

async function run () {


async function run() {
const milestone = process.argv[2]
if (!acceptedMilestones.includes(milestone)) {
console.log('Please specify either \'release\' or \'deprecation\'\n')
console.log("Please specify either 'release' or 'deprecation'\n")
console.log('Example: script/open-enterprise-issue.js release')
process.exit(1)
}

const repoToOpenIssue = milestone === 'release' ? 'docs-content' : 'docs-engineering'

// Milestone-dependent values.
const numberOfdaysBeforeMilestoneToOpenIssue = milestone === 'release'
? numberOfdaysBeforeReleaseToOpenIssue
: numberOfdaysBeforeDeprecationToOpenIssue
const numberOfdaysBeforeMilestoneToOpenIssue =
milestone === 'release'
? numberOfdaysBeforeReleaseToOpenIssue
: numberOfdaysBeforeDeprecationToOpenIssue

const versionNumber = milestone === 'release'
? getNextVersionNumber()
: oldestSupported
const versionNumber = milestone === 'release' ? getNextVersionNumber() : oldestSupported

if (!versionNumber) {
console.log(`Could not find the next version number after ${latest} in enterprise-dates.json. Try running script/udpate-enterprise-dates.js, then rerun this script.`)
console.log(
`Could not find the next version number after ${latest} in enterprise-dates.json. Try running script/udpate-enterprise-dates.js, then rerun this script.`
)
process.exit(0)
}

const datesForVersion = enterpriseDates[versionNumber]

if (!datesForVersion) {
console.log(`Could not find ${versionNumber} in enterprise-dates.json. Try running script/udpate-enterprise-dates.js, then rerun this script.`)
console.log(
`Could not find ${versionNumber} in enterprise-dates.json. Try running script/udpate-enterprise-dates.js, then rerun this script.`
)
process.exit(0)
}

Expand All @@ -68,12 +68,20 @@ async function run () {

// If the milestone is more than the specific days away, exit now.
if (daysUntilMilestone > numberOfdaysBeforeMilestoneToOpenIssue) {
console.log(`The ${versionNumber} ${milestone} is not until ${nextMilestoneDate}! An issue will be opened when it is ${numberOfdaysBeforeMilestoneToOpenIssue} days away.`)
console.log(
`The ${versionNumber} ${milestone} is not until ${nextMilestoneDate}! An issue will be opened when it is ${numberOfdaysBeforeMilestoneToOpenIssue} days away.`
)
process.exit(0)
}

const milestoneSteps = fs.readFileSync(path.join(process.cwd(), `.github/actions-scripts/enterprise-server-issue-templates/${milestone}-issue.md`), 'utf8')
const issueLabels = [`enterprise ${milestone}`]
const milestoneSteps = fs.readFileSync(
path.join(
process.cwd(),
`.github/actions-scripts/enterprise-server-issue-templates/${milestone}-issue.md`
),
'utf8'
)
const issueLabels = [`enterprise ${milestone}`, `engineering`]
const issueTitle = `[${nextMilestoneDate}] Enterprise Server ${versionNumber} ${milestone} (technical steps)`

const issueBody = `GHES ${versionNumber} ${milestone} occurs on ${nextMilestoneDate}.
Expand All @@ -83,68 +91,70 @@ async function run () {
const token = process.env.GITHUB_TOKEN

// Create the milestone issue
const octokit = github.getOctokit(token)
const octokit = getOctokit(token)
try {
issue = await octokit.request('POST /repos/{owner}/{repo}/issues', {
owner: 'github',
repo: repoToOpenIssue,
repo: 'docs-internal',
title: issueTitle,
body: issueBody,
labels: issueLabels
labels: issueLabels,
})
if (issue.status === 201) {
// Write the values to disk for use in the workflow.
console.log(`Issue #${issue.data.number} for the ${versionNumber} ${milestone} was opened: ${issue.data.html_url}`)
console.log(
`Issue #${issue.data.number} for the ${versionNumber} ${milestone} was opened: ${issue.data.html_url}`
)
}
} catch (error) {
console.error(`#ERROR# ${error}`)
console.log(`🛑 There was an error creating the issue.`)
process.exit(1)
}

// Add the release issue to the 'Needs triage' column on the
// Add the release issue to the 'Needs triage' column on the
// docs content squad project board:
// https://github.com/orgs/github/projects/1773#column-12198119
// Deprecation issues are owned by docs engineering only and will
// be triaged by adding the engineering label to the issue.
if (milestone === 'release') {
try {
const addCard = await octokit.request('POST /projects/columns/{column_id}/cards', {
column_id: 12198119,
column_id: 12198119,
content_id: issue.data.id,
content_type: 'Issue',
mediaType: {
previews: [
'inertia'
]
}
previews: ['inertia'],
},
})

if (addCard.status === 201) {
// Write the values to disk for use in the workflow.
console.log(`The issue #${issue.data.number} was added to https://github.com/orgs/github/projects/1773#column-12198119.`)
}
} catch(error) {
console.log(
`The issue #${issue.data.number} was added to https://github.com/orgs/github/projects/1773#column-12198119.`
)
}
} catch (error) {
console.error(`#ERROR# ${error}`)
console.log(`🛑 There was an error adding the issue to the project board.`)
process.exit(1)
}
}
}

function getNextVersionNumber () {
function getNextVersionNumber() {
const indexOfLatest = Object.keys(enterpriseDates).indexOf(latest)
const indexOfNext = indexOfLatest + 1
return Object.keys(enterpriseDates)[indexOfNext]
}

function calculateDaysUntilMilestone (nextMilestoneDate) {
function calculateDaysUntilMilestone(nextMilestoneDate) {
const today = new Date().toISOString().slice(0, 10)
const differenceInMilliseconds = getTime(nextMilestoneDate) - getTime(today)
// Return the difference in days
return Math.floor((differenceInMilliseconds) / (1000 * 60 * 60 * 24))
return Math.floor(differenceInMilliseconds / (1000 * 60 * 60 * 24))
}

function getTime (date) {
function getTime(date) {
return new Date(date).getTime()
}
Loading

0 comments on commit 274e499

Please sign in to comment.