Skip to content

Commit

Permalink
Generate matchToken inside action()
Browse files Browse the repository at this point in the history
  • Loading branch information
mheap committed Jun 8, 2023
1 parent 8156efe commit 8a9dc86
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
const core = require("@actions/core");
const github = require("@actions/github");

// Use a guaranteed-unique (but persistent) string to match "our" comment
// https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
const matchTokenId = [
process.env.GITHUB_WORKFLOW,
process.env.GITHUB_JOB,
process.env.GITHUB_ACTION,
].join('/');
const matchToken = `<!-- ${matchTokenId} -->\n`;

let matchToken;
async function action() {
// Use a guaranteed-unique (but persistent) string to match "our" comment
// https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
const matchTokenId = [
process.env.GITHUB_WORKFLOW,
process.env.GITHUB_JOB,
process.env.GITHUB_ACTION,
].join("/");

matchToken = `<!-- ${matchTokenId} -->\n`;

try {
const token = core.getInput("token", { required: true });
const octokit = github.getOctokit(token);
Expand Down

0 comments on commit 8a9dc86

Please sign in to comment.