Git & GitHub Course
Git & GitHub
/
Intermediate

What are GitHub Actions?

Definition

A continuous integration and continuous delivery (CI/CD) platform built directly into GitHub. It allows you to automate your build, test, and deployment pipeline.

Explain Like I'm New

Robots that work for you for free. You write a script that says: 'Every time someone opens a Pull Request, boot up a Linux computer, install my code, and run my automated tests. If the tests fail, block the Pull Request.'

Real World Example

Automatically publishing an npm package. You write an Action so that whenever you create a new Release tag (v2.0.0) on GitHub, the robot automatically builds the code and publishes it to npmjs.com without you typing a single command.

Common Use Cases

  • •Automated Testing
  • •Automated Deployments
  • •Running Linters

Terminal Output

bash / terminal
# This file lives in: .github/workflows/test.yml name: Run Tests # TRIGGER: When does this robot run? on: [push, pull_request] # JOBS: What does the robot do? jobs: test: runs-on: ubuntu-latest # Boot up a Linux server steps: - name: Download my code uses: actions/checkout@v3 - name: Install Node.js uses: actions/setup-node@v3 with: node-version: 18 - name: Install dependencies and Run tests run: | npm install npm test

Interview Questions

basic

  • Are GitHub Actions free to use?

intermediate

  • What format are GitHub Actions workflow files written in?

Flash Cards

Question

Are they free?

Click to reveal answer
Answer

Yes! GitHub gives you thousands of free computing minutes every month for public and private repositories.

Question

What format?

Click to reveal answer
Answer

YAML (`.yml` or `.yaml`).