Skip to main content

GitHub Actions: Data Flow & Data Persistence

· 10 min read
Manu Magalhães
DevSecOps Engineer

In Github Actions, by default, data is not inherently persistent or available to the whole pipeline. Every step has is its own process, every job has its own runner. By default, whatever data emerges in a job, ends with it.

How do we pass data from one process to the other, or save it for the next process?

A short sweet answer:

StrategyDataScopePersistenceExplanationExample
envValuesJob (internal)EphemeralPropagates data
between steps
in the same job
Pass a boolean to control whether the next step should run
outputsValuesWorkflow (internal)EphemeralPropagates data
between jobs/steps
in the same workflow
Pass a deployment id to the next job
artefactsFilesWorkflow (internal & external)PersistentPropagates files
between jobs/workflows
Pass the project build to different test jobs running in parallel

Intended for frequently changing data. Files are available for download after the workflow finishes.
cacheFilesWorkflow (internal & external)PersistentPropagates files
inside and between workflows
in the same repository
Cache npm packages for use in different workflow runs.

Intended for files that don't change much.

For a completer answer: read on.
All the workflow examples in this article can be found as files here, along with a copy of the respective redacted logs.

Bypassing Terraform error: “The true and false result expressions must have consistent types”

· 2 min read
Manu Magalhães
DevSecOps Engineer

Have you ever came across this Terraform error — when you intentionally want your ternary to output different types?

The true and false result expressions must have consistent types

To bypass this Terraform limitation, check the tip below. I'll follow it with two examples to clarify the usage:

attribute = [
<desired output if true>,
<desired output if false>
][<condition> ? 0 : 1]

How to Migrate CodeCommit to GitHub — and Keep your Amplify Pipeline

· 6 min read
Manu Magalhães
DevSecOps Engineer

This tutorial includes guidance for three different scenarios in your GitHub administration:

  1. when your repo is in your personal account;
  2. when your app is under a GitHub Org and admins grant you the permissions you need; and
  3. when your repo is under a GitHub Org and admins do NOT grant you the permissions you need.

Pre-requisites: Relevant access and permissions for CodeCommit and Amplify. You also need a working GitHub account.