Skip to main content

This version of GitHub Enterprise Server will be discontinued on 2026-09-22. Discontinued releases are not supported. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features in GitHub Enterprise Server, see Overview of the upgrade process. For help with the upgrade, GitHub Enterprise Support.

Creating an example workflow

In this tutorial, you'll learn how to create a basic workflow that is triggered by a push event.

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.

  1. In your repository, create the .github/workflows/ directory to store your workflow files.

  2. In the .github/workflows/ directory, create a new file called learn-github-actions.yml and add the following code.

    YAML