generate_github_actions
Create GitHub Actions workflow files for CI/CD pipelines, testing, security scanning, and deployment automation across multiple project types.
Instructions
Generates GitHub Actions workflow files for CI/CD, testing, security scanning, and deployment.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectType | Yes | Type of project | |
| features | Yes | Features to include |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"features": {
"description": "Features to include",
"items": {
"enum": [
"test",
"lint",
"build",
"deploy",
"security",
"release"
],
"type": "string"
},
"type": "array"
},
"projectType": {
"description": "Type of project",
"enum": [
"node",
"python",
"rust",
"go",
"docker"
],
"type": "string"
}
},
"required": [
"projectType",
"features"
],
"type": "object"
}
Implementation Reference
- src/tools/fullstack.ts:222-315 (handler)The handler function that generates GitHub Actions workflow YAML files based on the provided projectType and features. It constructs CI/CD pipelines for testing, linting, building, and security scanning.export function generateGitHubActionsHandler(args: any) { const { projectType, features } = args; const workflows: string[] = []; if (features.includes("test") || features.includes("lint") || features.includes("build")) { const ciSteps = []; if (projectType === "node") { ciSteps.push(` - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - run: npm ci`); if (features.includes("lint")) ciSteps.push(` - run: npm run lint`); if (features.includes("test")) ciSteps.push(` - run: npm test`); if (features.includes("build")) ciSteps.push(` - run: npm run build`); } else if (projectType === "python") { ciSteps.push(` - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.12' - run: pip install -r requirements.txt`); if (features.includes("lint")) ciSteps.push(` - run: ruff check .`); if (features.includes("test")) ciSteps.push(` - run: pytest`); } workflows.push(`# .github/workflows/ci.yml name: CI on: push: branches: [main] pull_request: branches: [main] jobs: build: runs-on: ubuntu-latest steps: ${ciSteps.join("\n")}`); } if (features.includes("security")) { workflows.push(`# .github/workflows/security.yml name: Security Scan on: push: branches: [main] schedule: - cron: '0 0 * * 0' # Weekly jobs: security: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Run security audit run: ${projectType === "node" ? "npm audit --audit-level=high" : projectType === "python" ? "pip-audit" : "cargo audit"} - name: Dependency review uses: actions/dependency-review-action@v4 if: github.event_name == 'pull_request'`); } const result = `# GitHub Actions Workflows ## Generated Workflows for ${projectType} ${workflows.join("\n\n---\n\n")} --- ## Additional Recommended Workflows ### Dependabot Config Create \`.github/dependabot.yml\`: \`\`\`yaml version: 2 updates: - package-ecosystem: "${projectType === "node" ? "npm" : projectType === "python" ? "pip" : projectType}" directory: "/" schedule: interval: "weekly" open-pull-requests-limit: 10 \`\`\` ### Branch Protection Enable in GitHub Settings: - Require PR reviews - Require status checks (CI must pass) - Require up-to-date branches `; return { content: [{ type: "text", text: result }] }; }
- src/tools/fullstack.ts:213-220 (schema)Zod schema defining the input structure for the tool, including projectType (enum) and features (array of enums).export const generateGitHubActionsSchema = { name: "generate_github_actions", description: "Generates GitHub Actions workflow files for CI/CD, testing, security scanning, and deployment.", inputSchema: z.object({ projectType: z.enum(["node", "python", "rust", "go", "docker"]).describe("Type of project"), features: z.array(z.enum(["test", "lint", "build", "deploy", "security", "release"])).describe("Features to include") }) };
- src/index.ts:115-115 (registration)Registration of the tool in the main stdio server's toolRegistry Map.["generate_github_actions", { schema: generateGitHubActionsSchema, handler: generateGitHubActionsHandler }],
- src/server.ts:120-120 (registration)Registration of the tool in the HTTP server's toolRegistry Map.["generate_github_actions", { schema: generateGitHubActionsSchema, handler: generateGitHubActionsHandler }],