Cake.GitHub
by Geert van Horrik, Cake Contributors
GitHub Addin for Cake Build Automation System.
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.
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