@@ -13703,12 +13703,12 @@ function getPatcherEnvVars(gitCommiter, token) {
1370313703 GIT_AUTHOR_EMAIL: gitCommiter.email,
1370413704 };
1370513705}
13706- async function runPatcher(gitCommiter, command, { specFile, includeDirs, excludeDirs, updateStrategy, prBranch, prTitle, dependency, workingDir, token , dryRun, noColor, }) {
13706+ async function runPatcher(gitCommiter, command, { specFile, includeDirs, excludeDirs, updateStrategy, prBranch, prTitle, dependency, workingDir, updateToken , dryRun, noColor, }) {
1370713707 switch (command) {
1370813708 case REPORT_COMMAND: {
1370913709 core.startGroup("Running 'patcher report'");
1371013710 const reportOutput = await exec.getExecOutput("patcher", reportArgs(specFile, includeDirs, excludeDirs, workingDir, noColor), {
13711- env: getPatcherEnvVars(gitCommiter, token ),
13711+ env: getPatcherEnvVars(gitCommiter, updateToken ),
1371213712 });
1371313713 core.endGroup();
1371413714 core.startGroup("Setting upgrade spec output");
@@ -13729,7 +13729,7 @@ async function runPatcher(gitCommiter, command, { specFile, includeDirs, exclude
1372913729 }
1373013730 core.startGroup(groupName);
1373113731 const updateOutput = await exec.getExecOutput("patcher", updateArgs(specFile, updateStrategy, prBranch, prTitle, dependency, workingDir, dryRun, noColor), {
13732- env: getPatcherEnvVars(gitCommiter, token ),
13732+ env: getPatcherEnvVars(gitCommiter, updateToken ),
1373313733 });
1373413734 core.endGroup();
1373513735 core.startGroup("Setting 'updateResult' output");
@@ -13768,7 +13768,8 @@ async function validateAccessToPatcherCli(octokit) {
1376813768 }
1376913769}
1377013770async function run() {
13771- const token = core.getInput("github_token");
13771+ const gruntworkToken = core.getInput("github_token");
13772+ const patcherUpdateToken = core.getInput("update_token");
1377213773 const command = core.getInput("patcher_command");
1377313774 const updateStrategy = core.getInput("update_strategy");
1377413775 const dependency = core.getInput("dependency");
@@ -13781,10 +13782,15 @@ async function run() {
1378113782 const prTitle = core.getInput("pull_request_title");
1378213783 const dryRun = core.getBooleanInput("dry_run");
1378313784 const noColor = core.getBooleanInput("no_color");
13784- // Always mask the `token` string in the logs.
13785- core.setSecret(token);
13785+ // if the user didn't specify a token specifically for `patcher update`,
13786+ // that's ok, we can try to use the github token instead. doing this adoption
13787+ // is for back compatibility reasons
13788+ const updateToken = patcherUpdateToken ? patcherUpdateToken : gruntworkToken;
13789+ // Always mask the token strings in the logs.
13790+ core.setSecret(gruntworkToken);
13791+ core.setSecret(updateToken);
1378613792 // Only run the action if the user has access to Patcher. Otherwise, the download won't work.
13787- const octokit = github.getOctokit(token );
13793+ const octokit = github.getOctokit(gruntworkToken );
1378813794 await validateAccessToPatcherCli(octokit);
1378913795 // Validate if the 'patcher_command' provided is valid.
1379013796 if (!isPatcherCommandValid(command)) {
@@ -13794,7 +13800,7 @@ async function run() {
1379413800 // Validate if 'commit_author' has a valid format.
1379513801 const gitCommiter = parseCommitAuthor(commitAuthor);
1379613802 core.startGroup("Downloading Patcher and patch tools");
13797- await downloadAndSetupTooling(octokit, token );
13803+ await downloadAndSetupTooling(octokit, gruntworkToken );
1379813804 core.endGroup();
1379913805 await runPatcher(gitCommiter, command, {
1380013806 specFile,
@@ -13805,7 +13811,7 @@ async function run() {
1380513811 prTitle,
1380613812 dependency,
1380713813 workingDir,
13808- token ,
13814+ updateToken ,
1380913815 dryRun,
1381013816 noColor,
1381113817 });
0 commit comments