Security workflow fix#1285
Conversation
…checks Co-authored-by: Copilot <copilot@github.com>
Applies from line 37 through the end of the script in const lines = body
.split(/\r?\n/)
.map(line => line.trim())
.filter(Boolean);
function parseCommandArg(line, command) {
const raw = line.slice(command.length).trim();
const quoted = raw.match(/^(['"])(.+)\1$/);
return quoted ? quoted[2].trim() : raw;
}
const errors = [];
async function runMutation(name, fn, options = {}) {
try {
await fn();
} catch (error) {
if (options.ignore404 && error.status === 404) {
console.log(`${name}: ignored 404`);
return;
}
errors.push(`${name}: ${error.status || 'unknown'} ${error.message}`);
console.log(`${name} failed: ${error.message}`);
}
}
for (const line of lines.filter(line => line.startsWith('/label '))) {
const labelName = parseCommandArg(line, '/label');
await runMutation(`add label "${labelName}"`, () =>
github.rest.issues.addLabels({
owner, repo, issue_number: issueNumber,
labels: [labelName],
})
);
}
for (const line of lines.filter(line => line.startsWith('/unlabel '))) {
const labelName = parseCommandArg(line, '/unlabel');
await runMutation(
`remove label "${labelName}"`,
() =>
github.rest.issues.removeLabel({
owner, repo, issue_number: issueNumber,
name: labelName,
}),
{ ignore404: true }
);
}
// /close (optionally with 'not planned')
const wantsClose = lines.some(line => line === '/close' || line.startsWith('/close '));
if (wantsClose) {
const closeLine = lines.find(line => line === '/close' || line.startsWith('/close '));
const stateReason = closeLine.includes('not planned') ? 'not_planned' : 'completed';
console.log(`Closing issue (reason: ${stateReason})`);
await github.rest.issues.update({
owner, repo, issue_number: issueNumber,
state: 'closed',
state_reason: stateReason,
});
}
// /open or /reopen
const wantsOpen = lines.some(line => line === '/open' || line === '/reopen');
if (wantsOpen) {
console.log('Reopening issue');
await github.rest.issues.update({
owner, repo, issue_number: issueNumber,
state: 'open',
});
}
if (errors.length > 0) {
throw new Error(`One or more label operations failed:\n${errors.join('\n')}`);
} |
This pull request simplifies and modernizes the project's automation and configuration for development workflows. The most significant changes are the refactoring of the GitHub Actions workflow for issue slash commands, and the removal of OpenCode agent and MCP configuration files, as well as related VSCode settings. These changes streamline the repository by eliminating custom development environment integrations and centralizing issue command logic into a single, maintainable script.
GitHub Actions Workflow Improvements:
.github/workflows/issue-slash-commands.yamlto consolidate multiple shell-based steps into a singlegithub-scriptaction, improving maintainability and security:/label,/unlabel,/close,/open,/reopen) is now managed in JavaScript, reducing complexity and removing shell interpolation risks.Removal of OpenCode and MCP Configuration:
.opencode/AGENTS.md, removing agent guidelines and development instructions specific to OpenCode and MCP integration..opencode/mcp-config.json, removing all custom MCP server, task, and language integration settings for Rust and Bash, as well as workspace configuration.Editor Settings Cleanup:
.vscode/settings.json, cleaning up editor-specific automation settings that are no longer needed after the removal of OpenCode/MCP integration.Type of Change
Description
Issues / other PRs related
Screenshots (if applicable)