Skip to content

Commit 82adbcd

Browse files
committed
Merge commit '1bde00eee0dbfaf125f6bf28334f50ce4864cc5b' into do-websocket-examples
2 parents d6cf904 + 1bde00e commit 82adbcd

File tree

6,773 files changed

+319306
-234995
lines changed

Some content is hidden

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

6,773 files changed

+319306
-234995
lines changed

.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@
44
*.html text eol=lf
55
*.ini text eol=lf
66
*.js text eol=lf
7+
*.jsx text eol=lf
78
*.json text eol=lf
89
*.md text eol=lf
910
*.mdx text eol=lf
1011
*.mjs text eol=lf
1112
*.svg text eol=lf
1213
*.toml text eol=lf
1314
*.ts text eol=lf
15+
*.tsx text eol=lf
1416
*.txt text eol=lf
1517
*.vue text eol=lf
1618
*.xml text eol=lf
1719
*.yaml text eol=lf
1820
*.yml text eol=lf
19-
_redirects text eol=lf
21+
__redirects text eol=lf
2022
.editorconfig text eol=lf
2123
.gitattributes text eol=lf
2224
.prettierignore text eol=lf

.github/CODEOWNERS

Lines changed: 103 additions & 90 deletions
Large diffs are not rendered by default.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ contact_links:
44
url: https://developers.cloudflare.com/support/contacting-cloudflare-support/#methods-of-contacting-cloudflare-support
55
about: If you need support with your website or Cloudflare applications, please contact Cloudflare through the relevant support channel.
66
- name: Issue with Cloudflare 5XX errors
7-
url: https://developers.cloudflare.com/support/troubleshooting/cloudflare-errors/troubleshooting-cloudflare-5xx-errors/#troubleshooting-cloudflare-5xx-errors--cloudflare-help-center
7+
url: https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/
88
about: If you are encountering a Cloudflare 5XX error, please read our troubleshooting documentation for 5XX errors.
9+
- name: Issue with Workers AI
10+
url: https://discord.com/channels/595317990191398933/1105477009964027914
11+
about: Issues relating to Workers AI models should be raised in our Developer Discord.
912
- name: Issue with Cloudflare Workers
1013
url: https://github.com/cloudflare/workers-sdk/issues/new/choose
1114
about: Issues relating to Cloudflare Workers should be made in the workers-sdk repo.

.github/actions/assign-issue/index.ts

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

.github/actions/assign-issue/package.json

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
// NOTE: This is the source file!
2+
// ~> Run `npm run build` to produce `index.js`
3+
4+
import * as core from "@actions/core";
5+
import * as github from "@actions/github";
6+
import * as codeOwnersUtils from "codeowners-utils";
7+
8+
// This pulls assignment logic from our codeowners file
9+
10+
(async function () {
11+
try {
12+
const token = core.getInput("GITHUB_TOKEN", { required: true });
13+
14+
const payload = github.context.payload;
15+
16+
const { action, repository, issue } = payload;
17+
if (!issue) throw new Error('Missing "issue" object!');
18+
if (!repository) throw new Error('Missing "repository" object!');
19+
if (action !== "opened") throw new Error('Must be "issues.opened" event!');
20+
21+
// stop here if "engineering" issue
22+
const labels: string[] = (issue.labels || []).map((x) => x.name);
23+
if (labels.includes("engineering"))
24+
return console.log('ignore "engineering" issues');
25+
26+
// continue for other assignments
27+
let cwd = process.cwd();
28+
let codeowners = await codeOwnersUtils.loadOwners(cwd);
29+
const assignees = new Set<string>();
30+
const content = issue.body;
31+
if (!content) throw new Error('Missing "issue.body" content!');
32+
if (!issue.number) throw new Error('Missing "issue.number" value!');
33+
34+
const regex = /https?:\/\/developers\.cloudflare\.com([^\s|)]*)/gm;
35+
let links = [];
36+
let m;
37+
38+
while ((m = regex.exec(content)) !== null) {
39+
// This is necessary to avoid infinite loops with zero-width matches
40+
if (m.index === regex.lastIndex) {
41+
regex.lastIndex++;
42+
}
43+
44+
// The result can be accessed through the `m`-variable.
45+
m.forEach((match, groupIndex) => {
46+
if (groupIndex === 1) {
47+
links.push(match);
48+
}
49+
});
50+
}
51+
52+
console.log("Links are:");
53+
console.log(links);
54+
55+
for (const item of links) {
56+
const updatedLink = "src/content/docs".concat(item);
57+
console.log("Updated link is:");
58+
console.log(updatedLink);
59+
const match = codeOwnersUtils.matchFile(updatedLink, codeowners);
60+
for (const owner of match.owners) {
61+
if (!owner.includes("/")) {
62+
assignees.add(owner.replace(/^@/, ""));
63+
}
64+
}
65+
}
66+
console.log("Assignees are:");
67+
console.log(assignees);
68+
69+
if (assignees.size === 0) {
70+
// assign folks which will manually reassign
71+
["haleycode", "pedrosousa", "dcpena", "patriciasantaana"].forEach(
72+
(username) => assignees.add(username),
73+
);
74+
}
75+
76+
const client = github.getOctokit(token);
77+
78+
await client.rest.issues.addAssignees({
79+
owner: repository.owner.login,
80+
issue_number: issue.number,
81+
repo: repository.name,
82+
assignees: [...assignees],
83+
});
84+
85+
console.log("Assignees added (if present)");
86+
87+
// Add "product" labels
88+
89+
const labelPrefix = "product:";
90+
const newLabels = new Set<string>();
91+
92+
for (const link of links) {
93+
const parts = link.split("/");
94+
if (parts[1] !== undefined) {
95+
newLabels.add(labelPrefix.concat(parts[1]));
96+
}
97+
}
98+
99+
console.log(newLabels);
100+
101+
if (newLabels.size > 0) {
102+
await client.rest.issues.addLabels({
103+
owner: repository.owner.login,
104+
issue_number: issue.number,
105+
repo: repository.name,
106+
labels: [...newLabels],
107+
});
108+
}
109+
110+
console.log("Labels added");
111+
112+
console.log("DONE~!");
113+
} catch (error) {
114+
core.setFailed(error.message);
115+
}
116+
})();

.github/actions/assign-issue/package-lock.json renamed to .github/actions/issue-label-assign/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"private": true,
3+
"version": "0.0.0",
4+
"name": "issue-label-assign",
5+
"scripts": {
6+
"build": "esbuild index.ts --bundle --format=cjs --platform=node --minify --outfile=index.js"
7+
},
8+
"devDependencies": {
9+
"@actions/core": "1.9.1",
10+
"@actions/github": "5.0.3",
11+
"esbuild": "0.14.39"
12+
},
13+
"dependencies": {
14+
"codeowners-utils": "^1.0.2"
15+
}
16+
}

0 commit comments

Comments
 (0)