Skip to content

Commit 213424c

Browse files
authored
Merge branch 'main' into patch-1
2 parents 2fb048f + 70bdbd9 commit 213424c

File tree

2,422 files changed

+122242
-66520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,422 files changed

+122242
-66520
lines changed

.devcontainer/test-custom-devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "test",
2+
"name": "Test postCreateCommand",
33
"image": "mcr.microsoft.com/devcontainers/universal:linux",
44

55
"settings": {
@@ -22,6 +22,6 @@
2222
"forwardPorts": [5000],
2323

2424
// Use 'postCreateCommand' to run commands after the container is created.
25-
"postCreateCommand": "echo test > aaa-TEST.txt"
25+
"postCreateCommand": "echo Added: `date` > aaa-TEST.txt"
2626

2727
}

.github/workflows/azure-preview-env-deploy.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ jobs:
4747
# See https://bit.ly/3qB9nZW > If a job in a workflow is skipped due to a conditional, it will report its status as "Success".
4848
if: |
4949
(
50-
(github.event.pull_request.head.sha || github.event.inputs.COMMIT_REF)
50+
(github.event.pull_request.head.sha || github.event.inputs.COMMIT_REF)
5151
&& (github.event.number || github.event.inputs.PR_NUMBER || github.run_id)
52-
)
52+
)
5353
&& (github.repository == 'github/docs-internal' || github.repository == 'github/docs')
5454
&& github.actor != 'dependabot[bot]'
5555
timeout-minutes: 15
@@ -213,7 +213,7 @@ jobs:
213213
dockerRegistryUsername="${{ env.NONPROD_REGISTRY_USERNAME }}"
214214
dockerRegistryPassword="${{ secrets.NONPROD_REGISTRY_PASSWORD }}"
215215

216-
- name: Check that it can reached
216+
- name: Check that it can be reached
217217
# This introduces a necessary delay. Because the preview evironment
218218
# URL is announced to the pull request as soon as all the steps
219219
# finish, what sometimes happens is that a viewer of the PR clicks
@@ -223,4 +223,8 @@ jobs:
223223
# process requests.
224224
# By introducing a slight "delay" here we avoid announcing a
225225
# preview environment URL that isn't actually working just yet.
226-
run: curl --retry-connrefused --retry 5 -I ${{ env.APP_URL }}
226+
# Note the use of `--fail`. It which means that if it actually
227+
# did connect but the error code was >=400, the command will fail.
228+
# The `--fail --retry N` combination means that a 4xx response
229+
# code will exit immediately but a 5xx will exhaust the retries.
230+
run: curl --fail --retry-connrefused --retry 5 -I ${{ env.APP_URL }}

.github/workflows/code-lint.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/lint-code.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Lint code
2+
3+
# **What it does**: Lints our code to ensure the code matches the specified code style.
4+
# **Why we have it**: We want some level of consistency to our code.
5+
# **Who does it impact**: Docs engineering, open-source engineering contributors.
6+
7+
on:
8+
workflow_dispatch:
9+
pull_request:
10+
paths:
11+
- '**.js'
12+
- '**.mjs'
13+
- '**.ts'
14+
- '**.tsx'
15+
- '**.yaml'
16+
- '**.yml'
17+
- '**.scss'
18+
- .eslintrc.cjs
19+
# In case something like eslint or tsc or prettier upgrades
20+
- 'package-lock.json'
21+
# In case one of the script definitions changed
22+
- 'package.json'
23+
# Ultimately, for debugging this workflow itself
24+
- .github/workflows/code-lint.yml
25+
26+
permissions:
27+
contents: read
28+
29+
# This allows a subsequently queued workflow run to interrupt previous runs
30+
concurrency:
31+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
32+
cancel-in-progress: true
33+
34+
jobs:
35+
lint-code:
36+
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
37+
runs-on: ${{ fromJSON('["ubuntu-latest", "ubuntu-20.04-xl"]')[github.repository == 'github/docs-internal'] }}
38+
steps:
39+
- name: Check out repo
40+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
41+
42+
- uses: ./.github/actions/node-npm-setup
43+
44+
- name: Run linter
45+
run: npm run lint
46+
47+
- name: Run Prettier
48+
run: npm run prettier-check
49+
50+
- name: Run TypeScript
51+
run: npm run tsc

.github/workflows/local-dev.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Local development
2+
3+
# **What it does**: Can you start the local server like a writer would do?
4+
# **Why we have it**: Our CI is often heavily geared on testing in "production"
5+
# that historically we've been known to break local
6+
# development sometimes.
7+
# **Who does it impact**: Engineers, Contributors.
8+
9+
on:
10+
merge_group:
11+
pull_request:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
local-dev:
18+
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
19+
runs-on: ${{ fromJSON('["ubuntu-latest", "ubuntu-20.04-xl"]')[github.repository == 'github/docs-internal'] }}
20+
steps:
21+
- name: Check out repo
22+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
23+
24+
- uses: ./.github/actions/node-npm-setup
25+
26+
# Note that we don't check out docs-early-access, Elasticsearch,
27+
# or any remote translations. Nothing fancy here!
28+
29+
- name: Start server in the background
30+
run: npm start > /tmp/stdout.log 2> /tmp/stderr.log &
31+
32+
- name: View the home page
33+
run: |
34+
echo "Going to sleep a little to wait for the server to start"
35+
sleep 10
36+
curl --fail --retry-connrefused --retry 5 http://localhost:4000/
37+
38+
- name: Edit a page's .md file and expect it to appear
39+
run: |
40+
# First append anything to the Markdown page
41+
echo "Today's date $(date)" >> content/get-started/quickstart/hello-world.md
42+
43+
# This pipe to grep will fail if it can't find it in the curl output
44+
curl -L http://localhost:4000/get-started/quickstart/hello-world | grep "Today's date"
45+
46+
- if: ${{ failure() }}
47+
name: Debug server outputs on errors
48+
run: |
49+
echo "____STDOUT____"
50+
cat /tmp/stdout.log
51+
echo "____STDERR____"
52+
cat /tmp/stderr.log

.github/workflows/needs-sme-stale-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/stale@6f05e4244c9a0b2ed3401882b05d701dd0a7289b
21+
- uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84
2222
with:
2323
only-labels: needs SME
2424
remove-stale-when-updated: true

.github/workflows/openapi-decorate.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ jobs:
3636
3737
- name: Checkout repository code
3838
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
39+
with:
40+
# In order to fail gracefully when a branch already exists
41+
# in the "Create pull request" step, we need to be able
42+
# to get all existing branches.
43+
fetch-depth: 0
3944

4045
# Check out a nested repository inside of previous checkout
4146
- name: Checkout rest-api-description repo
@@ -85,7 +90,7 @@ jobs:
8590
branchname=openapi-update-${{ steps.rest-api-description.outputs.OPENAPI_COMMIT_SHA }}
8691
8792
branchCheckout=$(git checkout -b $branchname)
88-
if [[! $? -eq 0 ]]; then
93+
if ! [[ $? -eq 0 ]]; then
8994
echo "Branch $branchname already exists in `github/docs-internal`. Exiting..."
9095
exit 0
9196
fi

.github/workflows/orphaned-assets-check.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,12 @@ jobs:
6464
--body "Found with the find-orphaned-assets.js script" \
6565
--repo github/docs-internal \
6666
--label docs-content-fr
67+
68+
- name: Send Slack notification if workflow fails
69+
uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad
70+
if: ${{ failure() && env.FREEZE != 'true' }}
71+
with:
72+
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
73+
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
74+
color: failure
75+
text: The last "Orphaned assets check" run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions/workflows/orphaned-assets-check.yml

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/stale@6f05e4244c9a0b2ed3401882b05d701dd0a7289b
20+
- uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84
2121
with:
2222
repo-token: ${{ secrets.GITHUB_TOKEN }}
2323
stale-issue-message: 'This issue is stale because there have been no updates in 365 days.'

.github/workflows/sync-codeql-cli.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Sync CodeQl CLI
2+
3+
# **What it does**: This workflow is run manually approximately every two weeks.
4+
# When run, this workflow syncs the CodeQL CLI automated pipeline with the semmle-code
5+
# repository, and creates a pull request if there are updates.
6+
# **Why we have it**: So we can automate CodeQL CLI documentation.
7+
# **Who does it impact**: Anyone making CodeQL CLI changes in `github/semmle-code`, and wanting to get them published on the docs site.
8+
9+
on:
10+
workflow_dispatch:
11+
inputs:
12+
SOURCE_BRANCH:
13+
description: 'Branch to pull the source files from in the semmle-code repo.'
14+
type: string
15+
required: true
16+
default: 'main'
17+
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
22+
# This allows a subsequently queued workflow run to interrupt previous runs
23+
concurrency:
24+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
25+
cancel-in-progress: true
26+
27+
jobs:
28+
generate-codeql-files:
29+
if: github.repository == 'github/docs-internal'
30+
runs-on: ubuntu-latest
31+
steps:
32+
- if: ${{ env.FREEZE == 'true' }}
33+
run: |
34+
echo 'The repo is currently frozen! Exiting this workflow.'
35+
exit 1 # prevents further steps from running
36+
37+
- name: Checkout repository code
38+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
39+
40+
# Check out a nested repository inside of previous checkout
41+
- name: Checkout semmle-code repo
42+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
43+
with:
44+
# By default, only the most recent commit of the `main` branch
45+
# will be checked out
46+
token: ${{ secrets.DOCS_BOT_FR }}
47+
repository: github/semmle-code
48+
path: semmle-code
49+
ref: ${{ github.event.inputs.SOURCE_BRANCH }}
50+
51+
- uses: ./.github/actions/node-npm-setup
52+
53+
- name: Get the semmle-code SHA being synced
54+
id: semmle-code
55+
run: |
56+
cd semmle-code
57+
OPENAPI_COMMIT_SHA=$(git rev-parse HEAD)
58+
echo "OPENAPI_COMMIT_SHA=$OPENAPI_COMMIT_SHA" >> $GITHUB_OUTPUT
59+
echo "Copied files from github/semmle-code repo. Commit SHA: $OPENAPI_COMMIT_SHA"
60+
61+
- name: Install pandoc
62+
run: |
63+
# Remove all previous pandoc versions
64+
sudo apt-get purge --auto-remove pandoc
65+
# Download pandoc
66+
wget https://github.com/jgm/pandoc/releases/download/3.0.1/pandoc-3.0.1-1-amd64.deb
67+
# Install pandoc
68+
sudo dpkg -i pandoc-3.0.1-1-amd64.deb
69+
# Output the pandoc version installed
70+
pandoc -v
71+
rm pandoc-3.0.1-1-amd64.deb
72+
73+
- name: Sync the CodeQL CLI data
74+
run: |
75+
src/codeql-cli/scripts/sync.js
76+
git status
77+
echo "Deleting the cloned github/semmle-code repo..."
78+
rm -rf semmle-code
79+
80+
- name: Create pull request
81+
env:
82+
# Needed for gh
83+
GITHUB_TOKEN: ${{ secrets.DOCUBOT_REPO_PAT }}
84+
run: |
85+
# If nothing to commit, exit now. It's fine. No orphans.
86+
changes=$(git diff --name-only | wc -l)
87+
untracked=$(git status --untracked-files --short | wc -l)
88+
if [[ $changes -eq 0 ]] && [[ $untracked -eq 0 ]]; then
89+
echo "There are no changes to commit after running src/codeql/scripts/sync.js. Exiting..."
90+
exit 0
91+
fi
92+
93+
git config --global user.name "docubot"
94+
git config --global user.email "67483024+docubot@users.noreply.github.com"
95+
96+
branchname=codeql-cli-update-${{ steps.semmle-code.outputs.OPENAPI_COMMIT_SHA }}
97+
98+
branchCheckout=$(git checkout -b $branchname)
99+
if [[! $? -eq 0 ]]; then
100+
echo "Branch $branchname already exists in `github/docs-internal`. Exiting..."
101+
exit 0
102+
fi
103+
git add .
104+
git commit -m "Update CodeQL CLI data"
105+
git push origin $branchname
106+
107+
echo "Creating pull request..."
108+
gh pr create \
109+
--title "Update CodeQL CLI manual" \
110+
--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 }})
111+
112+
If CI does not pass or other problems arise, contact #docs-engineering on slack.' \
113+
--repo github/docs-internal \
114+
--label codeql-cli-pipeline
115+
116+
- name: Send Slack notification if workflow fails
117+
uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad
118+
if: ${{ failure() && env.FREEZE != 'true' }}
119+
with:
120+
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
121+
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
122+
color: failure
123+
text: The last Sync CodeQL CLI run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions/workflows/sync-codeql-cli.yml

.github/workflows/sync-search-elasticsearch.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ concurrency:
3434
env:
3535
FREEZE: ${{ secrets.FREEZE }}
3636
ELASTICSEARCH_URL: ${{ secrets.ELASTICSEARCH_URL }}
37+
# Since we'll run in NDOE_ENV=production, we need to be explicit that
38+
# we don't want Hydro configured.
39+
HYDRO_ENDPOINT: ''
40+
HYDRO_SECRET: ''
3741

3842
jobs:
3943
figureOutMatrix:

0 commit comments

Comments
 (0)