ci: Fix issue response script (#24891)

This PR fixes the issue response script.

There were a number of things preventing it from working:

- The directory name used in the GitHub Action did not match the one on
disk.
  - The script has been moved accordingly
- `ts-node` does not support ESM.
- `ts-node` seems unmaintained, so I changed the script to be plain JS
that is type-checked with TypeScript.
- The data being sent to the Slack API was invalid:
- Each section block can only have a maximum of 3000 characters in the
`text` field, so we need to break up the issue list across multiple
sections.
- We needed to escape `&`, `<`, and `>` characters in the issue titles.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-02-14 14:37:33 -05:00 committed by GitHub
parent de020af6ef
commit fc85ca0101
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 241 additions and 293 deletions

View file

@ -27,7 +27,7 @@ jobs:
- run: pnpm install --dir script/issue_response
- name: Run Issue Response
run: pnpm exec ts-node script/issue_response/main.ts
run: pnpm run --dir script/issue_response start
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_ISSUE_RESPONSE_WEBHOOK_URL: ${{ secrets.SLACK_ISSUE_RESPONSE_WEBHOOK_URL }}

View file

@ -0,0 +1,99 @@
import { Octokit } from "@octokit/rest";
import { IncomingWebhook } from "@slack/webhook";
/**
* The maximum length of the `text` in a section block.
*
* [Slack Docs](https://api.slack.com/reference/block-kit/blocks#section)
*/
const SECTION_BLOCK_TEXT_LIMIT = 3000;
async function main() {
const octokit = new Octokit({ auth: process.env["GITHUB_TOKEN"] });
if (!process.env["SLACK_ISSUE_RESPONSE_WEBHOOK_URL"]) {
throw new Error("SLACK_ISSUE_RESPONSE_WEBHOOK_URL is not set");
}
const webhook = new IncomingWebhook(
process.env["SLACK_ISSUE_RESPONSE_WEBHOOK_URL"],
);
const owner = "zed-industries";
const repo = "zed";
const staff = await octokit.paginate(octokit.rest.orgs.listMembers, {
org: owner,
per_page: 100,
});
let staffHandles = staff.map((member) => member.login);
let commenterFilters = staffHandles.map((name) => `-commenter:${name}`);
let authorFilters = staffHandles.map((name) => `-author:${name}`);
const q = [
`repo:${owner}/${repo}`,
"is:issue",
"state:open",
"created:>=2025-02-01",
"sort:created-asc",
...commenterFilters,
...authorFilters,
];
const response = await octokit.rest.search.issuesAndPullRequests({
q: q.join("+"),
per_page: 100,
});
let issues = response.data.items;
let issueLines = issues.map((issue, index) => {
const formattedDate = new Date(issue.created_at).toLocaleDateString(
"en-US",
{
year: "numeric",
month: "short",
day: "numeric",
},
);
const sanitizedTitle = issue.title
.replaceAll("&", "&amp;")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;");
return `${index + 1}. ${formattedDate}: <${issue.html_url}|${sanitizedTitle}>\n`;
});
const sections = [];
/** @type {string[]} */
let currentSection = [];
let currentSectionLength = 0;
for (const issueLine of issueLines) {
if (currentSectionLength + issueLine.length <= SECTION_BLOCK_TEXT_LIMIT) {
currentSection.push(issueLine);
currentSectionLength += issueLine.length;
} else {
sections.push(currentSection);
currentSection = [];
currentSectionLength = 0;
}
}
if (currentSection.length > 0) {
sections.push(currentSection);
}
const blocks = sections.map((section) => ({
type: "section",
text: {
type: "mrkdwn",
text: section.join("").trimEnd(),
},
}));
await webhook.send({ blocks });
}
main().catch((error) => {
console.error("An error occurred:", error);
process.exit(1);
});

View file

@ -0,0 +1,24 @@
{
"name": "issue_response",
"version": "1.0.0",
"private": true,
"main": "main.js",
"type": "module",
"scripts": {
"build": "tsc -p .",
"start": "node main.js"
},
"dependencies": {
"@octokit/rest": "^21.1.0",
"@slack/webhook": "^7.0.4",
"date-fns": "^4.1.0",
"octokit": "^4.1.1"
},
"devDependencies": {
"@octokit/types": "^13.8.0",
"@slack/types": "^2.14.0",
"@tsconfig/node20": "20.1.4",
"@tsconfig/strictest": "2.0.5",
"typescript": "5.7.3"
}
}

View file

@ -18,8 +18,8 @@ importers:
specifier: ^4.1.0
version: 4.1.0
octokit:
specifier: ^4.1.0
version: 4.1.0
specifier: ^4.1.1
version: 4.1.1
devDependencies:
'@octokit/types':
specifier: ^13.8.0
@ -27,28 +27,20 @@ importers:
'@slack/types':
specifier: ^2.14.0
version: 2.14.0
ts-node:
specifier: ^10.9.2
version: 10.9.2(@types/node@22.13.1)(typescript@5.7.3)
'@tsconfig/node20':
specifier: 20.1.4
version: 20.1.4
'@tsconfig/strictest':
specifier: 2.0.5
version: 2.0.5
typescript:
specifier: 5.7.3
version: 5.7.3
packages:
'@cspotcode/source-map-support@0.8.1':
resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}
engines: {node: '>=12'}
'@jridgewell/resolve-uri@3.1.2':
resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
engines: {node: '>=6.0.0'}
'@jridgewell/sourcemap-codec@1.5.0':
resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==}
'@jridgewell/trace-mapping@0.3.9':
resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==}
'@octokit/app@15.1.2':
resolution: {integrity: sha512-6aKmKvqnJKoVK+kx0mLlBMKmQYoziPw4Rd/PWr0j65QVQlrDXlu6hGU8fmTXt7tNkf/DsubdIaTT4fkoWzCh5g==}
'@octokit/app@15.1.3':
resolution: {integrity: sha512-injaSv2CN8wZrhhnVky3HcQVEy4rRoIAm+OeCwNQzgQJn1OTglfT7RyMDaCbkiNWXDR0tkWLkWMv4duTTj765g==}
engines: {node: '>= 18'}
'@octokit/auth-app@7.1.4':
@ -59,8 +51,8 @@ packages:
resolution: {integrity: sha512-3woNZgq5/S6RS+9ZTq+JdymxVr7E0s4EYxF20ugQvgX3pomdPUL5r/XdTY9wALoBM2eHVy4ettr5fKpatyTyHw==}
engines: {node: '>= 18'}
'@octokit/auth-oauth-device@7.1.2':
resolution: {integrity: sha512-gTOIzDeV36OhVfxCl69FmvJix7tJIiU6dlxuzLVAzle7fYfO8UDyddr9B+o4CFQVaMBLMGZ9ak2CWMYcGeZnPw==}
'@octokit/auth-oauth-device@7.1.3':
resolution: {integrity: sha512-BECO/N4B/Uikj0w3GCvjf/odMujtYTP3q82BJSjxC2J3rxTEiZIJ+z2xnRlDb0IE9dQSaTgRqUPVOieSbFcVzg==}
engines: {node: '>= 18'}
'@octokit/auth-oauth-user@5.1.2':
@ -75,12 +67,12 @@ packages:
resolution: {integrity: sha512-bGXqdN6RhSFHvpPq46SL8sN+F3odQ6oMNLWc875IgoqcC3qus+fOL2th6Tkl94wvdSTy8/OeHzWy/lZebmnhog==}
engines: {node: '>= 18'}
'@octokit/core@6.1.3':
resolution: {integrity: sha512-z+j7DixNnfpdToYsOutStDgeRzJSMnbj8T1C/oQjB6Aa+kRfNjs/Fn7W6c8bmlt6mfy3FkgeKBRnDjxQow5dow==}
'@octokit/core@6.1.4':
resolution: {integrity: sha512-lAS9k7d6I0MPN+gb9bKDt7X8SdxknYqAMh44S5L+lNqIN2NuV8nvv3g8rPp7MuRxcOpxpUIATWprO0C34a8Qmg==}
engines: {node: '>= 18'}
'@octokit/endpoint@10.1.2':
resolution: {integrity: sha512-XybpFv9Ms4hX5OCHMZqyODYqGTZ3H6K6Vva+M9LR7ib/xr1y1ZnlChYv9H680y77Vd/i/k+thXApeRASBQkzhA==}
'@octokit/endpoint@10.1.3':
resolution: {integrity: sha512-nBRBMpKPhQUxCsQQeW+rCJ/OPSMcj3g0nfHn01zGYZXuNDvvXudF/TYY6APj5THlurerpFN4a/dQAIAaM6BYhA==}
engines: {node: '>= 18'}
'@octokit/graphql@8.2.0':
@ -95,15 +87,15 @@ packages:
resolution: {integrity: sha512-ooXV8GBSabSWyhLUowlMIVd9l1s2nsOGQdlP2SQ4LnkEsGXzeCvbSbCPdZThXhEFzleGPwbapT0Sb+YhXRyjCA==}
engines: {node: '>= 18'}
'@octokit/oauth-methods@5.1.3':
resolution: {integrity: sha512-M+bDBi5H8FnH0xhCTg0m9hvcnppdDnxUqbZyOkxlLblKpLAR+eT2nbDPvJDp0eLrvJWA1I8OX0KHf/sBMQARRA==}
'@octokit/oauth-methods@5.1.4':
resolution: {integrity: sha512-Jc/ycnePClOvO1WL7tlC+TRxOFtyJBGuTDsL4dzXNiVZvzZdrPuNw7zHI3qJSUX2n6RLXE5L0SkFmYyNaVUFoQ==}
engines: {node: '>= 18'}
'@octokit/openapi-types@23.0.1':
resolution: {integrity: sha512-izFjMJ1sir0jn0ldEKhZ7xegCTj/ObmEDlEfpFrx4k/JyZSMRHbO3/rBwgE7f3m2DHt+RrNGIVw4wSmwnm3t/g==}
'@octokit/openapi-webhooks-types@8.5.1':
resolution: {integrity: sha512-i3h1b5zpGSB39ffBbYdSGuAd0NhBAwPyA3QV3LYi/lx4lsbZiu7u2UHgXVUR6EpvOI8REOuVh1DZTRfHoJDvuQ==}
'@octokit/openapi-webhooks-types@9.1.0':
resolution: {integrity: sha512-bO1D2jLdU8qEvqmbWjNxJzDYSFT4wesiYKIKP6f4LaM0XUGtn/0LBv/20hu9YqcnpdX38X5o/xANTMtIAqdwYw==}
'@octokit/plugin-paginate-graphql@5.2.4':
resolution: {integrity: sha512-pLZES1jWaOynXKHOqdnwZ5ULeVR6tVVCMm+AUbp0htdcyXDU95WbkYdU4R2ej1wKj5Tu94Mee2Ne0PjPO9cCyA==}
@ -111,8 +103,8 @@ packages:
peerDependencies:
'@octokit/core': '>=6'
'@octokit/plugin-paginate-rest@11.4.0':
resolution: {integrity: sha512-ttpGck5AYWkwMkMazNCZMqxKqIq1fJBNxBfsFwwfyYKTf914jKkLF0POMS3YkPBwp5g1c2Y4L79gDz01GhSr1g==}
'@octokit/plugin-paginate-rest@11.4.2':
resolution: {integrity: sha512-BXJ7XPCTDXFF+wxcg/zscfgw2O/iDPtNSkwwR1W1W5c4Mb3zav/M2XvxQ23nVmKj7jpweB4g8viMeCQdm7LMVA==}
engines: {node: '>= 18'}
peerDependencies:
'@octokit/core': '>=6'
@ -123,8 +115,8 @@ packages:
peerDependencies:
'@octokit/core': '>=6'
'@octokit/plugin-rest-endpoint-methods@13.3.0':
resolution: {integrity: sha512-LUm44shlmkp/6VC+qQgHl3W5vzUP99ZM54zH6BuqkJK4DqfFLhegANd+fM4YRLapTvPm4049iG7F3haANKMYvQ==}
'@octokit/plugin-rest-endpoint-methods@13.3.1':
resolution: {integrity: sha512-o8uOBdsyR+WR8MK9Cco8dCgvG13H1RlM1nWnK/W7TEACQBFux/vPREgKucxUfuDQ5yi1T3hGf4C5ZmZXAERgwQ==}
engines: {node: '>= 18'}
peerDependencies:
'@octokit/core': '>=6'
@ -141,12 +133,12 @@ packages:
peerDependencies:
'@octokit/core': ^6.1.3
'@octokit/request-error@6.1.6':
resolution: {integrity: sha512-pqnVKYo/at0NuOjinrgcQYpEbv4snvP3bKMRqHaD9kIsk9u1LCpb2smHZi8/qJfgeNqLo5hNW4Z7FezNdEo0xg==}
'@octokit/request-error@6.1.7':
resolution: {integrity: sha512-69NIppAwaauwZv6aOzb+VVLwt+0havz9GT5YplkeJv7fG7a40qpLt/yZKyiDxAhgz0EtgNdNcb96Z0u+Zyuy2g==}
engines: {node: '>= 18'}
'@octokit/request@9.2.0':
resolution: {integrity: sha512-kXLfcxhC4ozCnAXy2ff+cSxpcF0A1UqxjvYMqNuPIeOAzJbVWQ+dy5G2fTylofB/gTbObT8O6JORab+5XtA1Kw==}
'@octokit/request@9.2.1':
resolution: {integrity: sha512-TqHLIdw1KFvx8WvLc7Jv94r3C3+AzKY2FWq7c20zvrxmCIa6MCVkLCE/826NCXnml3LFJjLsidDh1BhMaGEDQw==}
engines: {node: '>= 18'}
'@octokit/rest@21.1.0':
@ -156,12 +148,12 @@ packages:
'@octokit/types@13.8.0':
resolution: {integrity: sha512-x7DjTIbEpEWXK99DMd01QfWy0hd5h4EN+Q7shkdKds3otGQP+oWE/y0A76i1OvH9fygo4ddvNf7ZvF0t78P98A==}
'@octokit/webhooks-methods@5.1.0':
resolution: {integrity: sha512-yFZa3UH11VIxYnnoOYCVoJ3q4ChuSOk2IVBBQ0O3xtKX4x9bmKb/1t+Mxixv2iUhzMdOl1qeWJqEhouXXzB3rQ==}
'@octokit/webhooks-methods@5.1.1':
resolution: {integrity: sha512-NGlEHZDseJTCj8TMMFehzwa9g7On4KJMPVHDSrHxCQumL6uSQR8wIkP/qesv52fXqV1BPf4pTxwtS31ldAt9Xg==}
engines: {node: '>= 18'}
'@octokit/webhooks@13.5.0':
resolution: {integrity: sha512-uSO/TCCfi9vaZHOBsGWsRNBXYYKtLnSDbHI+std0M80AaEd7AnVfLqvk+9V3GP1faPcOx06ADx+h8UWwvemIGw==}
'@octokit/webhooks@13.6.0':
resolution: {integrity: sha512-qoYP1g6ZP01m8LtKjC+NLuAqRbiVzS5VmnwoEYlrQr6TaLRtb5yAMxWCq5/AqfrUF2Wx6ZQ9IJ4mAFytEn7J9A==}
engines: {node: '>= 18'}
'@slack/types@2.14.0':
@ -172,35 +164,17 @@ packages:
resolution: {integrity: sha512-JDJte2dbJCcq1/GCMBYJH6fj+YS4n5GuPjT4tF3O1NPN6pFPCR9yA/apRh9sdfhdFG7hadiRgmiQqC4GLgNkZg==}
engines: {node: '>= 18', npm: '>= 8.6.0'}
'@tsconfig/node10@1.0.11':
resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==}
'@tsconfig/node20@20.1.4':
resolution: {integrity: sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg==}
'@tsconfig/node12@1.0.11':
resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==}
'@tsconfig/node14@1.0.3':
resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==}
'@tsconfig/node16@1.0.4':
resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==}
'@tsconfig/strictest@2.0.5':
resolution: {integrity: sha512-ec4tjL2Rr0pkZ5hww65c+EEPYwxOi4Ryv+0MtjeaSQRJyq322Q27eOQiFbuNgw2hpL4hB1/W/HBGk3VKS43osg==}
'@types/aws-lambda@8.10.147':
resolution: {integrity: sha512-nD0Z9fNIZcxYX5Mai2CTmFD7wX7UldCkW2ezCF8D1T5hdiLsnTWDGRpfRYntU6VjTdLQjOvyszru7I1c1oCQew==}
'@types/node@22.13.1':
resolution: {integrity: sha512-jK8uzQlrvXqEU91UxiK5J7pKHyzgnI1Qnl0QDHIgVGuolJhRb9EEl28Cj9b3rGR8B2lhFCtvIm5os8lFnO/1Ew==}
acorn-walk@8.3.4:
resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==}
engines: {node: '>=0.4.0'}
acorn@8.14.0:
resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==}
engines: {node: '>=0.4.0'}
hasBin: true
arg@4.1.3:
resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==}
'@types/node@22.13.4':
resolution: {integrity: sha512-ywP2X0DYtX3y08eFVx5fNIw7/uIv8hYUKgXoK8oayJlLnKcRfEYCxWMVE1XagUdVtCJlZT1AU4LXEABW+L1Peg==}
asynckit@0.4.0:
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
@ -218,9 +192,6 @@ packages:
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
engines: {node: '>= 0.8'}
create-require@1.1.1:
resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==}
date-fns@4.1.0:
resolution: {integrity: sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==}
@ -228,10 +199,6 @@ packages:
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
engines: {node: '>=0.4.0'}
diff@4.0.2:
resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
engines: {node: '>=0.3.1'}
fast-content-type-parse@2.0.1:
resolution: {integrity: sha512-nGqtvLrj5w0naR6tDPfB4cUmYCqouzyQiz6C5y/LtcDllJdrcc6WaWW6iXyIIOErTa/XRybj28aasdn4LkVk6Q==}
@ -248,9 +215,6 @@ packages:
resolution: {integrity: sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==}
engines: {node: '>= 6'}
make-error@1.3.6:
resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==}
mime-db@1.52.0:
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
engines: {node: '>= 0.6'}
@ -259,8 +223,8 @@ packages:
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
engines: {node: '>= 0.6'}
octokit@4.1.0:
resolution: {integrity: sha512-/UrQAOSvkc+lUUWKNzy4ByAgYU9KpFzZQt8DnC962YmQuDiZb1SNJ90YukCCK5aMzKqqCA+z1kkAlmzYvdYKag==}
octokit@4.1.1:
resolution: {integrity: sha512-GMjkrTnGk2PB9MKnK5SVDj4wSrnVX39vldKvYIC3MVNDQY1nZ6ufPrGCUFsQ645q5q+PG+CHUWRB6ZH8MBcyFg==}
engines: {node: '>= 18'}
proxy-from-env@1.1.0:
@ -270,20 +234,6 @@ packages:
resolution: {integrity: sha512-/m8M+2BJUpoJdgAHoG+baCwBT+tf2VraSfkBgl0Y00qIWt41DJ8R5B8nsEw0I58YwF5IZH6z24/2TobDKnqSWw==}
engines: {node: '>=12'}
ts-node@10.9.2:
resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==}
hasBin: true
peerDependencies:
'@swc/core': '>=1.2.50'
'@swc/wasm': '>=1.2.50'
'@types/node': '*'
typescript: '>=2.7'
peerDependenciesMeta:
'@swc/core':
optional: true
'@swc/wasm':
optional: true
typescript@5.7.3:
resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==}
engines: {node: '>=14.17'}
@ -298,44 +248,24 @@ packages:
universal-user-agent@7.0.2:
resolution: {integrity: sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==}
v8-compile-cache-lib@3.0.1:
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
yn@3.1.1:
resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}
engines: {node: '>=6'}
snapshots:
'@cspotcode/source-map-support@0.8.1':
dependencies:
'@jridgewell/trace-mapping': 0.3.9
'@jridgewell/resolve-uri@3.1.2': {}
'@jridgewell/sourcemap-codec@1.5.0': {}
'@jridgewell/trace-mapping@0.3.9':
dependencies:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.0
'@octokit/app@15.1.2':
'@octokit/app@15.1.3':
dependencies:
'@octokit/auth-app': 7.1.4
'@octokit/auth-unauthenticated': 6.1.1
'@octokit/core': 6.1.3
'@octokit/core': 6.1.4
'@octokit/oauth-app': 7.1.5
'@octokit/plugin-paginate-rest': 11.4.0(@octokit/core@6.1.3)
'@octokit/plugin-paginate-rest': 11.4.2(@octokit/core@6.1.4)
'@octokit/types': 13.8.0
'@octokit/webhooks': 13.5.0
'@octokit/webhooks': 13.6.0
'@octokit/auth-app@7.1.4':
dependencies:
'@octokit/auth-oauth-app': 8.1.2
'@octokit/auth-oauth-user': 5.1.2
'@octokit/request': 9.2.0
'@octokit/request-error': 6.1.6
'@octokit/request': 9.2.1
'@octokit/request-error': 6.1.7
'@octokit/types': 13.8.0
toad-cache: 3.7.0
universal-github-app-jwt: 2.2.0
@ -343,24 +273,24 @@ snapshots:
'@octokit/auth-oauth-app@8.1.2':
dependencies:
'@octokit/auth-oauth-device': 7.1.2
'@octokit/auth-oauth-device': 7.1.3
'@octokit/auth-oauth-user': 5.1.2
'@octokit/request': 9.2.0
'@octokit/request': 9.2.1
'@octokit/types': 13.8.0
universal-user-agent: 7.0.2
'@octokit/auth-oauth-device@7.1.2':
'@octokit/auth-oauth-device@7.1.3':
dependencies:
'@octokit/oauth-methods': 5.1.3
'@octokit/request': 9.2.0
'@octokit/oauth-methods': 5.1.4
'@octokit/request': 9.2.1
'@octokit/types': 13.8.0
universal-user-agent: 7.0.2
'@octokit/auth-oauth-user@5.1.2':
dependencies:
'@octokit/auth-oauth-device': 7.1.2
'@octokit/oauth-methods': 5.1.3
'@octokit/request': 9.2.0
'@octokit/auth-oauth-device': 7.1.3
'@octokit/oauth-methods': 5.1.4
'@octokit/request': 9.2.1
'@octokit/types': 13.8.0
universal-user-agent: 7.0.2
@ -368,27 +298,27 @@ snapshots:
'@octokit/auth-unauthenticated@6.1.1':
dependencies:
'@octokit/request-error': 6.1.6
'@octokit/request-error': 6.1.7
'@octokit/types': 13.8.0
'@octokit/core@6.1.3':
'@octokit/core@6.1.4':
dependencies:
'@octokit/auth-token': 5.1.2
'@octokit/graphql': 8.2.0
'@octokit/request': 9.2.0
'@octokit/request-error': 6.1.6
'@octokit/request': 9.2.1
'@octokit/request-error': 6.1.7
'@octokit/types': 13.8.0
before-after-hook: 3.0.2
universal-user-agent: 7.0.2
'@octokit/endpoint@10.1.2':
'@octokit/endpoint@10.1.3':
dependencies:
'@octokit/types': 13.8.0
universal-user-agent: 7.0.2
'@octokit/graphql@8.2.0':
dependencies:
'@octokit/request': 9.2.0
'@octokit/request': 9.2.1
'@octokit/types': 13.8.0
universal-user-agent: 7.0.2
@ -397,119 +327,107 @@ snapshots:
'@octokit/auth-oauth-app': 8.1.2
'@octokit/auth-oauth-user': 5.1.2
'@octokit/auth-unauthenticated': 6.1.1
'@octokit/core': 6.1.3
'@octokit/core': 6.1.4
'@octokit/oauth-authorization-url': 7.1.1
'@octokit/oauth-methods': 5.1.3
'@octokit/oauth-methods': 5.1.4
'@types/aws-lambda': 8.10.147
universal-user-agent: 7.0.2
'@octokit/oauth-authorization-url@7.1.1': {}
'@octokit/oauth-methods@5.1.3':
'@octokit/oauth-methods@5.1.4':
dependencies:
'@octokit/oauth-authorization-url': 7.1.1
'@octokit/request': 9.2.0
'@octokit/request-error': 6.1.6
'@octokit/request': 9.2.1
'@octokit/request-error': 6.1.7
'@octokit/types': 13.8.0
'@octokit/openapi-types@23.0.1': {}
'@octokit/openapi-webhooks-types@8.5.1': {}
'@octokit/openapi-webhooks-types@9.1.0': {}
'@octokit/plugin-paginate-graphql@5.2.4(@octokit/core@6.1.3)':
'@octokit/plugin-paginate-graphql@5.2.4(@octokit/core@6.1.4)':
dependencies:
'@octokit/core': 6.1.3
'@octokit/core': 6.1.4
'@octokit/plugin-paginate-rest@11.4.0(@octokit/core@6.1.3)':
'@octokit/plugin-paginate-rest@11.4.2(@octokit/core@6.1.4)':
dependencies:
'@octokit/core': 6.1.3
'@octokit/core': 6.1.4
'@octokit/types': 13.8.0
'@octokit/plugin-request-log@5.3.1(@octokit/core@6.1.3)':
'@octokit/plugin-request-log@5.3.1(@octokit/core@6.1.4)':
dependencies:
'@octokit/core': 6.1.3
'@octokit/core': 6.1.4
'@octokit/plugin-rest-endpoint-methods@13.3.0(@octokit/core@6.1.3)':
'@octokit/plugin-rest-endpoint-methods@13.3.1(@octokit/core@6.1.4)':
dependencies:
'@octokit/core': 6.1.3
'@octokit/core': 6.1.4
'@octokit/types': 13.8.0
'@octokit/plugin-retry@7.1.3(@octokit/core@6.1.3)':
'@octokit/plugin-retry@7.1.3(@octokit/core@6.1.4)':
dependencies:
'@octokit/core': 6.1.3
'@octokit/request-error': 6.1.6
'@octokit/core': 6.1.4
'@octokit/request-error': 6.1.7
'@octokit/types': 13.8.0
bottleneck: 2.19.5
'@octokit/plugin-throttling@9.4.0(@octokit/core@6.1.3)':
'@octokit/plugin-throttling@9.4.0(@octokit/core@6.1.4)':
dependencies:
'@octokit/core': 6.1.3
'@octokit/core': 6.1.4
'@octokit/types': 13.8.0
bottleneck: 2.19.5
'@octokit/request-error@6.1.6':
'@octokit/request-error@6.1.7':
dependencies:
'@octokit/types': 13.8.0
'@octokit/request@9.2.0':
'@octokit/request@9.2.1':
dependencies:
'@octokit/endpoint': 10.1.2
'@octokit/request-error': 6.1.6
'@octokit/endpoint': 10.1.3
'@octokit/request-error': 6.1.7
'@octokit/types': 13.8.0
fast-content-type-parse: 2.0.1
universal-user-agent: 7.0.2
'@octokit/rest@21.1.0':
dependencies:
'@octokit/core': 6.1.3
'@octokit/plugin-paginate-rest': 11.4.0(@octokit/core@6.1.3)
'@octokit/plugin-request-log': 5.3.1(@octokit/core@6.1.3)
'@octokit/plugin-rest-endpoint-methods': 13.3.0(@octokit/core@6.1.3)
'@octokit/core': 6.1.4
'@octokit/plugin-paginate-rest': 11.4.2(@octokit/core@6.1.4)
'@octokit/plugin-request-log': 5.3.1(@octokit/core@6.1.4)
'@octokit/plugin-rest-endpoint-methods': 13.3.1(@octokit/core@6.1.4)
'@octokit/types@13.8.0':
dependencies:
'@octokit/openapi-types': 23.0.1
'@octokit/webhooks-methods@5.1.0': {}
'@octokit/webhooks-methods@5.1.1': {}
'@octokit/webhooks@13.5.0':
'@octokit/webhooks@13.6.0':
dependencies:
'@octokit/openapi-webhooks-types': 8.5.1
'@octokit/request-error': 6.1.6
'@octokit/webhooks-methods': 5.1.0
'@octokit/openapi-webhooks-types': 9.1.0
'@octokit/request-error': 6.1.7
'@octokit/webhooks-methods': 5.1.1
'@slack/types@2.14.0': {}
'@slack/webhook@7.0.4':
dependencies:
'@slack/types': 2.14.0
'@types/node': 22.13.1
'@types/node': 22.13.4
axios: 1.7.9
transitivePeerDependencies:
- debug
'@tsconfig/node10@1.0.11': {}
'@tsconfig/node20@20.1.4': {}
'@tsconfig/node12@1.0.11': {}
'@tsconfig/node14@1.0.3': {}
'@tsconfig/node16@1.0.4': {}
'@tsconfig/strictest@2.0.5': {}
'@types/aws-lambda@8.10.147': {}
'@types/node@22.13.1':
'@types/node@22.13.4':
dependencies:
undici-types: 6.20.0
acorn-walk@8.3.4:
dependencies:
acorn: 8.14.0
acorn@8.14.0: {}
arg@4.1.3: {}
asynckit@0.4.0: {}
axios@1.7.9:
@ -528,14 +446,10 @@ snapshots:
dependencies:
delayed-stream: 1.0.0
create-require@1.1.1: {}
date-fns@4.1.0: {}
delayed-stream@1.0.0: {}
diff@4.0.2: {}
fast-content-type-parse@2.0.1: {}
follow-redirects@1.15.9: {}
@ -546,49 +460,29 @@ snapshots:
combined-stream: 1.0.8
mime-types: 2.1.35
make-error@1.3.6: {}
mime-db@1.52.0: {}
mime-types@2.1.35:
dependencies:
mime-db: 1.52.0
octokit@4.1.0:
octokit@4.1.1:
dependencies:
'@octokit/app': 15.1.2
'@octokit/core': 6.1.3
'@octokit/app': 15.1.3
'@octokit/core': 6.1.4
'@octokit/oauth-app': 7.1.5
'@octokit/plugin-paginate-graphql': 5.2.4(@octokit/core@6.1.3)
'@octokit/plugin-paginate-rest': 11.4.0(@octokit/core@6.1.3)
'@octokit/plugin-rest-endpoint-methods': 13.3.0(@octokit/core@6.1.3)
'@octokit/plugin-retry': 7.1.3(@octokit/core@6.1.3)
'@octokit/plugin-throttling': 9.4.0(@octokit/core@6.1.3)
'@octokit/request-error': 6.1.6
'@octokit/plugin-paginate-graphql': 5.2.4(@octokit/core@6.1.4)
'@octokit/plugin-paginate-rest': 11.4.2(@octokit/core@6.1.4)
'@octokit/plugin-rest-endpoint-methods': 13.3.1(@octokit/core@6.1.4)
'@octokit/plugin-retry': 7.1.3(@octokit/core@6.1.4)
'@octokit/plugin-throttling': 9.4.0(@octokit/core@6.1.4)
'@octokit/request-error': 6.1.7
'@octokit/types': 13.8.0
proxy-from-env@1.1.0: {}
toad-cache@3.7.0: {}
ts-node@10.9.2(@types/node@22.13.1)(typescript@5.7.3):
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.11
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 22.13.1
acorn: 8.14.0
acorn-walk: 8.3.4
arg: 4.1.3
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
typescript: 5.7.3
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
typescript@5.7.3: {}
undici-types@6.20.0: {}
@ -596,7 +490,3 @@ snapshots:
universal-github-app-jwt@2.2.0: {}
universal-user-agent@7.0.2: {}
v8-compile-cache-lib@3.0.1: {}
yn@3.1.1: {}

View file

@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": ["@tsconfig/node20/tsconfig.json", "@tsconfig/strictest/tsconfig.json"],
"compilerOptions": {
"checkJs": true,
"noEmit": true
},
"include": ["main.js"]
}

View file

@ -1,61 +0,0 @@
import { Octokit } from "@octokit/rest";
import { IncomingWebhook } from "@slack/webhook";
async function main() {
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
const webhook = new IncomingWebhook(
process.env.SLACK_ISSUE_RESPONSE_WEBHOOK_URL!,
);
const owner = "zed-industries";
const repo = "zed";
const staff = await octokit.paginate(octokit.rest.orgs.listMembers, {
org: owner,
per_page: 100,
});
let staffHandles = staff.map((member) => member.login);
let commenterFilters = staffHandles.map((name) => `-commenter:${name}`);
let authorFilters = staffHandles.map((name) => `-author:${name}`);
const q = [
`repo:${owner}/${repo}`,
"is:issue",
"state:open",
"created:>=2025-02-01",
"sort:created-asc",
...commenterFilters,
...authorFilters,
];
const response = await octokit.rest.search.issuesAndPullRequests({
q: q.join("+"),
per_page: 100,
});
let issues = response.data.items;
let issueLines = issues.map((issue, index) => {
const formattedDate = new Date(issue.created_at).toLocaleDateString(
"en-US",
{
year: "numeric",
month: "short",
day: "numeric",
},
);
return `${index + 1}. ${formattedDate}: <${issue.html_url}|${issue.title}>`;
});
const blocks = [
{
type: "section",
text: {
type: "mrkdwn",
text: issueLines.join("\n"),
},
},
];
await webhook.send({ blocks: blocks });
}
main().catch((error) => console.error("An error occurred:", error));

View file

@ -1,13 +0,0 @@
{
"dependencies": {
"@octokit/rest": "^21.1.0",
"@slack/webhook": "^7.0.4",
"date-fns": "^4.1.0",
"octokit": "^4.1.0"
},
"devDependencies": {
"@octokit/types": "^13.8.0",
"@slack/types": "^2.14.0",
"ts-node": "^10.9.2"
}
}