Set Up a CI Pipeline with GitHub Actions
Add a GitHub Actions workflow that installs dependencies and runs your tests and linter on every push and pull request.
Requirements
- A project already pushed to GitHub. Follow our guide →
Create the workflow directory
$ mkdir -p .github/workflowsGitHub looks for workflow files anywhere under .github/workflows/ — the filename itself doesn't matter.
Define the workflow
name: CI
on: push: pull_request:
jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20Note
Swap the npm/node steps for your stack's equivalents (pip install, pytest, etc.) — the trigger and job structure stay the same.
Commit, push, and watch it run
$ git add .github/workflows/ci.yml$ git commit -m "Add CI workflow"$ git pushOpen your repository's Actions tab on GitHub — the workflow starts automatically.
Success
A green check on your commit and pull requests means the pipeline passed.
Troubleshooting
Actions only picks up workflow files that are valid YAML, committed under `.github/workflows/`, and pushed to a branch that matches the `on:` trigger.
Check the file's indentation (YAML is whitespace-sensitive) and confirm it was actually pushed: git log --stat -1.