sajad torkamani

In a nutshell

GitHub Actions let you run jobs when things happen in your GitHub repository.

For example, this .github/actions/master.yml file (GitHub repo):

name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on:
  push:
    branches:
      - master
jobs:
  explore:
    runs-on: ubuntu-latest
    steps:
      - uses: 'actions/checkout@v2'
      - uses: 'actions/setup-node@v2'
        with:
          node-version: '20.16.0'
      - name: Install dependencies
        run: npm ci
      - name: Run tests
        run: npm test

Results in something like this:

Recipes

Control when a job runs

Pick an event that can trigger a workflow from the list here.

Then define that event in your .github/workflows/<workflow-name>.yml:

on:
  push:
    branches:
      - master

Use pre-built actions

Use secrets

Other notes

Tagged: GitHub

Leave a comment

Your email address will not be published. Required fields are marked *