Get ready for your next interview with our comprehensive question library
GitHub Actions is a CI/CD platform that allows you to automate your build, test, and deployment pipeline directly within GitHub repositories. Unlike traditional CI/CD tools like Jenkins or TeamCity that require separate infrastructure, GitHub Actions is cloud-native and integrated directly into GitHub.
Key differences:
.github/workflows/A GitHub Actions workflow is defined in a YAML file within the .github/workflows/ directory. The basic structure includes:
name: CI Pipeline
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
Key components:
GitHub Actions supports various trigger events:
Repository Events:
push: Code pushed to repositorypull_request: PR opened, synchronized, or closedrelease: Release published or createdcreate: Branch or tag createddelete: Branch or tag deletedScheduled Events:
schedule: Cron-based scheduling using cron syntaxManual Events:
workflow_dispatch: Manual trigger with optional inputsrepository_dispatch: Triggered via API callsExternal Events:
webhook: Custom webhook eventscheck_run: Check run completeddeployment: Deployment eventExample:
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
schedule:
- cron: '0 2 * * *' # Daily at 2 AM
workflow_dispatch:
Upgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumUpgrade to Premium to see the answer
Upgrade to PremiumAccess all premium content - interview questions, and other learning resources
We regularly update our features and content, to ensure you get the most relevant and updated premium content.
1000 monthly credits
Cancel anytime