1
0
mirror of synced 2026-01-06 06:02:35 -05:00

Merge branch 'main' into site-policy-sync-update

This commit is contained in:
Peter Cihon
2021-04-16 10:29:25 -07:00
committed by GitHub
13926 changed files with 459696 additions and 73585 deletions

View File

@@ -20,7 +20,7 @@ jobs:
stale-pr-message: 'This PR is stale because it has been open 60 days with no activity.'
days-before-stale: 60
days-before-close: -1
only-labels: 'engineering'
only-labels: 'engineering,Triaged,Improve existing docs,Core,Ecosystem'
stale-issue-label: 'stale'
stale-pr-label: 'stale'
exempt-pr-labels: 'never-stale'

View File

@@ -12,44 +12,26 @@ on:
pull_request:
jobs:
see_if_should_skip:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@36feb0d8d062137530c2e00bd278d138fe191289
with:
cancel_others: 'false'
github_token: ${{ github.token }}
paths: '[".github/workflows/browser-test.yml","assets/**", "content/**", "data/**", "includes/**", "javascripts/**", "jest-puppeteer.config.js", "jest.config.js", "layouts/**", "lib/**", "middleware/**", "package-lock.json", "package.json", "server.js", "translations/**", "webpack.config.js"]'
build:
needs: see_if_should_skip
runs-on: ubuntu-latest
steps:
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
# Even if if doesn't do anything
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Checkout
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Setup Node
- name: Setup Node
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 14.x
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Install
- name: Install
uses: rachmari/puppeteer-container@6d56d6e132a3df76cf60bc290a4282f7fbaed05e
timeout-minutes: 5
with:
args: npm ci
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Test
- name: Test
timeout-minutes: 10
uses: rachmari/puppeteer-container@6d56d6e132a3df76cf60bc290a4282f7fbaed05e
with:

View File

@@ -65,3 +65,14 @@ jobs:
issue_number: issue.number,
body: "This issue appears to have been opened accidentally. I'm going to close it now, but feel free to open a new issue or ask any questions in [discussions](https://github.com/github/docs/discussions)!"
});
// Add the issue to the Done column on the triage board
try {
await github.projects.createCard({
column_id: 11167427,
content_id: context.payload.issue.id,
content_type: "Issue"
});
} catch (error) {
console.log(error);
}

View File

@@ -1,65 +0,0 @@
name: Check for External Repo Sync PR
# **What it does**: If someone made a repo sync pull request other than Octomerger, close it.
# **Why we have it**: Another form of spam in the open-source repository.
# **Who does it impact**: Open-source contributors.
on:
pull_request:
types:
- opened
- reopened
branches:
- main
jobs:
invalid-repo-sync-check:
name: Close external Repo Sync PRs
if: ${{ github.repository == 'github/docs' && github.head_ref == 'repo-sync' }}
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
with:
github-token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
script: |
const prCreator = context.payload.sender.login
// If the PR creator is the expected account, stop now
if (prCreator === 'Octomerger') {
return
}
try {
await github.teams.getMembershipForUserInOrg({
org: 'github',
team_slug: 'employees',
username: prCreator
})
// If the PR creator is a GitHub employee, stop now
return
} catch (err) {
// An error will be thrown if the user is not a GitHub employee.
// That said, we still want to proceed anyway!
}
const pr = context.payload.pull_request
const { owner, repo } = context.repo
// Close the PR and add the invalid label
await github.issues.update({
owner: owner,
repo: repo,
issue_number: pr.number,
labels: ['invalid'],
state: 'closed'
})
// Comment on the PR
await github.issues.createComment({
owner: owner,
repo: repo,
issue_number: pr.number,
body: "Please leave this `repo-sync` branch to the robots!\n\nI'm going to close this pull request now, but feel free to open a new issue or ask any questions in [discussions](https://github.com/github/docs/discussions)!"
})

View File

@@ -17,7 +17,7 @@ jobs:
check-team-membership:
runs-on: ubuntu-latest
continue-on-error: true
if: github.repository == 'github/docs'
if: github.repository == 'github/docs' && github.actor != 'docs-bot'
steps:
- id: membership_check
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9

View File

@@ -36,7 +36,7 @@ jobs:
issue_number: issueNumber
})
const teamMembers = await github.request(
`/orgs/github/teams/docs/members`
`/orgs/github/teams/docs/members?per_page=100`
)
const logins = teamMembers.data.map(member => member.login)
// ignore PRs opened by docs bot accounts

View File

@@ -12,53 +12,26 @@ on:
pull_request:
jobs:
see_if_should_skip:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@36feb0d8d062137530c2e00bd278d138fe191289
with:
cancel_others: 'false'
github_token: ${{ github.token }}
paths: '[".github/workflows/link-check-dotcom.yml", "assets/**", "content/**", "data/**", "includes/**", "javascripts/**", "jest-puppeteer.config.js", "jest.config.js", "layouts/**", "lib/**", "middleware/**", "package-lock.json", "package.json", "server.js", "translations/**", "webpack.config.js"]'
build:
needs: see_if_should_skip
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
steps:
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
# Even if if doesn't do anything
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Checkout
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Setup node
- name: Setup node
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 14.x
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Install
- name: Install
run: npm ci
## TODO
# - if: ${{ github.repository == 'github/docs-internal' && needs.see_if_should_skip.outputs.should_skip != 'true' }}
# name: Clone early access
# run: npm run heroku-postbuild
# env:
# DOCUBOT_REPO_PAT: ${{ secrets.DOCUBOT_REPO_PAT }}
# GIT_BRANCH: ${{ github.head_ref || github.ref }}
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Build
- name: Build
run: npm run build
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: 'Link check: Dotcom'
- name: 'Link check: Dotcom'
env:
DOCS_VERSION: 'dotcom'
run: npm run link-check

View File

@@ -12,53 +12,26 @@ on:
pull_request:
jobs:
see_if_should_skip:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@36feb0d8d062137530c2e00bd278d138fe191289
with:
cancel_others: 'false'
github_token: ${{ github.token }}
paths: '[".github/workflows/link-check-ghae.yml", "assets/**", "content/**", "data/**", "includes/**", "javascripts/**", "jest-puppeteer.config.js", "jest.config.js", "layouts/**", "lib/**", "middleware/**", "package-lock.json", "package.json", "server.js", "translations/**", "webpack.config.js"]'
build:
needs: see_if_should_skip
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
steps:
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
# Even if if doesn't do anything
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Checkout
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Setup node
- name: Setup node
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 14.x
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Install
- name: Install
run: npm ci
## TODO
# - if: ${{ github.repository == 'github/docs-internal' && needs.see_if_should_skip.outputs.should_skip != 'true' }}
# name: Clone early access
# run: npm run heroku-postbuild
# env:
# DOCUBOT_REPO_PAT: ${{ secrets.DOCUBOT_REPO_PAT }}
# GIT_BRANCH: ${{ github.head_ref || github.ref }}
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Build
- name: Build
run: npm run build
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: 'Link check: GitHub AE'
- name: 'Link check: GitHub AE'
env:
DOCS_VERSION: 'github-ae'
run: npm run link-check

View File

@@ -12,53 +12,26 @@ on:
pull_request:
jobs:
see_if_should_skip:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@36feb0d8d062137530c2e00bd278d138fe191289
with:
cancel_others: 'false'
github_token: ${{ github.token }}
paths: '[".github/workflows/link-check-ghes.yml", "assets/**", "content/**", "data/**", "includes/**", "javascripts/**", "jest-puppeteer.config.js", "jest.config.js", "layouts/**", "lib/**", "middleware/**", "package-lock.json", "package.json", "server.js", "translations/**", "webpack.config.js"]'
build:
needs: see_if_should_skip
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
steps:
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
# Even if if doesn't do anything
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Checkout
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Setup node
- name: Setup node
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 14.x
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Install
- name: Install
run: npm ci
## TODO
# - if: ${{ github.repository == 'github/docs-internal' && needs.see_if_should_skip.outputs.should_skip != 'true' }}
# name: Clone early access
# run: npm run heroku-postbuild
# env:
# DOCUBOT_REPO_PAT: ${{ secrets.DOCUBOT_REPO_PAT }}
# GIT_BRANCH: ${{ github.head_ref || github.ref }}
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Build
- name: Build
run: npm run build
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: 'Link check: Enterprise Server'
- name: 'Link check: Enterprise Server'
env:
DOCS_VERSION: 'enterprise-server'
run: npm run link-check

View File

@@ -5,7 +5,7 @@ name: Move and unlabel ready to merge issues
# **Who does it impact**: Open source contributors, open-source maintainers.
on:
pull_request:
pull_request_target:
types:
- labeled

View File

@@ -0,0 +1,41 @@
name: Move Reopened Issues to Triage
# **What it does**: Moves issues that are reopened from the Done column to the Triage column.
# **Why we have it**: To prevent having to do this manually.
# **Who does it impact**: Open-source.
on:
issues:
types:
- reopened
jobs:
move-reopened-issue-to-triage:
if: github.repository == 'github/docs'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
with:
github-token: ${{ github.token }}
script: |
const issueNumber = context.issue.number;
const doneColumnId = 11167427;
const triageColumnId = 11007039;
try {
const cards = await github.projects.listCards({
column_id: doneColumnId
});
for (const card of cards) {
if (card.content_url.endsWith(`/${issueNumber}`)) {
await github.projects.moveCard({
card_id: card.id,
position: 'position',
column_id: triageColumnId
});
}
}
} catch(e) {
console.log(error);
}

30
.github/workflows/no-response.yaml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: No Response
# **What it does**: Closes issues that don't have enough information to be
# actionable.
# **Why we have it**: To remove the need for maintainers to remember to check
# back on issues periodically to see if contributors have
# responded.
# **Who does it impact**: Everyone that works on docs or docs-internal.
on:
issue_comment:
types: created
schedule:
# Schedule for five minutes after the hour every hour
- cron: '5 * * * *'
jobs:
noResponse:
runs-on: ubuntu-latest
steps:
- uses: lee-dohm/no-response@9bb0a4b5e6a45046f00353d5de7d90fb8bd773bb
with:
token: ${{ github.token }}
closeComment: >
This issue has been automatically closed because there has been no response
to our request for more information from the original author. With only the
information that is currently in the issue, we don't have enough information
to take action. Please reach out if you have or find the answers we need so
that we can investigate further. See [this blog post on bug reports and the importance of repro steps](https://www.lee-dohm.com/2015/01/04/writing-good-bug-reports/) for more information about the kind of information that may be helpful.

View File

@@ -0,0 +1,51 @@
name: Open Enterprise release or deprecation issue
# **What it does**: Checks if there is an Enterprise release or deprecation upcoming, and if so, opens an issue with the tasks to be completed.
# **Why we have it**: GHES releases and deprecations run on a predictable schedule, so we can automate some of the project management aspects.
# **Who does it impact**: Docs engineering, docs content.
on:
schedule:
- cron: '49 14 * * *' # At 14:49 UTC daily
jobs:
open_enterprise_issue:
name: Open Enterprise issue
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
steps:
- name: Check for existing release or deprecation issues
id: existingIssue
run: |
.github/actions-scripts/check-for-enterprise-issues-by-label.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
if: steps.existingIssue.outputs.deprecationIssue == 'false' || steps.existingIssue.outputs.releaseIssue == 'false'
- name: npm ci
if: steps.existingIssue.outputs.deprecationIssue == 'false' || steps.existingIssue.outputs.releaseIssue == 'false'
run: npm ci
- name: npm run build
if: steps.existingIssue.outputs.deprecationIssue == 'false' || steps.existingIssue.outputs.releaseIssue == 'false'
run: npm run build
- name: Update enterprise dates
if: steps.existingIssue.outputs.deprecationIssue == 'false' || steps.existingIssue.outputs.releaseIssue == 'false'
run: |
script/update-enterprise-dates.js
- name: Create an enterprise release issue
if: steps.existingIssue.outputs.releaseIssue == 'false'
run: |
.github/actions-scripts/create-enterprise-issue.js release
env:
GITHUB_TOKEN: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
- name: Create an enterprise deprecation issue
if: steps.existingIssue.outputs.deprecationIssue == 'false'
run: |
.github/actions-scripts/create-enterprise-issue.js deprecation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -7,7 +7,6 @@ name: OpenAPI generate decorated schema files
on:
workflow_dispatch:
pull_request:
types: [opened]
jobs:
generate-decorated-files:

View File

@@ -13,56 +13,15 @@ jobs:
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
steps:
- id: find_project_cards
uses: octokit/graphql-action@5b3e01d42dee4509b0ac6b1cb2cf7778cdce85c2
with:
query: |
query($issue_node_id:ID!) {
node(id:$issue_node_id) {
... on Issue {
projectCards(first: 10) {
nodes {
id
project {
name
id
}
}
}
}
... on PullRequest {
projectCards(first: 10) {
nodes {
id
project {
name
id
}
}
}
}
}
}
issue_node_id: ${{ github.event.client_payload.command.resource.id }}
- name: Remove issue from board
if: ${{ github.event.client_payload.command.resource.type == 'Issue' }}
run: gh issue edit "$ISSUE_URL" --remove-project "Docs content first responder"
env:
GITHUB_TOKEN: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
- run: "echo 'Project cards found: ${{ steps.find_project_cards.outputs.data }}'"
- name: Get FR card
GITHUB_TOKEN: ${{secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES}}
ISSUE_URL: https://github.com/${{ github.event.client_payload.command.repository.full_name }}/issues/${{ github.event.client_payload.command.resource.number }}
- name: Remove PR from board
if: ${{ github.event.client_payload.command.resource.type == 'PullRequest' }}
run: gh pr edit "$PR_URL" --remove-project "Docs content first responder"
env:
QUERY_DATA: ${{ steps.find_project_cards.outputs.data }}
run: |
echo 'FR_CARDS='$(jq '.node.projectCards.nodes | .[] | select(.project.id == "MDc6UHJvamVjdDQ1NzI0ODI=") | .id' <<< "$QUERY_DATA") >> $GITHUB_ENV
- name: Delete card
id: delete_project_card
if: ${{ env.FR_CARDS }}
uses: octokit/graphql-action@5b3e01d42dee4509b0ac6b1cb2cf7778cdce85c2
with:
query: |
mutation DeleteCard {
deleteProjectCard(input:{cardId:${{ env.FR_CARDS }}}) {deletedCardId}
}
env:
GITHUB_TOKEN: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
GITHUB_TOKEN: ${{secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES}}
PR_URL: https://github.com/${{ github.event.client_payload.command.repository.full_name }}/pull/${{ github.event.client_payload.command.resource.number }}

View File

@@ -6,7 +6,7 @@ name: Repo Freeze Reminders
on:
schedule:
- cron: '00 11 * * *' # once per day around 11:00am UTC
- cron: '9 11 * * *' # once per day around 11:09am UTC
env:
FREEZE: ${{ secrets.FREEZE }}

View File

@@ -7,7 +7,7 @@ name: Repo Sync Stalls
on:
workflow_dispatch:
schedule:
- cron: '0 */2 * * *'
- cron: '32 */2 * * *' # At minute 32 past every 2nd hour.
jobs:
repo-sync-stalls:

View File

@@ -1,13 +1,18 @@
# The docs.github.com project has two repositories: github/docs (public) and github/docs-internal (private)
#
# This GitHub Actions workflow keeps the main branch of those two repos in sync.
# This GitHub Actions workflow keeps the `main` branch of those two repos in sync.
#
# For more details, see https://github.com/repo-sync/repo-sync#how-it-works
name: Repo Sync
# **What it does**: Syncs docs and docs-internal.
# **Why we have it**: To keep the open-source repository up-to-date, while still having an internal repository for sensitive work.
# **What it does**:
# - close-invalid-repo-sync: Close repo sync pull requests not created by Octomerger or a Hubber.
# - repo-sync: Syncs docs and docs-internal.
# **Why we have it**:
# - close-invalid-repo-sync: Another form of spam prevention for the open-source repository.
# - repo-sync: To keep the open-source repository up-to-date, while still having an internal
# repository for sensitive work.
# **Who does it impact**: Open-source.
on:
@@ -16,7 +21,74 @@ on:
- cron: '*/15 * * * *' # every 15 minutes
jobs:
close-invalid-repo-sync:
name: Close invalid Repo Sync PRs
runs-on: ubuntu-latest
steps:
- name: Find pull request
if: ${{ github.repository == 'github/docs' }}
uses: juliangruber/find-pull-request-action@db875662766249c049b2dcd85293892d61cb0b51
id: find-pull-request
with:
github-token: ${{ secrets.DOCS_BOT_SPAM_VISION }}
branch: repo-sync
base: main
state: open
- name: Close pull request if unwanted
if: ${{ github.repository == 'github/docs' && steps.find-pull-request.outputs.number }}
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
with:
github-token: ${{ secrets.DOCS_BOT_SPAM_VISION }}
script: |
const { owner, repo } = context.repo
const { data: pr } = await github.pulls.get({
owner,
repo,
pull_number: parseInt(${{ steps.find-pull-request.outputs.number }})
})
const prCreator = pr.user.login
// If the PR creator is the expected account, stop now
if (prCreator === 'Octomerger') {
return
}
try {
await github.teams.getMembershipForUserInOrg({
org: 'github',
team_slug: 'employees',
username: prCreator
})
// If the PR creator is a GitHub employee, stop now
return
} catch (err) {
// An error will be thrown if the user is not a GitHub employee.
// That said, we still want to proceed anyway!
}
// Close the PR and add the invalid label
await github.issues.update({
owner,
repo,
issue_number: pr.number,
labels: ['invalid'],
state: 'closed'
})
// Comment on the PR
await github.issues.createComment({
owner,
repo,
issue_number: pr.number,
body: "Please leave this `repo-sync` branch to the robots!\n\nI'm going to close this pull request now, but feel free to open a new issue or ask any questions in [discussions](https://github.com/github/docs/discussions)!"
})
repo-sync:
needs: close-invalid-repo-sync
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
name: Repo Sync
runs-on: ubuntu-latest
@@ -44,17 +116,18 @@ jobs:
destination_branch: main
pr_title: 'repo sync'
pr_body: "This is an automated pull request to sync changes between the public and private repos.\n\n:robot: This pull request should be merged (not squashed) to preserve continuity across repos, so please let a bot do the merging!"
pr_label: automerge,autoupdate,automated-reposync-pr
pr_label: autoupdate,automated-reposync-pr
github_token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
- name: Find pull request
uses: juliangruber/find-pull-request-action@2fc55e82a6d5d36fe1e7f1848f7e64fd02d99de9
uses: juliangruber/find-pull-request-action@db875662766249c049b2dcd85293892d61cb0b51
id: find-pull-request
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
branch: repo-sync
base: main
author: Octomerger
state: open
- name: Approve pull request
if: ${{ steps.find-pull-request.outputs.number }}
@@ -68,7 +141,7 @@ jobs:
if: ${{ steps.find-pull-request.outputs.number }}
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
script: |
const mainHeadSha = await github.git.getRef({
...context.repo,
@@ -92,6 +165,41 @@ jobs:
console.log(`Branch is already up-to-date`)
}
- name: Enable GitHub auto-merge
if: ${{ steps.find-pull-request.outputs.number }}
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
with:
github-token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
script: |
const pull = await github.pulls.get({
...context.repo,
pull_number: parseInt(${{ steps.find-pull-request.outputs.number }})
})
const pullNodeId = pull.data.node_id
console.log(`Pull request GraphQL Node ID: ${pullNodeId}`)
const mutation = `mutation ($id: ID!) {
enablePullRequestAutoMerge(input: {
pullRequestId: $id,
mergeMethod: MERGE
}) {
clientMutationId
}
}`
const variables = {
id: pullNodeId
}
const graph = await github.graphql(mutation, variables)
console.log('GraphQL mutation result:\n' + JSON.stringify(graph))
if (graph.errors && graph.errors.length > 0) {
console.error('ERROR! Failed to enable auto-merge:\n - ' + graph.errors.map(error => error.message).join('\n - '))
} else {
console.log('Auto-merge enabled!')
}
- name: Send Slack notification if workflow fails
uses: someimportantcompany/github-actions-slack-message@0b470c14b39da4260ed9e3f9a4f1298a74ccdefd
if: failure()

View File

@@ -1,5 +1,9 @@
name: Send Crowdin PRs to boards
# **What it does**: Sends PRs opened on the crowdin branch to the ready for work column in this board: https://github.com/orgs/github/projects/1269#column-13447153
# **Why we have it**: To make sure the first responder sees crowdin translations that need to be merged as they review the Task board.
# **Who does it impact**: Docs localization and Docs Engineering
on:
pull_request:
types:
@@ -14,24 +18,13 @@ jobs:
with:
github-token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
script: |
var squadBoardColumnId = 13447153; // Add to the team backlog/squad board
var squadBoardColumnId = 13447153; // Add to the team task board
try {
await github.projects.createCard({
column_id: squadBoardColumnId,
content_id: context.payload.issue.id,
content_type: "Issue"
});
} catch (error) {
console.log(error);
}
var prBoardColumnId = 10095775; // Add to the pull requests board
try {
await github.projects.createCard({
column_id: prBoardColumnId,
content_id: context.payload.issue.id,
content_type: "Issue"
content_id: context.payload.pull_request.id,
content_type: "PullRequest"
});
} catch (error) {
console.log(error);

View File

@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- if: contains(github.event.issue.labels.*.name, 'engineering') && !contains(github.event.issue.labels.*.name, 'feature') && !contains(github.event.issue.labels.*.name, 'epic')
- if: (github.repository == 'github/docs-internal') && contains(github.event.issue.labels.*.name, 'engineering') && !contains(github.event.issue.labels.*.name, 'feature') && !contains(github.event.issue.labels.*.name, 'epic')
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
with:
github-token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
@@ -31,7 +31,7 @@ jobs:
} catch (error) {
console.log(error);
}
- if: contains(github.event.issue.labels.*.name, 'engineering') && contains(github.event.issue.labels.*.name, 'feature')
- if: (github.repository == 'github/docs-internal') && contains(github.event.issue.labels.*.name, 'engineering') && contains(github.event.issue.labels.*.name, 'feature')
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
with:
github-token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
@@ -46,7 +46,7 @@ jobs:
} catch (error) {
console.log(error);
}
- if: contains(github.event.issue.labels.*.name, 'engineering') && contains(github.event.issue.labels.*.name, 'epic')
- if: (github.repository == 'github/docs-internal') && contains(github.event.issue.labels.*.name, 'engineering') && contains(github.event.issue.labels.*.name, 'epic')
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
with:
github-token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}

View File

@@ -0,0 +1,49 @@
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.pull_request.labels.*.name, 'feature')
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);
}
}

View File

@@ -47,4 +47,6 @@ jobs:
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run sync-search
run: |
npm run build
npm run sync-search

View File

@@ -17,22 +17,7 @@ env:
CI: true
jobs:
see_if_should_skip:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@36feb0d8d062137530c2e00bd278d138fe191289
with:
cancel_others: 'false'
github_token: ${{ github.token }}
paths: '[".github/workflows/test.yml", ".node-version", ".npmrc", "app.json", "content/**", "data/**","lib/**", "Dockerfile", "feature-flags.json", "Gemfile", "Gemfile.lock", "middleware/**", "node_modules/**","package.json", "package-lock.json", "server.js", "tests/**", "translations/**", "Procfile", "webpack.config.js"]'
test:
needs: see_if_should_skip
# Run on self-hosted if the private repo or ubuntu-latest if the public repo
# See pull # 17442 in the private repo for context
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
@@ -44,27 +29,23 @@ jobs:
steps:
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
# Even if if doesn't do anything
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Check out repo
- name: Check out repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
# Enables cloning the Early Access repo later with the relevant PAT
persist-credentials: 'false'
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Setup node
- name: Setup node
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 14.x
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Get npm cache directory
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Cache node modules
- name: Cache node modules
uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a
with:
path: ${{ steps.npm-cache.outputs.dir }}
@@ -72,23 +53,21 @@ jobs:
restore-keys: |
${{ runner.os }}-node-
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Install dependencies
- name: Install dependencies
run: npm ci
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' && github.repository == 'github/docs-internal' }}
- if: ${{ github.repository == 'github/docs-internal' }}
name: Clone early access
run: npm run heroku-postbuild
env:
DOCUBOT_REPO_PAT: ${{ secrets.DOCUBOT_REPO_PAT }}
GIT_BRANCH: ${{ github.head_ref || github.ref }}
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' && github.repository != 'github/docs-internal' }}
- if: ${{ github.repository != 'github/docs-internal' }}
name: Run build script
run: npm run build
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
name: Run tests
- name: Run tests
run: npx jest tests/${{ matrix.test-group }}/
env:
NODE_OPTIONS: '--max_old_space_size=4096'

View File

@@ -21,13 +21,14 @@ jobs:
echo 'The repo is currently frozen! Exiting this workflow.'
exit 1 # prevents further steps from running
- name: Find original Pull Request
uses: juliangruber/find-pull-request-action@2fc55e82a6d5d36fe1e7f1848f7e64fd02d99de9
uses: juliangruber/find-pull-request-action@db875662766249c049b2dcd85293892d61cb0b51
id: pr
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
branch: translations
base: main
author: octoglot
state: open
- if: ${{ steps.pr.outputs.number }}
name: Check if already labeled
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9

View File

@@ -5,7 +5,7 @@ name: Triage new pull requests
# **Who does it impact**:
on:
pull_request:
pull_request_target:
types:
- reopened
- opened

View File

@@ -21,7 +21,7 @@ jobs:
days-before-pr-stale: 7
days-before-pr-close: 3
stale-pr-label: 'stale'
exempt-pr-labels: 'waiting for review'
exempt-pr-labels: 'waiting for review,never-stale'
stale_staff:
if: github.repository == 'github/docs'
runs-on: ubuntu-latest
@@ -40,3 +40,4 @@ jobs:
# a comment being posted every 14 days as an infinite loop, which is what
# we want
stale-pr-label: 'waiting for review'
exempt-pr-labels: 'never-stale'