Skip to content

Commit

Permalink
Expose job name as $GITHUB_JOB (actions#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
TingluoHuang authored Mar 13, 2020
1 parent 53fb629 commit c8890d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Runner.Worker/ExecutionContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,13 @@ public void InitializeJob(Pipelines.AgentJobRequestMessage message, Cancellation
var githubAccessToken = new StringContextData(Variables.Get("system.github.token"));
var base64EncodedToken = Convert.ToBase64String(Encoding.UTF8.GetBytes($"x-access-token:{githubAccessToken}"));
HostContext.SecretMasker.AddValue(base64EncodedToken);
var githubJob = Variables.Get("system.github.job");
var githubContext = new GitHubContext();
githubContext["token"] = githubAccessToken;
if (!string.IsNullOrEmpty(githubJob))
{
githubContext["job"] = new StringContextData(githubJob);
}
var githubDictionary = ExpressionValues["github"].AssertDictionary("github");
foreach (var pair in githubDictionary)
{
Expand Down
1 change: 1 addition & 0 deletions src/Runner.Worker/GitHubContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public sealed class GitHubContext : DictionaryContextData, IEnvironmentContextDa
"event_name",
"event_path",
"head_ref",
"job",
"ref",
"repository",
"run_id",
Expand Down

0 comments on commit c8890d0

Please sign in to comment.