mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request This update improves the release notes generation process by restructuring documentation for clarity and enhancing workflows. It introduces new tools for handling GitHub issue images and attachments, along with automated tests to ensure functionality. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: N/A - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [x] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [x] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: N/A <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments The changes include updates to the release notes summarization process and workflow documentation for better clarity. New scripts for managing PR diffs, grouping, and milestone assignments have been added. Additionally, tools for downloading images and attachments from GitHub issues have been implemented, ensuring a more streamlined process. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Automated tests were added for the new GitHub issue tools, and all tests passed successfully. Manual validation included testing the new workflows and ensuring the documentation accurately reflects the changes made. ```
119 lines
3.3 KiB
JavaScript
119 lines
3.3 KiB
JavaScript
// Simple test script - run with: node test-github_issue_images.js
|
|
// Make sure GITHUB_TOKEN is set in environment
|
|
|
|
import { spawn } from "child_process";
|
|
|
|
const server = spawn("node", ["server.js"], {
|
|
stdio: ["pipe", "pipe", "inherit"],
|
|
env: { ...process.env }
|
|
});
|
|
|
|
// Send initialize request
|
|
const initRequest = {
|
|
jsonrpc: "2.0",
|
|
id: 1,
|
|
method: "initialize",
|
|
params: {
|
|
protocolVersion: "2024-11-05",
|
|
capabilities: {},
|
|
clientInfo: { name: "test-client", version: "1.0.0" }
|
|
}
|
|
};
|
|
|
|
server.stdin.write(JSON.stringify(initRequest) + "\n");
|
|
|
|
// Send list tools request
|
|
setTimeout(() => {
|
|
const listToolsRequest = {
|
|
jsonrpc: "2.0",
|
|
id: 2,
|
|
method: "tools/list",
|
|
params: {}
|
|
};
|
|
server.stdin.write(JSON.stringify(listToolsRequest) + "\n");
|
|
}, 500);
|
|
|
|
// Send call tool request (test with a real issue)
|
|
setTimeout(() => {
|
|
const callToolRequest = {
|
|
jsonrpc: "2.0",
|
|
id: 3,
|
|
method: "tools/call",
|
|
params: {
|
|
name: "github_issue_images",
|
|
arguments: {
|
|
owner: "microsoft",
|
|
repo: "PowerToys",
|
|
issueNumber: 25595, // 315 comments, many images - tests pagination!
|
|
maxImages: 5
|
|
}
|
|
}
|
|
};
|
|
server.stdin.write(JSON.stringify(callToolRequest) + "\n");
|
|
}, 1000);
|
|
|
|
// Track summary
|
|
let summary = { images: 0, totalKB: 0, text: "" };
|
|
let gotToolResponse = false;
|
|
let buffer = "";
|
|
|
|
// Read responses
|
|
server.stdout.on("data", (data) => {
|
|
buffer += data.toString();
|
|
|
|
// Try to parse complete JSON objects from buffer
|
|
const lines = buffer.split("\n");
|
|
buffer = lines.pop() || ""; // Keep incomplete line in buffer
|
|
|
|
for (const line of lines) {
|
|
if (!line.trim()) continue;
|
|
try {
|
|
const response = JSON.parse(line);
|
|
console.log("\n=== Response ===");
|
|
console.log("ID:", response.id);
|
|
if (response.result?.tools) {
|
|
console.log("Tools:", response.result.tools.map(t => t.name));
|
|
} else if (response.result?.content) {
|
|
gotToolResponse = true;
|
|
let imageCount = 0;
|
|
for (const item of response.result.content) {
|
|
if (item.type === "text") {
|
|
console.log("Text:", item.text);
|
|
summary.text = item.text;
|
|
} else if (item.type === "image") {
|
|
imageCount++;
|
|
const sizeKB = Math.round(item.data.length * 0.75 / 1024); // base64 to actual size
|
|
console.log(` [Image ${imageCount}] ${item.mimeType} - ${sizeKB} KB downloaded`);
|
|
summary.images++;
|
|
summary.totalKB += sizeKB;
|
|
}
|
|
}
|
|
} else {
|
|
console.log("Result:", JSON.stringify(response.result, null, 2));
|
|
}
|
|
} catch (e) {
|
|
// Likely incomplete JSON, will be in next chunk
|
|
}
|
|
}
|
|
});
|
|
|
|
// Exit after 60 seconds (more time for downloads)
|
|
setTimeout(() => {
|
|
console.log("\n" + "=".repeat(50));
|
|
console.log("=== Test Summary ===");
|
|
console.log("=".repeat(50));
|
|
if (summary.text) {
|
|
console.log(summary.text);
|
|
}
|
|
if (summary.images > 0) {
|
|
console.log(`Total images downloaded: ${summary.images}`);
|
|
console.log(`Total size: ${summary.totalKB} KB`);
|
|
} else if (!gotToolResponse) {
|
|
console.log("No tool response received yet. The request may still be running or was rate-limited.");
|
|
}
|
|
console.log("=".repeat(50));
|
|
console.log("Test complete!");
|
|
server.kill();
|
|
process.exit(0);
|
|
}, 60000);
|