Skip to content

Commit

Permalink
Merge pull request #15 from rwx-research/use-install-id-instead-of-ru…
Browse files Browse the repository at this point in the history
…n-id

support new release API
  • Loading branch information
michaelglass authored Feb 1, 2023
2 parents 66dbfcb + eda59e3 commit 534b968
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4,491 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
node_modules
.direnv
# yarn run build and npm run build produce different outputs.
# right now, CI only supports building with npm. So we disallow yarn.lock to nudge contributors to use npm.
yarn.lock
5 changes: 1 addition & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,4 @@ inputs:
required: false
default: v1
run-id:
description: |
Unique run attempt ID. One will be generated from the GitHub
RUN_ID and RUN_ATTEMPT if available.
required: false
deprecationMessage: "This is no longer used and can be safely removed from your action usage."
10 changes: 3 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6596,11 +6596,7 @@ function getArch() {
}
}
}
function getRunId() {
const providedRunId = core.getInput('run-id');
if (providedRunId && providedRunId.trim().length > 0) {
return providedRunId.trim();
}
function getInstallId() {
const runId = process.env.GITHUB_RUN_ID;
const runAttempt = process.env.GITHUB_RUN_ATTEMPT || '1';
return `${runId}-${runAttempt}`;
Expand All @@ -6617,8 +6613,8 @@ function run() {
}
const os = getOs();
const arch = getArch();
const runId = getRunId();
const downloadUrl = `https://abq.build/api/releases/${releaseChannel}?os=${os}&arch=${arch}&run_id=${runId}`;
const installId = getInstallId();
const downloadUrl = `https://abq.build/api/releases/${releaseChannel}?os=${os}&arch=${arch}&install_id=${installId}`;
core.debug(`fetching ${downloadUrl}`);
const abqTar = yield tc.downloadTool(downloadUrl,
/* dest */ undefined, `Bearer ${accessToken}`);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-abq",
"version": "1.0.5",
"version": "1.0.6",
"private": true,
"description": "This action installs the abq binary.",
"main": "dist/index.js",
Expand Down
11 changes: 3 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ function getArch() {
}
}

function getRunId() {
const providedRunId = core.getInput('run-id')
if (providedRunId && providedRunId.trim().length > 0) {
return providedRunId.trim()
}

function getInstallId() {
const runId = process.env.GITHUB_RUN_ID
const runAttempt = process.env.GITHUB_RUN_ATTEMPT || '1'

Expand All @@ -46,9 +41,9 @@ async function run() {
}
const os = getOs()
const arch = getArch()
const runId = getRunId()
const installId = getInstallId()

const downloadUrl = `https://abq.build/api/releases/${releaseChannel}?os=${os}&arch=${arch}&run_id=${runId}`
const downloadUrl = `https://abq.build/api/releases/${releaseChannel}?os=${os}&arch=${arch}&install_id=${installId}`
core.debug(`fetching ${downloadUrl}`)
const abqTar = await tc.downloadTool(
downloadUrl,
Expand Down
Loading

0 comments on commit 534b968

Please sign in to comment.