generated from pabio/github-actions-starter
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
825fb19
commit d70f7a6
Showing
17 changed files
with
127 additions
and
132 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
export const replaceEnvironmentVariables = (str: string) => { | ||
Object.keys(process.env).forEach((key) => { | ||
str = str.replace(`$${key}`, process.env[key] || `$${key}`); | ||
const SECRETS_CONTEXT = process.env.SECRETS_CONTEXT || "{}"; | ||
const allSecrets: Record<string, string> = JSON.parse(SECRETS_CONTEXT); | ||
const secrets: Record<string, any> = { ...JSON.parse(JSON.stringify(process.env)), allSecrets }; | ||
Object.keys(secrets).forEach((key) => { | ||
str = str.replace(`$${key}`, secrets[key] || `$${key}`); | ||
}); | ||
return str; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { Octokit } from "@octokit/rest"; | ||
import { getConfig } from "./config"; | ||
import { getSecret } from "./secrets"; | ||
|
||
export const getOctokit = async (): Promise<Octokit> => { | ||
const config = await getConfig(); | ||
return new Octokit({ | ||
auth: config.PAT || process.env.GH_PAT || process.env.GITHUB_TOKEN, | ||
userAgent: config["user-agent"] || process.env.USER_AGENT || "KojBot", | ||
auth: config.PAT || getSecret("GH_PAT") || getSecret("GITHUB_TOKEN"), | ||
userAgent: config["user-agent"] || getSecret("USER_AGENT") || "KojBot", | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.