Skip to content

Latest commit

 

History

History
76 lines (49 loc) · 2.06 KB

01.md

File metadata and controls

76 lines (49 loc) · 2.06 KB

Create your first GitHub action

What you will learn

  • Automate, customize, and execute your software development workflows right in your GitHub repository

👾 Before we start the exercise

👨‍🚀 Exercise 1.1

Workflows are custom automated processes that you can set up in your repository to build, test, package, release, or deploy any code project on GitHub.

To create a new workflow:

  • Go to your GitHub repository.
  • Click on the Actions tab.
  • Click on set up a workflow yourself if you want to create a custom workflow, or you can choose a template.

👨‍🚀 Exercise 1.2

  • Create a new file .github/workflows/hello.yml
name: CI

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - name: Run a one-line script
      run: echo Hello, world!

👨‍🚀 Exercise 1.3

  • Commit to your repository to launch the action

👨‍🚀 Exercise 1.4

You can trigger a GitHub Actions workflow on a specific branch by specifying the branch name in the on section of your workflow file.

  • Create another file .github/workflows/hello-branch.yml
name: CI

on:
  push:
    branches:
      - main  # This workflow will only run when changes are pushed to the 'main' branch
  pull_request:
    branches:
      - main  # This workflow will also run when pull requests are opened to the 'main' branch

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - name: Run a one-line script
      run: echo Hello, world!

🏅 Elaboration and Feedback

After the exercice, to remember what you've just learned, then fill out the elaboration and feedback form.