From ede2aadc7180f6711bfc2595ec465c8b4d1062bb Mon Sep 17 00:00:00 2001 From: abe-winter Date: Wed, 9 Oct 2024 14:48:52 -0400 Subject: [PATCH] APP-6153 pass checkout token (#5) * try using GITHUB_TOKEN env var * different env * more logging to diagnose * consume token manually * that was a build error apparently * rm trace, edit readme * make artifact match source * update packages + try again --- .github/workflows/lint.yml | 2 +- README.md | 1 + action.yml | 2 ++ dist/index.js | 3 +++ src/index.js | 3 +++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 26a3424..e0877ab 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,5 +12,5 @@ jobs: run: node_modules/.bin/eslint src - name: confirm js artifact matches source run: | - make dist/index.js + make -B dist/index.js git diff --exit-code diff --git a/README.md b/README.md index af954c3..c02b509 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Your customers are deploying to different kinds of hardware, and prototyping on ref: ${{ github.sha }} key-id: ${{ secrets.viam_key_id }} key-value: ${{ secrets.viam_key_value }} + token: ${{ github.token }} # only required for private git repos ``` 1. Add your build commands in your meta.json ([instructions below](#build-commands)). diff --git a/action.yml b/action.yml index ef8aa89..a360271 100644 --- a/action.yml +++ b/action.yml @@ -15,6 +15,8 @@ inputs: description: Version to set for the module. If missing, your module will build but not upload. ref: description: The git ref to build. This will usually be a sha, but can be a branch or anything supported by git checkout. + token: + description: Pass `github.token` if this is a private repository. runs: using: node20 diff --git a/dist/index.js b/dist/index.js index a7cc0ea..1eb0341 100644 --- a/dist/index.js +++ b/dist/index.js @@ -26968,6 +26968,9 @@ function parseBuildId(stdout) { if (config.ref) { startArgs.push('--ref', config.ref); } + if (getInput('token')) { + startArgs.push('--token', getInput('token')); + } const spawnRet = spawnSync(cliPath, startArgs); checkSpawnSync(spawnRet); const buildId = parseBuildId(spawnRet.stdout); diff --git a/src/index.js b/src/index.js index a3d8751..d099833 100644 --- a/src/index.js +++ b/src/index.js @@ -122,6 +122,9 @@ function parseBuildId(stdout) { if (config.ref) { startArgs.push('--ref', config.ref); } + if (getInput('token')) { + startArgs.push('--token', getInput('token')); + } const spawnRet = spawnSync(cliPath, startArgs); checkSpawnSync(spawnRet); const buildId = parseBuildId(spawnRet.stdout);