Skip to content

Commit

Permalink
Add IsAvailable property (#11)
Browse files Browse the repository at this point in the history
* Add IsAvailable property

Implements #10

* Update src/Actions.Core/Summaries/Summary.cs

Co-authored-by: David Pine <david.pine@microsoft.com>

* Update src/Actions.Core/Summaries/Summary.cs

Co-authored-by: David Pine <david.pine@microsoft.com>

---------

Co-authored-by: David Pine <david.pine@microsoft.com>
  • Loading branch information
flcdrg and IEvangelist committed Apr 8, 2024
1 parent 028cacd commit 48aea4e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Actions.Core/Summaries/Summary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ private enum Mode { Unspecified, Html, Markdown };
/// <returns><c>true</c> if the buffer is empty</returns>
public bool IsBufferEmpty => _buffer.Length is 0;

/// <summary>
/// Returns <c>true</c> if <c>GITHUB_STEP_SUMMARY</c> environment variable is set (as is the case when running in a GitHub Actions workflow).
/// </summary>
public static bool IsAvailable => GetEnvironmentVariable(GITHUB_STEP_SUMMARY) is not null;

/// <summary>Finds the summary file path from the environment, rejects if env var
/// is not found or file does not exist. Also checks r/w permissions.</summary>
/// <returns>The step summary file path</returns>
Expand Down

0 comments on commit 48aea4e

Please sign in to comment.