Skip to content

Commit

Permalink
Fix exception Secrets are case insensitive (actions#32)
Browse files Browse the repository at this point in the history
github_token vs GITHUB_TOKEN

Resolves actions#29
  • Loading branch information
ChristopherHX committed May 13, 2021
1 parent 26ebcc6 commit e56a121
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Runner.Server/Controllers/MessageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1411,15 +1411,20 @@ private class shared {
var resources = new JobResources();


var variables = new Dictionary<String, GitHub.DistributedTask.WebApi.VariableValue>();
var variables = new Dictionary<String, GitHub.DistributedTask.WebApi.VariableValue>(StringComparer.OrdinalIgnoreCase);
variables.Add("system.github.token", new VariableValue(GITHUB_TOKEN, true));
variables.Add("github_token", new VariableValue(GITHUB_TOKEN, true));
variables.Add("DistributedTask.NewActionMetadata", new VariableValue("true", false));
foreach (var secret in this.secrets) {
variables[secret.Name] = new VariableValue(secret.Value, true);
}
if(secrets != null) {
LoadEnvSec(secrets, (name, value) => variables[name] = new VariableValue(value, true));
LoadEnvSec(secrets, (name, value) => {
variables[name] = new VariableValue(value, true);
if(StringComparer.OrdinalIgnoreCase.Compare("github_token", name) == 0) {
variables["system.github.token"] = new VariableValue(value, true);
}
});
}

var defaultToken = (from r in run where r.Key.AssertString("defaults").Value == "defaults" select r).FirstOrDefault().Value;
Expand Down

0 comments on commit e56a121

Please sign in to comment.