Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing GitHubActions Alias #2691

Closed
RehanSaeed opened this issue Jan 13, 2020 · 3 comments · Fixed by #2692
Closed

Missing GitHubActions Alias #2691

RehanSaeed opened this issue Jan 13, 2020 · 3 comments · Fixed by #2692
Milestone

Comments

@RehanSaeed
Copy link
Contributor

Following on from #2677:

There's a alias property missing and should be added to BuildSystemAliases.cs
@devlead

What You Are Seeing?

This produces a compiler error:

GitHubActions.IsRunningOnGitHubActions

What is Expected?

In theory this should work because I also use:

TFBuild.IsRunningOnAzurePipelinesHosted
AppVeyor.IsRunningOnAppVeyor

What version of Cake are you using?

0.36.0

@devlead
Copy link
Member

devlead commented Jan 13, 2020

Alias property example

/// <summary>
/// Gets a <see cref="Cake.Common.Build.AppVeyor.AppVeyorProvider"/> instance that can
/// be used to manipulate the AppVeyor environment.
/// </summary>
/// <example>
/// <code>
/// var isAppVeyorBuild = AppVeyor.IsRunningOnAppVeyor;
/// </code>
/// </example>
/// <param name="context">The context.</param>
/// <returns>A <see cref="Cake.Common.Build.AppVeyor"/> instance.</returns>
[CakePropertyAlias(Cache = true)]
[CakeNamespaceImport("Cake.Common.Build.AppVeyor")]
[CakeNamespaceImport("Cake.Common.Build.AppVeyor.Data")]
public static IAppVeyorProvider AppVeyor(this ICakeContext context)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
var buildSystem = context.BuildSystem();
return buildSystem.AppVeyor;
}

BuildSystem has an GitHubActions property

/// <summary>
/// Gets the GitHub Actions Provider.
/// </summary>
/// <example>
/// <code>
/// if (BuildSystem.IsRunningOnGitHubActions)
/// {
/// // Get the workflow name.
/// var workflow = BuildSystem.GitHubActions.Environment.Workflow.Workflow;
/// }
/// </code>
/// </example>
public IGitHubActionsProvider GitHubActions { get; }

Namespaces

namespace Cake.Common.Build.GitHubActions

namespace Cake.Common.Build.GitHubActions.Data

Marking as up for grabs / good first issue.

@gitfool
Copy link
Contributor

gitfool commented Jan 13, 2020

@RehanSaeed good catch. It was indeed an oversight due to me not using it that way.

@cake-build-bot
Copy link

cake-build-bot commented Feb 1, 2020

🎉 This issue has been resolved in version v0.37.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants