зеркало из https://github.com/github/docs.git
Коммит
4f8124b201
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
name: Change production configuration
|
||||
about: Track changes to the production docs.github.com site
|
||||
title: ''
|
||||
labels: engineering
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
A configuration change would be something outside of our code that we change with our production environment, such as environment variables, virtual machine tier or quantity, or service providers.
|
||||
|
||||
- _Primary person_:
|
||||
- _Second person_:
|
||||
- _When_:
|
||||
- _Zoom URL_:
|
||||
|
||||
### What is the configuration change?
|
||||
|
||||
### Why are we updating this configuration?
|
||||
|
||||
### What risks are there with this configuration change?
|
||||
|
||||
### If an issue happens, how do we roll back?
|
||||
|
||||
Once the change is verified good, please close this issue.
|
|
@ -21,6 +21,8 @@ jobs:
|
|||
steps:
|
||||
- id: membership_check
|
||||
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
|
||||
env:
|
||||
TEAM_CONTENT_REPO: ${{ secrets.TEAM_CONTENT_REPO }}
|
||||
with:
|
||||
github-token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
|
||||
script: |
|
||||
|
@ -59,7 +61,7 @@ jobs:
|
|||
// Create an issue in our private repo
|
||||
await github.issues.create({
|
||||
owner: 'github',
|
||||
repo: 'docs-internal',
|
||||
repo: process.env.TEAM_CONTENT_REPO,
|
||||
title: `@${context.payload.sender.login} confirm that \#${issueNo} should be in the public github/docs repo`,
|
||||
body: `@${context.payload.sender.login} opened https://github.com/github/docs/issues/${issueNo} publicly in the github/docs repo, instead of the private github/docs-internal repo.\n\n@${context.payload.sender.login}, please confirm that this belongs in the public repo and that no sensitive information was disclosed by commenting below and closing the issue.\n\nIf this was not intentional and sensitive information was shared, please delete https://github.com/github/docs/issues/${issueNo} and notify us in the \#docs-open-source channel.\n\nThanks!`,
|
||||
labels: ['OS confirmation'],
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
name: Move existing issues to correct docs repo
|
||||
|
||||
# **What it does**: Move all existing issues to the correct repo
|
||||
# **Why we have it**: We don't want engineering or content issues in the docs-internal repo
|
||||
# **Who does it impact**: GitHub staff.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
transfer_issues:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- id: move_to_correct_repo
|
||||
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
|
||||
env:
|
||||
TEAM_ENGINEERING_REPO: ${{ secrets.TEAM_ENGINEERING_REPO }}
|
||||
TEAM_CONTENT_REPO: ${{ secrets.TEAM_CONTENT_REPO }}
|
||||
with:
|
||||
github-token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
|
||||
script: |
|
||||
const owner = 'github'
|
||||
const originalRepo = 'docs-internal'
|
||||
correctRepo = process.env.TEAM_ENGINEERING_REPO
|
||||
|
||||
let correctRepo;
|
||||
const correctRepoObject = await github.repos.get({
|
||||
owner: owner,
|
||||
repo: correctRepo
|
||||
})
|
||||
|
||||
const allIssues = await github.paginate(github.issues.listForRepo, {
|
||||
owner: owner,
|
||||
repo: originalRepo,
|
||||
per_page: 100,
|
||||
labels: ['engineering']
|
||||
})
|
||||
|
||||
for (const issue of allIssues) {
|
||||
// Extra redundancy with this additional check to be safe
|
||||
if (issue.labels.find(label => label.name === 'engineering')) {
|
||||
// Transfer the issue to the correct repo
|
||||
const issueNodeId = issue.node_id
|
||||
const correctRepositoryNodeId = correctRepoObject.data.node_id
|
||||
console.log(`Issue GraphQL Node ID: ${issueNodeId}`)
|
||||
console.log(`Repository GraphQL Node ID: ${correctRepositoryNodeId}`)
|
||||
|
||||
const mutation = `mutation ($id: ID!, $repositoryId: ID!) {
|
||||
transferIssue(input: {
|
||||
issueId: $id,
|
||||
repositoryId: $repositoryId
|
||||
}) {
|
||||
issue {
|
||||
url,
|
||||
number
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
const variables = {
|
||||
id: issueNodeId,
|
||||
repositoryId: correctRepositoryNodeId
|
||||
}
|
||||
|
||||
const graph = await github.graphql(mutation, variables)
|
||||
console.log('GraphQL mutation result:\n' + JSON.stringify(graph))
|
||||
|
||||
// Add the same labels to the new issue
|
||||
const newIssueNumber = graph.transferIssue.issue.number
|
||||
await github.issues.addLabels({
|
||||
owner: owner,
|
||||
repo: correctRepo,
|
||||
issue_number: newIssueNumber,
|
||||
labels: issue.labels.map(label => label.name),
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
name: Move new issues to correct docs repo
|
||||
|
||||
# **What it does**: If anyone creates an issue in the docs-internal repo for the engineering team or the content team, move that issue and notify the author
|
||||
# **Why we have it**: We don't want engineering or content issues in the docs-internal repo
|
||||
# **Who does it impact**: GitHub staff.
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
- transferred
|
||||
|
||||
jobs:
|
||||
transfer_issue:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
if: github.repository == 'github/docs-internal'
|
||||
steps:
|
||||
- id: move_to_correct_repo
|
||||
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
|
||||
env:
|
||||
TEAM_ENGINEERING_REPO: ${{ secrets.TEAM_ENGINEERING_REPO }}
|
||||
TEAM_CONTENT_REPO: ${{ secrets.TEAM_CONTENT_REPO }}
|
||||
with:
|
||||
github-token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
|
||||
script: |
|
||||
const issueNo = context.issue.number
|
||||
const owner = 'github'
|
||||
const originalRepo = 'docs-internal'
|
||||
|
||||
// See if the engineering label is present.
|
||||
const engineeringLabel = context.payload.issue.labels.find(label => label.name === 'engineering')
|
||||
|
||||
// Transfer engineering issues to the engineering repo and everything else to the Docs Content repo
|
||||
let correctRepo = process.env.TEAM_CONTENT_REPO
|
||||
if (engineeringLabel) {
|
||||
correctRepo = process.env.TEAM_ENGINEERING_REPO
|
||||
}
|
||||
|
||||
const correctRepoObject = await github.repos.get({
|
||||
owner: owner,
|
||||
repo: correctRepo
|
||||
})
|
||||
|
||||
// Post a comment in the docs-internal issue
|
||||
await github.issues.createComment({
|
||||
owner: owner,
|
||||
repo: originalRepo,
|
||||
issue_number: issueNo,
|
||||
body: `👋 Moving forward, we're asking that folks create all new Docs issues in the [${process.env.TEAM_ENGINEERING_REPO}](${process.env.TEAM_ENGINEERING_REPO}) repo and all new content issues in [${process.env.TEAM_CONTENT_REPO}](${process.env.TEAM_CONTENT_REPO}). We transferred it for you!`
|
||||
})
|
||||
|
||||
// Transfer the issue to the correct repo
|
||||
const issueNodeId = context.payload.issue.node_id
|
||||
const correctRepositoryNodeId = correctRepoObject.data.node_id
|
||||
console.log(`Issue GraphQL Node ID: ${issueNodeId}`)
|
||||
console.log(`Repository GraphQL Node ID: ${correctRepositoryNodeId}`)
|
||||
|
||||
const mutation = `mutation ($id: ID!, $repositoryId: ID!) {
|
||||
transferIssue(input: {
|
||||
issueId: $id,
|
||||
repositoryId: $repositoryId
|
||||
}) {
|
||||
issue {
|
||||
url,
|
||||
number
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
const variables = {
|
||||
id: issueNodeId,
|
||||
repositoryId: correctRepositoryNodeId
|
||||
}
|
||||
|
||||
const graph = await github.graphql(mutation, variables)
|
||||
console.log('GraphQL mutation result:\n' + JSON.stringify(graph))
|
||||
|
||||
// Add the same labels to the new issue
|
||||
const newIssueNumber = graph.transferIssue.issue.number
|
||||
await github.issues.addLabels({
|
||||
owner: owner,
|
||||
repo: correctRepo,
|
||||
issue_number: newIssueNumber,
|
||||
labels: context.payload.issue.labels.map(label => label.name),
|
||||
})
|
|
@ -1,63 +0,0 @@
|
|||
name: Send Issue to How We Work Boards
|
||||
|
||||
# **What it does**:
|
||||
# **Why we have it**:
|
||||
# **Who does it impact**:
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- labeled
|
||||
- opened
|
||||
- reopened
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- if: (github.repository == 'github/docs-internal') && contains(github.event.issue.labels.*.name, 'engineering') && !contains(github.event.issue.labels.*.name, 'no-hww-board') && !contains(github.event.issue.labels.*.name, 'batch') && !contains(github.event.issue.labels.*.name, 'epic')
|
||||
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
|
||||
with:
|
||||
github-token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
|
||||
script: |
|
||||
var column_id = 9659080;
|
||||
try {
|
||||
github.projects.createCard({
|
||||
column_id: column_id,
|
||||
content_id: context.payload.issue.id,
|
||||
content_type: "Issue"
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
- if: (github.repository == 'github/docs-internal') && contains(github.event.issue.labels.*.name, 'engineering') && !contains(github.event.issue.labels.*.name, 'no-hww-board') && contains(github.event.issue.labels.*.name, 'batch')
|
||||
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
|
||||
with:
|
||||
github-token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
|
||||
script: |
|
||||
var column_id = 13445681;
|
||||
try {
|
||||
github.projects.createCard({
|
||||
column_id: column_id,
|
||||
content_id: context.payload.issue.id,
|
||||
content_type: "Issue"
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
- if: (github.repository == 'github/docs-internal') && contains(github.event.issue.labels.*.name, 'engineering') && !contains(github.event.issue.labels.*.name, 'no-hww-board') && contains(github.event.issue.labels.*.name, 'epic')
|
||||
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
|
||||
with:
|
||||
github-token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
|
||||
script: |
|
||||
var column_id = 12860544;
|
||||
try {
|
||||
github.projects.createCard({
|
||||
column_id: column_id,
|
||||
content_id: context.payload.issue.id,
|
||||
content_type: "Issue"
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
name: Send pull_request to How We Work Boards
|
||||
|
||||
# **What it does**: This sends pull requests with the feature label to the Docs Engineering feature board
|
||||
# **Why we have it**: If we use PRs to track features this automates them ending up on the feature board
|
||||
# **Who does it impact**: Docs Engineering team members
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- labeled
|
||||
- opened
|
||||
- reopened
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- if: (github.repository == 'github/docs-internal') && !contains(github.event.issue.labels.*.name, 'no-hww-board') && contains(github.event.pull_request.labels.*.name, 'batch')
|
||||
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
|
||||
with:
|
||||
github-token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
|
||||
script: |
|
||||
// Only do this for work by the engineering folks since multiple teams do work
|
||||
// in the docs repos
|
||||
try {
|
||||
await github.teams.getMembershipForUserInOrg({
|
||||
org: 'github',
|
||||
team_slug: 'docs-engineering',
|
||||
username: context.payload.sender.login,
|
||||
});
|
||||
} catch(err) {
|
||||
return
|
||||
}
|
||||
|
||||
var column_id = 13445681;
|
||||
try {
|
||||
await github.projects.createCard({
|
||||
column_id: column_id,
|
||||
content_id: context.payload.pull_request.id,
|
||||
content_type: "PullRequest"
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.includes('Project already has the associated issue')) {
|
||||
return
|
||||
} else {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
name: Automatically Keep Epic Status Labels Updated
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created, edited]
|
||||
jobs:
|
||||
post-status-updates-to-slack:
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.comment.body, '_created with') && contains(github.event.comment.body, 'typing_ `/status`')
|
||||
steps:
|
||||
- uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
|
||||
const issue = context.payload.issue
|
||||
const owner = context.repo.owner
|
||||
const repo = context.payload.repository.name
|
||||
|
||||
const allStatusLabels = [
|
||||
'green',
|
||||
'grey',
|
||||
'yellow',
|
||||
'black',
|
||||
'red'
|
||||
];
|
||||
|
||||
const currentLabels = await github.issues.listLabelsOnIssue({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
issue_number: issue.number
|
||||
});
|
||||
|
||||
const newLabels = currentLabels.data.filter( label => allStatusLabels.includes(label.name) === false)
|
||||
|
||||
allStatusLabels.forEach( label => {
|
||||
if(context.payload.comment.body.toLowerCase().includes(`status: ${label}`)) {
|
||||
newLabels.push(label)
|
||||
}
|
||||
});
|
||||
|
||||
await github.issues.update({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
issue_number: issue.number,
|
||||
labels: newLabels,
|
||||
});
|
|
@ -88,6 +88,7 @@ export type MainContextT = {
|
|||
documentType: string
|
||||
languageVariants: Array<{ name: string; code: string; hreflang: string; href: string }>
|
||||
topics: Array<string>
|
||||
title: string
|
||||
fullTitle?: string
|
||||
introPlainText?: string
|
||||
hidden: boolean
|
||||
|
@ -130,6 +131,7 @@ export const getMainContextFromRequest = (req: any): MainContextT => {
|
|||
page: {
|
||||
languageVariants: req.context.page.languageVariants,
|
||||
documentType: req.context.page.documentType,
|
||||
title: req.context.page.title,
|
||||
fullTitle: req.context.page.fullTitle,
|
||||
topics: req.context.page.topics || [],
|
||||
introPlainText: req.context.page?.introPlainText,
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
import { GetServerSideProps } from 'next'
|
||||
|
||||
import {
|
||||
MainContextT,
|
||||
MainContext,
|
||||
getMainContextFromRequest,
|
||||
} from 'components/context/MainContext'
|
||||
import { Breadcrumbs } from 'components/Breadcrumbs'
|
||||
import { DefaultLayout } from 'components/DefaultLayout'
|
||||
|
||||
type Props = {
|
||||
mainContext: MainContextT
|
||||
graphqlExplorerUrl: string
|
||||
}
|
||||
export default function GQLExplorer({ mainContext, graphqlExplorerUrl }: Props) {
|
||||
const { page, airGap } = mainContext
|
||||
return (
|
||||
<MainContext.Provider value={mainContext}>
|
||||
<DefaultLayout>
|
||||
<main className="container-xl px-3 px-md-6 my-4 my-lg-4 d-xl-flex">
|
||||
<article className="markdown-body width-full">
|
||||
<div className="d-lg-flex flex-justify-between">
|
||||
<div className="d-flex flex-items-center breadcrumbs-wrapper">
|
||||
<Breadcrumbs />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h1 className="border-bottom-0">{page.title}</h1>
|
||||
|
||||
<div className="mt-2">
|
||||
<div>
|
||||
{airGap ? (
|
||||
<p>GraphQL explorer is not available on this environment.</p>
|
||||
) : (
|
||||
<iframe
|
||||
id="graphiql"
|
||||
className="graphql-explorer"
|
||||
scrolling="no"
|
||||
src={graphqlExplorerUrl}
|
||||
>
|
||||
<p>You must have iframes enabled to use this feature.</p>
|
||||
</iframe>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</main>
|
||||
</DefaultLayout>
|
||||
</MainContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
export const getServerSideProps: GetServerSideProps<Props> = async (context) => {
|
||||
const req = context.req as any
|
||||
|
||||
return {
|
||||
props: {
|
||||
mainContext: getMainContextFromRequest(req),
|
||||
graphqlExplorerUrl: req.context.graphql.explorerUrl,
|
||||
},
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче