7 advanced workflow automation features with GitHub Actions

Check out some advanced automation and CI/CD capabilities you can use today with GitHub Actions on any GitHub account.

|
| 5 minutes
TL;DR: Check out some advanced automation and CI/CD capabilities you can use today with GitHub Actions on any GitHub account.

GitHub Actions is designed to bring platform-native automation and CI/CD capabilities directly into the GitHub flow to simplify the developer experience. It can also be used to build out more advanced, custom workflows for anything from triggering an alarm to orchestrating complex security test automations.

If you’re looking to create advanced workflows, you can use the pre-built actions in the GitHub Actions Marketplace (we just passed 10,000!) to help.

But if you’re creating your own custom workflows, here are seven features to keep in mind (you can also learn more about managing complex workflows with GitHub Actions in GitHub Docs, or watch my on demand session at GitHub Universe).

1. Track your workflows with workflow visualization

All actions start and end with YAML files—but you can also access real-time workflow visualization graphs to track progress, understand dependencies and conditionals in more complex workflows, and troubleshoot any issues that come up via logs. Plus, workflow visualization graphics are color-coded to quickly show you what actions were successful, which are in progress, and which failed at a particular step.

2. Build breakpoints in a workflow with dependencies (or create dependencies between workflows)

GitHub Actions runs multiple commands at the same time by default—but you can leverage the needs keyword to create dependencies between jobs. That means that if something like a test fails (or any job for that matter) dependent jobs won’t execute.

You can also create dependencies between workflows. This can create connection points—and breakpoints, for that matter—between automations. (Pro tip: You can cache dependencies to speed up workflows and reduce run times.)

3. A conditional can make all the difference

GitHub Actions supports conditionals, which use the if keyword to determine if a step should run in a given workflow. You can use this to build upon dependencies so that if a dependent job fails the workflow can continue running. These can use certain built-in functions for data operations.

Screenshot of a conditional in a GitHub Actions workflow
An example of a conditional in a GitHub Actions workflow.

You can also leverage status check functions to determine if previous steps have succeeded, failed, been canceled, or otherwise disrupted. Another useful benefit of conditionals: you can use them to share workflow data between different branches and forks with steps tailored to different triggers or environments.

4. Creating workflows with sensitive data? Try storing secrets

Secrets on GitHub are used to securely store sensitive data such as passwords, tokens, and certificates, among other things—and they can be directly referenced in workflows, too. This means you can create and share workflows with collaborators using secrets for secure values without hardcoding those values directly in YAML files.

5. Share data between jobs to create more advanced automations

GitHub Actions supports sharing data between jobs in any workflow as artifacts, which are associated with the workflow run where they are created. This can help simplify the development of YAML workflow files. It also makes it easier to create more complex automations where one workflow informs another via dependencies or conditionals.

screenshot of artifact in GitHub Actions
An example of artifacts in GitHub Actions that are used to share data between jobs in an automation workflow

6. Use contexts to access workflow information

Contexts are a collection of variables used to access information about workflow runs, runner environments, jobs and steps to help derive key information about workflow operations. Contexts use expression syntax like ${{ }}. Most of them can be used at any point in the workflow.

7. Create different environments for development, staging, and production

GitHub Actions allows you to create environments with secure protection rules and secrets—and then reference those environments in a workflow job to leverage the environment’s protection rules and secrets. Example use cases include requiring a specific person or team to approve workflow jobs that reference an environment or restricting which branches can deploy to a given environment.

screenshot of environments in GitHub Actions workflow automations
An example of different environments in GitHub Actions workflow automations.

Have questions?

Try our Docs pages for more insights on what GitHub Actions is and can do for you.

Written by

Related posts