Introduction
This guide shows you how to create a basic workflow that is triggered when code is pushed to your repository.
To get started with preconfigured workflows, browse through the list of templates in the actions/starter-workflows repository. For more information, see Using workflow templates.
Important
For more information about best practices for securing your workflows and secure use of GitHub Actions features, see Secure use reference.
Creating an example workflow
GitHub Actions uses YAML syntax to define the workflow. Each workflow is stored as a separate YAML file in your code repository, in a directory named .github/workflows.
You can create an example workflow in your repository that automatically triggers a series of commands whenever code is pushed. In this workflow, GitHub Actions checks out the pushed code, installs the bats testing framework, and runs a basic command to output the bats version: bats -v.
-
In your repository, create the
.github/workflows/directory to store your workflow files. -
In the
.github/workflows/directory, create a new file calledlearn-github-actions.ymland add the following code.YAML name: learn-github-actions run-name: ${{ github.actor }} is learning GitHub Actions on: [push] jobs: check-bats-version: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: actions/setup-node@v7 with: node-version: '24' - run: npm install -g bats - run: bats -v