GitHub Actions Generator
Generate GitHub Actions workflow YAML for CI/CD pipelines with customizable triggers, jobs, and steps.
name: CI
on:
push:
branches: [main, master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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 buildAbout this tool
GitHub Actions Generator is a browser-based tool that helps developers create CI/CD workflow files without manually writing YAML syntax. By selecting your triggers, jobs, and build steps through an intuitive interface, the tool automatically generates production-ready workflow YAML that you can copy directly into your repository's .github/workflows directory.
To use this tool, start by defining your workflow trigger (push events, pull requests, scheduled times, or manual dispatch), then configure your jobs and the steps each job should execute. You can add multiple jobs that run sequentially or in parallel, specify environment variables, and include common actions like installing dependencies, running tests, building code, and deploying to production. This approach is ideal for teams setting up continuous integration for the first time, developers who want to avoid YAML syntax errors, or anyone who prefers a visual workflow builder over hand-coding configuration files.
The generated YAML is fully compatible with GitHub Actions and requires no additional formatting—paste it directly into your workflow file and customize secrets or credentials as needed. While this tool simplifies workflow creation, complex multi-environment deployments or advanced caching strategies may still benefit from manual fine-tuning of the generated output.
Frequently Asked Questions
Code Implementation
import yaml
def generate_github_actions_workflow(
name: str,
trigger: str,
jobs: list[dict]
) -> str:
workflow = {
"name": name,
"on": {},
"jobs": {}
}
if trigger == "push":
workflow["on"] = {"push": {"branches": ["main"]}}
elif trigger == "pull_request":
workflow["on"] = {"pull_request": {"branches": ["main"]}}
elif trigger == "schedule":
workflow["on"] = {"schedule": [{"cron": "0 0 * * *"}]}
else:
workflow["on"] = {trigger: {}}
for job in jobs:
job_id = job["id"]
workflow["jobs"][job_id] = {
"runs-on": job.get("runs_on", "ubuntu-latest"),
"steps": job.get("steps", [])
}
return yaml.dump(workflow, default_flow_style=False, sort_keys=False)
# Example: Node.js CI workflow
jobs = [
{
"id": "build",
"runs_on": "ubuntu-latest",
"steps": [
{"uses": "actions/checkout@v4"},
{"name": "Setup Node", "uses": "actions/setup-node@v4",
"with": {"node-version": "20"}},
{"name": "Install dependencies", "run": "npm ci"},
{"name": "Run tests", "run": "npm test"},
]
}
]
yaml_output = generate_github_actions_workflow("CI", "push", jobs)
print(yaml_output)Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.