Merge pull request #43 from github/cschleiden/github_token
Always include GITHUB_TOKEN in the secrets
This commit is contained in:
@@ -18,13 +18,14 @@ export function contextProviders(
|
||||
auth: sessionToken
|
||||
});
|
||||
|
||||
const getContext = async (name: string) => {
|
||||
const getContext = async (name: string, defaultContext: data.Dictionary | undefined) => {
|
||||
switch (name) {
|
||||
case "secrets":
|
||||
const secrets = await getSecrets(octokit, cache, repo.owner, repo.name);
|
||||
const secretContext = new data.Dictionary();
|
||||
secrets.forEach(secret => secretContext.add(secret.value, secret));
|
||||
return secretContext;
|
||||
|
||||
defaultContext = defaultContext || new data.Dictionary();
|
||||
secrets.forEach(secret => defaultContext!.add(secret.value, new data.StringData("***")));
|
||||
return defaultContext;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -2,8 +2,15 @@ import {StringData} from "@github/actions-expressions/data/string";
|
||||
import {Octokit} from "@octokit/rest";
|
||||
import {TTLCache} from "../utils/cache";
|
||||
|
||||
export function getSecrets(octokit: Octokit, cache: TTLCache, owner: string, name: string): Promise<StringData[]> {
|
||||
return cache.get(`${owner}/${name}/secrets`, undefined, () => fetchSecrets(octokit, owner, name));
|
||||
export async function getSecrets(
|
||||
octokit: Octokit,
|
||||
cache: TTLCache,
|
||||
owner: string,
|
||||
name: string
|
||||
): Promise<StringData[]> {
|
||||
const repoSecrets = await cache.get(`${owner}/${name}/secrets`, undefined, () => fetchSecrets(octokit, owner, name));
|
||||
|
||||
return repoSecrets;
|
||||
}
|
||||
|
||||
async function fetchSecrets(octokit: Octokit, owner: string, name: string): Promise<StringData[]> {
|
||||
|
||||
Reference in New Issue
Block a user