Skip to content

Commit

Permalink
♻️ Read .env from SECRETS_CONTEXT
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Dec 2, 2020
1 parent 9ba423c commit ac1b1e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { getInput, setFailed } from "@actions/core";

const token = getInput("token") || process.env.GH_PAT || process.env.GITHUB_TOKEN;
const SECRETS_CONTEXT = process.env.SECRETS_CONTEXT || "{}";
const allSecrets: Record<string, string> = JSON.parse(SECRETS_CONTEXT);
Object.keys(allSecrets).forEach((key) => {
process.env[key] = allSecrets[key];
});

export const run = async () => {
if (!token) throw new Error("GitHub token not found");
Expand Down

0 comments on commit ac1b1e2

Please sign in to comment.