3 Workflows

 

This chapter covers

  • Understanding YAML and the YAML syntax
  • Learning the basics of the workflow syntax
  • Understanding workflow triggers, expressions, and contexts
  • Introducing advanced workflow concepts, like workflow commands
  • Learning best practices for authoring and debugging workflows

Now that you have gained a bit of practical experience, it is time to fully understand the syntax for workflows. Since workflows are written in YAML, it is important to fully understand YAML before writing workflows.

3.1 YAML

YAML, which stands for YAML Ain’t Markup Language, is a data-serialization language optimized to be directly writable and readable by humans. It is a strict superset of JSON but with syntactically relevant newlines and indentation instead of braces. In the next sections, we go through all the YAML elements that are important for writing workflows.

3.1.1 YAML basics

YAML files are text files with a .yml or .yaml extension. Because YAML uses indentation instead of braces, these text files can be versioned very well with Git, as changes are always made per line.

YAML files can have different encodings, but GitHub uses UTF-8 for the workflows. You can write comments in YAML by prefixing text with a hash (#):

# A full-line comment in YAML
key:value # An in-line comment

Comments can occur anywhere in a line.

3.1.2 Data types

In YAML, you have various data types available. There are simple (scalar) data types as well as more complex collection types.

Scalar types

3.2 The workflow syntax

 

3.3 Events and triggers

 
 
 

3.3.1 Webhook triggers

 
 
 
 

3.3.2 Scheduled triggers

 
 
 
 

3.3.3 Manual triggers

 
 
 

3.4 Workflow jobs and steps

 

3.4.1 Workflow jobs

 
 

3.4.2 Workflow steps

 
 

3.4.3 Using GitHub actions

 
 
 

3.4.4 The matrix strategy

 
 

3.5 Expressions and contexts

 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest