GitHub Actions

Out of the box support

The GitHubActions alias, which returns an IGitHubActionsProvider instance can be used to interact with the GitHub Actions environment.

The following example prints if the build is for a pull request running on GitHub Actions:

if (BuildSystem.GitHubActions.IsRunningOnGitHubActions)
{
    Information(BuildSystem.GitHubActions.Environment.PullRequest.IsPullRequest);
}
else
{
    Information("Not running on GitHub Actions");
}

See IGitHubActionsProvider for details and available methods to interact with GitHub Actions.

Running Cake

The recommended way to run Cake on GitHub Actions is using the Cake Action. This action handles tool restoration and ensures that all GitHub build provider commands work correctly.

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Run Cake
        uses: cake-build/cake-action@v3
        with:
          cake-version: tool-manifest

If you are using Cake.Sdk, you can specify the script file:

      - name: Run Cake
        uses: cake-build/cake-action@v3
        with:
          file-path: build.cs

Available 3rd party extensions

Cake.GitHub by Geert van Horrik, Cake Contributors
GitHub Addin for Cake Build Automation System.
Cake.GithubUtility by Cake.GitHubUtility
Package Description
Cake.Issues.BuildServer.GitHubActions by Cake Issues contributors
GitHub Actions support for the Cake.Issues addin for Cake allows you to report to GitHub Actions builds. This addin provides the aliases for writing to GitHub Actions builds. It also requires the core Cake.Issues and Cake.Issues.BuildServer addins and one or more issue providers. See the Project Site for an overview of the whole ecosystem of addins for working with issues in Cake scripts. NOTE: This is the version of the addin compatible with Cake Script Runners. For addin compatible with Cake Frosting see Cake.Frosting.Issues.BuildServer.GitHubActions.
GitHub Actions support for the Cake.Issues addin allows you to report to GitHub Actions builds. This addin provides the aliases for writing to GitHub Actions builds. It also requires the core Cake.Issues and Cake.Issues.PullRequests addins and one or more issue providers. See cakeissues.net for an overview of the whole ecosystem of addins for working with issues in Cake scripts.