Skip to content

Commit

Permalink
Merge branch 'main' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwilson21 authored Mar 23, 2023
2 parents 2eb3c09 + 65c8204 commit 7fdffd8
Show file tree
Hide file tree
Showing 1,352 changed files with 356,974 additions and 186,453 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
/.github/ @github/docs-engineering
/script/ @github/docs-engineering
/includes/ @github/docs-engineering
/lib/search/popular-pages.json @github/docs-engineering
Dockerfile @github/docs-engineering
package-lock.json @github/docs-engineering
package.json @github/docs-engineering
Expand Down
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Thank you for contributing to this project! You must fill out the information be

### Why:

Closes ISSUE
Closes:

<!-- If there's an existing issue for your change, please replace ISSUE above with a link to the issue.
<!-- If there's an existing issue for your change, please link to it above.
If there's _not_ an existing issue, please open one first to make it more likely that this update will be accepted: https://github.com/github/docs/issues/new/choose. -->

### What's being changed (if available, include any code snippets, screenshots, or gifs):
Expand Down
26 changes: 13 additions & 13 deletions .github/actions/clone-translations/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ runs:
token: ${{ inputs.token }}
path: translations/zh-cn

- name: Clone Japanese
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
repository: github/docs-internal.ja-jp
token: ${{ inputs.token }}
path: translations/ja-jp

- name: Clone Spanish
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
Expand All @@ -38,12 +31,19 @@ runs:
token: ${{ inputs.token }}
path: translations/pt-br

- name: Clone German
- name: Clone Russian
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
repository: github/docs-internal.de-de
repository: github/docs-internal.ru-ru
token: ${{ inputs.token }}
path: translations/de-de
path: translations/ru-ru

- name: Clone Japanese
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
repository: github/docs-internal.ja-jp
token: ${{ inputs.token }}
path: translations/ja-jp

- name: Clone French
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
Expand All @@ -52,12 +52,12 @@ runs:
token: ${{ inputs.token }}
path: translations/fr-fr

- name: Clone Russian
- name: Clone German
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
repository: github/docs-internal.ru-ru
repository: github/docs-internal.de-de
token: ${{ inputs.token }}
path: translations/ru-ru
path: translations/de-de

- name: Clone Korean
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/local-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Local development

# **What it does**: Can you start the local server like a writer would do?
# **Why we have it**: Our CI is often heavily geared on testing in "production"
# that historically we've been known to break local
# development sometimes.
# **Who does it impact**: Engineers, Contributors.

on:
merge_group:
pull_request:

permissions:
contents: read

jobs:
local-dev:
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
runs-on: ${{ fromJSON('["ubuntu-latest", "ubuntu-20.04-xl"]')[github.repository == 'github/docs-internal'] }}
steps:
- name: Check out repo
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- uses: ./.github/actions/node-npm-setup

# Note that we don't check out docs-early-access, Elasticsearch,
# or any remote translations. Nothing fancy here!

- name: Start server in the background
run: npm start > /tmp/stdout.log 2> /tmp/stderr.log &

- name: View the home page
run: |
echo "Going to sleep a little to wait for the server to start"
sleep 10
curl --fail --retry-connrefused --retry 5 http://localhost:4000/
- name: Edit a page's .md file and expect it to appear
run: |
# First append anything to the Markdown page
echo "Today's date $(date)" >> content/get-started/quickstart/hello-world.md
# This pipe to grep will fail if it can't find it in the curl output
curl -L http://localhost:4000/get-started/quickstart/hello-world | grep "Today's date"
- if: ${{ failure() }}
name: Debug server outputs on errors
run: |
echo "____STDOUT____"
cat /tmp/stdout.log
echo "____STDERR____"
cat /tmp/stderr.log
2 changes: 1 addition & 1 deletion .github/workflows/needs-sme-stale-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/stale@6f05e4244c9a0b2ed3401882b05d701dd0a7289b
- uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84
with:
only-labels: needs SME
remove-stale-when-updated: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
runs-on: ubuntu-latest
steps:
- uses: actions/stale@6f05e4244c9a0b2ed3401882b05d701dd0a7289b
- uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because there have been no updates in 365 days.'
Expand Down
123 changes: 123 additions & 0 deletions .github/workflows/sync-codeql-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Sync CodeQl CLI

# **What it does**: This workflow is run manually approximately every two weeks.
# When run, this workflow syncs the CodeQL CLI automated pipeline with the semmle-code
# repository, and creates a pull request if there are updates.
# **Why we have it**: So we can automate CodeQL CLI documentation.
# **Who does it impact**: Anyone making CodeQL CLI changes in `github/semmle-code`, and wanting to get them published on the docs site.

on:
workflow_dispatch:
inputs:
SOURCE_BRANCH:
description: 'Branch to pull the source files from in the semmle-code repo.'
type: string
required: true
default: 'main'

permissions:
contents: write
pull-requests: write

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
generate-codeql-files:
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
steps:
- if: ${{ env.FREEZE == 'true' }}
run: |
echo 'The repo is currently frozen! Exiting this workflow.'
exit 1 # prevents further steps from running
- name: Checkout repository code
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

# Check out a nested repository inside of previous checkout
- name: Checkout semmle-code repo
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
# By default, only the most recent commit of the `main` branch
# will be checked out
token: ${{ secrets.DOCS_BOT_FR }}
repository: github/semmle-code
path: semmle-code
ref: ${{ github.event.inputs.SOURCE_BRANCH }}

- uses: ./.github/actions/node-npm-setup

- name: Get the semmle-code SHA being synced
id: semmle-code
run: |
cd semmle-code
OPENAPI_COMMIT_SHA=$(git rev-parse HEAD)
echo "OPENAPI_COMMIT_SHA=$OPENAPI_COMMIT_SHA" >> $GITHUB_OUTPUT
echo "Copied files from github/semmle-code repo. Commit SHA: $OPENAPI_COMMIT_SHA"
- name: Install pandoc
run: |
# Remove all previous pandoc versions
sudo apt-get purge --auto-remove pandoc
# Download pandoc
wget https://github.com/jgm/pandoc/releases/download/3.0.1/pandoc-3.0.1-1-amd64.deb
# Install pandoc
sudo dpkg -i pandoc-3.0.1-1-amd64.deb
# Output the pandoc version installed
pandoc -v
rm pandoc-3.0.1-1-amd64.deb
- name: Sync the CodeQL CLI data
run: |
src/codeql-cli/scripts/sync.js
git status
echo "Deleting the cloned github/semmle-code repo..."
rm -rf semmle-code
- name: Create pull request
env:
# Needed for gh
GITHUB_TOKEN: ${{ secrets.DOCUBOT_REPO_PAT }}
run: |
# If nothing to commit, exit now. It's fine. No orphans.
changes=$(git diff --name-only | wc -l)
untracked=$(git status --untracked-files --short | wc -l)
if [[ $changes -eq 0 ]] && [[ $untracked -eq 0 ]]; then
echo "There are no changes to commit after running src/codeql/scripts/sync.js. Exiting..."
exit 0
fi
git config --global user.name "docubot"
git config --global user.email "67483024+docubot@users.noreply.github.com"
branchname=codeql-cli-update-${{ steps.semmle-code.outputs.OPENAPI_COMMIT_SHA }}
branchCheckout=$(git checkout -b $branchname)
if [[! $? -eq 0 ]]; then
echo "Branch $branchname already exists in `github/docs-internal`. Exiting..."
exit 0
fi
git add .
git commit -m "Update CodeQL CLI data"
git push origin $branchname
echo "Creating pull request..."
gh pr create \
--title "Update CodeQL CLI manual" \
--body '👋 humans. This PR updates the CodeQL CLI manual Markdown pages with the latest changes. (Synced from semmle-code@${{ steps.semmle-code.outputs.OPENAPI_COMMIT_SHA }})
If CI does not pass or other problems arise, contact #docs-engineering on slack.' \
--repo github/docs-internal \
--label codeql-cli-pipeline
- name: Send Slack notification if workflow fails
uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad
if: ${{ failure() && env.FREEZE != 'true' }}
with:
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
color: failure
text: The last Sync CodeQL CLI run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions/workflows/sync-codeql-cli.yml
14 changes: 13 additions & 1 deletion .github/workflows/sync-search-elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
script: |
// Edit this list for the definitive list of languages
// (other than English) we want to index in Elasticsearch.
const allNonEnglish = ["ja", "es", "pt", "zh", "ru", "fr", "ko", "de"]
const allNonEnglish = ["zh", "es", "pt", "ru", "ja", "fr", "de", "ko"]
const allPossible = ["en", ...allNonEnglish]
if (context.eventName === "workflow_run") {
Expand Down Expand Up @@ -99,6 +99,14 @@ jobs:
- name: Check out repo
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Clone docs-internal.popular-pages
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
repository: github/docs-internal.popular-pages
# This works because user `docubot` has read access to that private repo.
token: ${{ secrets.DOCUBOT_REPO_PAT }}
path: popular-pages

- name: Clone all translations
if: ${{ matrix.language != 'en' }}
uses: ./.github/actions/clone-translations
Expand Down Expand Up @@ -149,6 +157,10 @@ jobs:
# the same as not set within the script.
VERSION: ${{ github.event.inputs.version }}

# The sync-search-index recognizes this env var if you don't
# use the `--popular-pags <PATH>` option.
POPULAR_PAGES_JSON: popular-pages/records/popular-pages.json

run: |
mkdir /tmp/records
npm run sync-search-indices -- /tmp/records \
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/sync-search-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
paths:
- 'script/search/**'
- 'package*.json'
- lib/search/popular-pages.json
# Ultimately, for debugging this workflow itself
- .github/workflows/sync-search-pr.yml

Expand All @@ -36,6 +35,14 @@ jobs:
- name: Check out repo
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Clone docs-internal.popular-pages
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
repository: github/docs-internal.popular-pages
# This works because user `docubot` has read access to that private repo.
token: ${{ secrets.DOCUBOT_REPO_PAT }}
path: popular-pages

- uses: ./.github/actions/setup-elasticsearch

- uses: ./.github/actions/node-npm-setup
Expand Down Expand Up @@ -78,6 +85,10 @@ jobs:
# let's just accept an empty string instead.
THROW_ON_EMPTY: false

# The sync-search-index recognizes this env var if you don't
# use the `--popular-pags <PATH>` option.
POPULAR_PAGES_JSON: popular-pages/records/popular-pages.json

run: |
mkdir /tmp/records
npm run sync-search-indices -- /tmp/records \
Expand Down
Loading

0 comments on commit 7fdffd8

Please sign in to comment.