Skip to content

Commit

Permalink
Add secret source to start job step (#1411)
Browse files Browse the repository at this point in the history
* Add secret source to start job step

WIP

* Update to use GetGitHubContext to grab source info

* Update JobExtensionL0.cs

* Update JobExtension.cs

* Update JobExtension.cs
  • Loading branch information
lauraway committed Nov 17, 2021
1 parent 3e34fb1 commit dcc5d34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Runner.Worker/JobExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ public async Task<List<IStep>> InitializeJob(IExecutionContext jobContext, Pipel
Trace.Error(ex);
}

var secretSource = context.GetGitHubContext("secret_source");
if (!string.IsNullOrEmpty(secretSource))
{
context.Output($"Secret source: {secretSource}");
}

var repoFullName = context.GetGitHubContext("repository");
ArgUtil.NotNull(repoFullName, nameof(repoFullName));
context.Debug($"Primary repository: {repoFullName}");
Expand Down
1 change: 1 addition & 0 deletions src/Test/L0/Worker/JobExtensionL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ private TestHostContext CreateTestContext([CallerMemberName] String testName = "
_message = new Pipelines.AgentJobRequestMessage(plan, timeline, jobId, "test", "test", null, null, null, new Dictionary<string, VariableValue>(), new List<MaskHint>(), new Pipelines.JobResources(), new Pipelines.ContextData.DictionaryContextData(), new Pipelines.WorkspaceOptions(), steps, null, null, null, null);
GitHubContext github = new GitHubContext();
github["repository"] = new Pipelines.ContextData.StringContextData("actions/runner");
github["secret_source"] = new Pipelines.ContextData.StringContextData("Actions");
_message.ContextData.Add("github", github);

hc.SetSingleton(_actionManager.Object);
Expand Down

0 comments on commit dcc5d34

Please sign in to comment.