GitHub Actions: sets the `CI` environment variable to true

The GitHub Actions runner now sets the CI=true environment variable by default.

Learn more about GitHub Actions default environment variables

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

Learn more about fromJson

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

See more

The multi-line code suggestions feature is now generally available to all GitHub users.

With multi-line suggestions you can suggest a specific change to multiple lines of code when reviewing a pull request. To select a multi-line code block, either:

  • click and hold to the right of a line number, drag and then release the mouse when you’ve reached the last line of the desired selection; or
  • click on a line number, hold Shift, click on a second line number and click the "+" button to the right of the second line number.

Once you've selected the code block, click the diff icon and edit the text within the suggestion block.

Learn more about pull request comments and send us your feedback.

See more