Skip to content

Commit 6b78e25

Browse files
Merge branch 'production' into patricia/pcx15685-managed-rulesets-flagged-traffic
2 parents e0c647f + d614346 commit 6b78e25

File tree

786 files changed

+12693
-5432
lines changed

Some content is hidden

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

786 files changed

+12693
-5432
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# AI
1919

20-
/src/content/docs/agents/ @irvinebroque @rita3ko @elithrar @thomasgauvin @threepointone @kodster28 @KianNH
20+
/src/content/docs/agents/ @irvinebroque @rita3ko @elithrar @thomasgauvin @threepointone @harshil1712 @megaconfidence @cloudflare/pcx-technical-writing
2121
/src/content/docs/ai-gateway/ @kathayl @G4brym @mchenco @daisyfaithauma @cloudflare/pcx-technical-writing
2222
/src/content/docs/workers-ai/ @rita3ko @craigsdennis @markdembo @mchenco @daisyfaithauma @cloudflare/pcx-technical-writing
2323
/src/content/docs/vectorize/ @elithrar @vy-ton @sejoker @mchenco @cloudflare/pcx-technical-writing
@@ -47,6 +47,7 @@
4747

4848
/src/content/changelog/ @cloudflare/pm-changelogs
4949
/src/assets/images/changelog/ @cloudflare/pm-changelogs
50+
/src/assets/images/ @cloudflare/pm-changelogs @cloudflare/pcx-technical-writing
5051

5152
# Cloudflare One
5253

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,10 @@ jobs:
5757

5858
- name: Tests
5959
run: npm run test
60+
61+
- name: Post PR CI failure comment
62+
if: always()
63+
continue-on-error: true
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
run: npx tsx bin/post-pr-ci-failure-comment/index.ts

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
GH_REPO: ${{ github.repository }}
3737
NUMBER: ${{ github.event.pull_request.number }}
3838
- name: Internal comment
39-
run: gh pr comment "$NUMBER" --body "Howdy and thanks for contributing to our repo. We review internal PRs with **1 week**. If it's something urgent or has been sitting without a comment, start a thread in the *Developer Docs* space internally."
39+
run: gh pr comment "$NUMBER" --body "Howdy and thanks for contributing to our repo. We review internal PRs within **1 week**. If it's something urgent or has been sitting without a comment, start a thread in the *Developer Docs* space internally."
4040
if: steps.check_if_contributor_is_external.outputs.is_external == 'false'
4141
env:
4242
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish-preview.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ concurrency:
99

1010
jobs:
1111
publish:
12+
if: github.repository == 'cloudflare/cloudflare-docs'
1213
runs-on: ubuntu-22.04
1314
permissions:
1415
contents: read

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v22.9.0

astro.config.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import starlightLinksValidator from "starlight-links-validator";
88
import icon from "astro-icon";
99
import sitemap from "@astrojs/sitemap";
1010
import react from "@astrojs/react";
11+
1112
import { readdir } from "fs/promises";
13+
import { fileURLToPath } from "url";
1214

1315
import rehypeTitleFigure from "rehype-title-figure";
1416
import rehypeMermaid from "./src/plugins/rehype/mermaid.ts";
1517
import rehypeAutolinkHeadings from "./src/plugins/rehype/autolink-headings.ts";
1618
import rehypeExternalLinks from "./src/plugins/rehype/external-links.ts";
1719
import rehypeHeadingSlugs from "./src/plugins/rehype/heading-slugs.ts";
18-
import { fileURLToPath } from "url";
1920

2021
async function autogenSections() {
2122
const sections = (
@@ -36,7 +37,21 @@ async function autogenSections() {
3637
});
3738
}
3839

40+
async function autogenStyles() {
41+
const styles = (
42+
await readdir("./src/styles/", {
43+
withFileTypes: true,
44+
recursive: true,
45+
})
46+
)
47+
.filter((x) => x.isFile())
48+
.map((x) => x.parentPath + x.name);
49+
50+
return styles;
51+
}
52+
3953
const sidebar = await autogenSections();
54+
const customCss = await autogenStyles();
4055

4156
const runLinkCheck = process.env.RUN_LINK_CHECK || false;
4257

@@ -96,18 +111,7 @@ export default defineConfig({
96111
TableOfContents: "./src/components/overrides/TableOfContents.astro",
97112
},
98113
sidebar,
99-
customCss: [
100-
"./src/asides.css",
101-
"./src/badges.css",
102-
"./src/code.css",
103-
"./src/footnotes.css",
104-
"./src/headings.css",
105-
"./src/input.css",
106-
"./src/mermaid.css",
107-
"./src/table.css",
108-
"./src/tailwind.css",
109-
"./src/title.css",
110-
],
114+
customCss,
111115
pagination: false,
112116
plugins: [
113117
...(runLinkCheck
@@ -145,9 +149,7 @@ export default defineConfig({
145149
tailwind({
146150
applyBaseStyles: false,
147151
}),
148-
liveCode({
149-
layout: "~/components/live-code/Layout.astro",
150-
}),
152+
liveCode({}),
151153
icon(),
152154
sitemap({
153155
filter(page) {

bin/fetch-warp-releases.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ import fs from "fs";
22
import YAML from "yaml";
33
import { marked } from "marked";
44

5-
const tracks = ["windows/ga", "windows/beta", "macos/ga", "macos/beta"];
5+
const tracks = [
6+
"windows/ga",
7+
"windows/beta",
8+
"macos/ga",
9+
"macos/beta",
10+
"noble-intel/ga",
11+
"noble-intel/beta",
12+
];
613

714
const linesToRemove = [
815
"For related Cloudflare for Teams documentation please see: https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp",
@@ -11,11 +18,23 @@ const linesToRemove = [
1118
"For Consumer documentation please see: https://developers.cloudflare.com/warp-client/",
1219
];
1320

14-
for (const track of tracks) {
21+
for (let track of tracks) {
1522
fetch(`https://downloads.cloudflareclient.com/v1/update/json/${track}`)
1623
.then((res) => res.json())
1724
.then((data) => {
25+
if (!data.items) {
26+
console.warn(
27+
`${track} has no releases: ${JSON.stringify(data, null, 2)}`,
28+
);
29+
30+
return;
31+
}
32+
1833
data.items.forEach((item) => {
34+
if (track.startsWith("noble-intel")) {
35+
track = track.replace("noble-intel", "linux");
36+
}
37+
1938
const path = `./src/content/warp-releases/${track}/${item.version}.yaml`;
2039

2140
if (fs.existsSync(path)) {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const GITHUB_ACTIONS_BOT_ID = 41898282;
2+
export const DOCS_BASE_URL = "https://developers.cloudflare.com";
3+
export const CONTENT_BASE_PATH = "src/content";
4+
export const PREVIEW_URL_REGEX = /^\*\*Preview URL:\*\* (.*)$/m;
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import * as core from "@actions/core";
2+
import * as github from "@actions/github";
3+
import type { PullRequestEvent } from "@octokit/webhooks-types";
4+
5+
import { GITHUB_ACTIONS_BOT_ID } from "./constants";
6+
7+
async function run(): Promise<void> {
8+
try {
9+
if (!process.env.GITHUB_TOKEN) {
10+
core.setFailed(`Could not find GITHUB_TOKEN in env`);
11+
process.exit();
12+
}
13+
14+
const octokit = github.getOctokit(process.env.GITHUB_TOKEN);
15+
const payload = github.context.payload as PullRequestEvent;
16+
17+
const { owner, repo } = github.context.repo;
18+
const pullRequestNumber = payload.number;
19+
const runId = github.context.runId;
20+
21+
const { data: run } = await octokit.rest.actions.listJobsForWorkflowRun({
22+
owner,
23+
repo,
24+
run_id: runId,
25+
});
26+
27+
const job = run.jobs.findLast((job) => job.name === "Compiles");
28+
29+
if (!job) {
30+
core.setFailed(`Could not find a job called 'Compiles'`);
31+
process.exit();
32+
}
33+
34+
const failedStep = job.steps?.find((step) => step.conclusion === "failure");
35+
36+
if (failedStep) {
37+
core.info(`Found failed step ${failedStep.name}`);
38+
}
39+
40+
const conclusion = failedStep ? "failure" : "success";
41+
42+
const { data: comments } = await octokit.rest.issues.listComments({
43+
owner,
44+
repo,
45+
issue_number: pullRequestNumber,
46+
per_page: 100,
47+
});
48+
49+
const existingComment = comments.find(
50+
(comment) =>
51+
comment.user?.id === GITHUB_ACTIONS_BOT_ID &&
52+
comment.body?.includes("**CI run failed:**"),
53+
);
54+
55+
if (existingComment) {
56+
core.info(`Found existing comment with ID ${existingComment.id}`);
57+
} else {
58+
core.info(`No existing comment found`);
59+
}
60+
61+
const url = `https://github.com/${owner}/${repo}/actions/runs/${runId}/job/${job.id}`;
62+
const comment = `**CI run failed:** [build logs](${url})`;
63+
64+
if (conclusion === "failure") {
65+
if (existingComment) {
66+
core.info(
67+
`Updating ${existingComment.id} with ${JSON.stringify(comment)}`,
68+
);
69+
await octokit.rest.issues.updateComment({
70+
owner,
71+
repo,
72+
comment_id: existingComment.id,
73+
body: comment,
74+
});
75+
} else {
76+
core.info(`Creating new comment with ${JSON.stringify(comment)}`);
77+
await octokit.rest.issues.createComment({
78+
owner,
79+
repo,
80+
issue_number: pullRequestNumber,
81+
body: comment,
82+
});
83+
}
84+
} else if (conclusion === "success" && existingComment) {
85+
core.info(`Removing ${existingComment.id}`);
86+
await octokit.rest.issues.deleteComment({
87+
owner,
88+
repo,
89+
issue_number: pullRequestNumber,
90+
comment_id: existingComment.id,
91+
});
92+
}
93+
} catch (error) {
94+
if (error instanceof Error) {
95+
core.setFailed(error.message);
96+
}
97+
process.exit();
98+
}
99+
}
100+
101+
run();

0 commit comments

Comments
 (0)