Skip to main content
Glama

github_actions_create_ci

Create GitHub Actions CI/CD workflows to automate testing and deployment processes for your development projects.

Instructions

Generate a CI/CD workflow for the project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.js:1621-1823 (registration)
    MCP tool registration for 'github_actions_create_ci', including name, description, input schema, and handler reference
    "github_actions_create_ci", "Generate a CI/CD workflow for the project", { project_type: { type: "string", description: "Project type: java-maven, java-gradle, nodejs, python, golang" }, include_docker: { type: "boolean", description: "Include Docker build and GHCR push", default: true }, include_sonar: { type: "boolean", description: "Include SonarCloud analysis", default: false }, sonar_org: { type: "string", description: "SonarCloud organization (if include_sonar)", default: "" }, github_owner: { type: "string", description: "GitHub owner for GHCR push" } }, async ({ project_type, include_docker, github_owner }) => { const workflows = { "java-maven": { build: ` - name: Set up JDK 17 uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' cache: maven - name: Build with Maven run: mvn -B package --file pom.xml - name: Run tests run: mvn test`, artifact: "target/*.jar" }, "java-gradle": { build: ` - name: Set up JDK 17 uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' cache: gradle - name: Build with Gradle run: ./gradlew build - name: Run tests run: ./gradlew test`, artifact: "build/libs/*.jar" }, "nodejs": { build: ` - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - name: Install dependencies run: npm ci - name: Run tests run: npm test - name: Build run: npm run build --if-present`, artifact: "dist/" }, "python": { build: ` - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' cache: 'pip' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt pip install pytest - name: Run tests run: pytest`, artifact: "" }, "golang": { build: ` - name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.21' - name: Build run: go build -v ./... - name: Test run: go test -v ./...`, artifact: "" } }; const config = workflows[project_type]; if (!config) { return { content: [{ type: "text", text: `Unknown project type: ${project_type}\n\nSupported: java-maven, java-gradle, nodejs, python, golang` }] }; } let dockerSteps = ""; if (include_docker) { dockerSteps = ` docker: needs: build runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: \${{ github.actor }} password: \${{ secrets.GITHUB_TOKEN }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${github_owner || "${{ github.repository_owner }}"}/${"${{ github.event.repository.name }}"} tags: | type=ref,event=branch type=ref,event=pr type=sha,prefix= type=raw,value=latest,enable={{is_default_branch}} - name: Build and push uses: docker/build-push-action@v5 with: context: . push: \${{ github.event_name != 'pull_request' }} tags: \${{ steps.meta.outputs.tags }} labels: \${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max`; } const workflow = `name: CI/CD on: push: branches: [ main, master, develop ] pull_request: branches: [ main, master ] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 ${config.build}${dockerSteps} `; return { content: [{ type: "text", text: `GITHUB ACTIONS WORKFLOW ======================= Save this to: .github/workflows/ci.yml ${workflow} SETUP STEPS: 1. Create directory: mkdir -p .github/workflows 2. Save the above YAML to: .github/workflows/ci.yml 3. Commit and push: git add .github/ git commit -m "feat: add CI/CD workflow" git push The workflow will: - Run on push to main/master/develop - Run on pull requests - Build and test your code${include_docker ? "\n- Build and push Docker image to GHCR" : ""} GHCR packages will appear at: https://github.com/${github_owner || "YOUR_USERNAME"}?tab=packages` }] }; } );
  • Input schema defining parameters for the github_actions_create_ci tool: project_type (required), include_docker, include_sonar, sonar_org, github_owner
    project_type: { type: "string", description: "Project type: java-maven, java-gradle, nodejs, python, golang" }, include_docker: { type: "boolean", description: "Include Docker build and GHCR push", default: true }, include_sonar: { type: "boolean", description: "Include SonarCloud analysis", default: false }, sonar_org: { type: "string", description: "SonarCloud organization (if include_sonar)", default: "" }, github_owner: { type: "string", description: "GitHub owner for GHCR push" } },
  • Handler implementation that generates and returns a GitHub Actions CI/CD workflow YAML based on the project type, with optional Docker build/push to GHCR and SonarCloud integration.
    async ({ project_type, include_docker, github_owner }) => { const workflows = { "java-maven": { build: ` - name: Set up JDK 17 uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' cache: maven - name: Build with Maven run: mvn -B package --file pom.xml - name: Run tests run: mvn test`, artifact: "target/*.jar" }, "java-gradle": { build: ` - name: Set up JDK 17 uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' cache: gradle - name: Build with Gradle run: ./gradlew build - name: Run tests run: ./gradlew test`, artifact: "build/libs/*.jar" }, "nodejs": { build: ` - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - name: Install dependencies run: npm ci - name: Run tests run: npm test - name: Build run: npm run build --if-present`, artifact: "dist/" }, "python": { build: ` - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' cache: 'pip' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt pip install pytest - name: Run tests run: pytest`, artifact: "" }, "golang": { build: ` - name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.21' - name: Build run: go build -v ./... - name: Test run: go test -v ./...`, artifact: "" } }; const config = workflows[project_type]; if (!config) { return { content: [{ type: "text", text: `Unknown project type: ${project_type}\n\nSupported: java-maven, java-gradle, nodejs, python, golang` }] }; } let dockerSteps = ""; if (include_docker) { dockerSteps = ` docker: needs: build runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: \${{ github.actor }} password: \${{ secrets.GITHUB_TOKEN }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${github_owner || "${{ github.repository_owner }}"}/${"${{ github.event.repository.name }}"} tags: | type=ref,event=branch type=ref,event=pr type=sha,prefix= type=raw,value=latest,enable={{is_default_branch}} - name: Build and push uses: docker/build-push-action@v5 with: context: . push: \${{ github.event_name != 'pull_request' }} tags: \${{ steps.meta.outputs.tags }} labels: \${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max`; } const workflow = `name: CI/CD on: push: branches: [ main, master, develop ] pull_request: branches: [ main, master ] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 ${config.build}${dockerSteps} `; return { content: [{ type: "text", text: `GITHUB ACTIONS WORKFLOW ======================= Save this to: .github/workflows/ci.yml ${workflow} SETUP STEPS: 1. Create directory: mkdir -p .github/workflows 2. Save the above YAML to: .github/workflows/ci.yml 3. Commit and push: git add .github/ git commit -m "feat: add CI/CD workflow" git push The workflow will: - Run on push to main/master/develop - Run on pull requests - Build and test your code${include_docker ? "\n- Build and push Docker image to GHCR" : ""} GHCR packages will appear at: https://github.com/${github_owner || "YOUR_USERNAME"}?tab=packages` }] }; } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rideRTD/RTD-DevOps'

If you have feedback or need assistance with the MCP directory API, please join our Discord server