GitHub Actions: New workflow features
We’ve added some new workflow features to GitHub Actions based on your feedback.
Workflow and job level run defaults.
You can specify the shell and working-directory for the run action at either the job or workflow level, which makes using a shell different from the system’s default shell less verbose.
Learn more about run defaults
Job outputs
You can specify a set of outputs that you want to pass to subsequent jobs and then access those values from your needs context.
Learn more about job outputs
Matrix include lets you include new combinations
Previously the include in a matrix would only let you augment existing combinations. Now you can include completely new combinations and even specify all of your matrix legs with include.
Learn more about matrix include
Expressions in job.continue-on-error
You can now use expressions in the continue-on-error property for a job. This can be useful when you want to allow some jobs to fail based on runtime values such as a matrix.
jobs:
build:
strategy:
matrix:
os: ubuntu-latest, macos-latest, windows-latest
node: [10, 12, 13]
include:
node: 13
continue-on-error: true
continue-on-error: ${{ matrix.continue-on-error }}
New fromJSON() method in expressions
The Actions expression language has a fromJSON(value) method that can take a stingified JSON object and bind it to a property.
Combining this with job.outputs you can build a workflow that has a fully dynamic matrix.
name: build
on: push
jobs:
job1:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: echo "::set-output name=matrix::{\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}"
job2:
needs: job1
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.job1.outputs.matrix)}}
steps:
- run: build
New github context properties
The github context now has the repository_owner and job properties. The repository_owner is the account or organization that owns the repository. The job property contains the id of the job as specified in the workflow file.
Learn more about the github context
New steps context properties
The steps context now has properties for the outcome and conclusion. This allows you to conditionalize subsequent steps based on the the success or failure of a specific step.
Learn more about the steps context