Skip to content

Commit

Permalink
fix: add token to fetch download
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenvechain committed Jun 12, 2024
1 parent afb487a commit f0f5a9a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
branches:
- '*'

permissions:
contents: read

jobs:
test-action:
strategy:
Expand Down
15 changes: 14 additions & 1 deletion action/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30725,6 +30725,11 @@ async function getDownloadURL(version) {
core.info(`Platform: ${platform}`)
core.info(`Arch: ${arch}`)

// https://github.com/vechain/networkhub/releases/download/v0.0.3/network-hub-macos-arm64

// https://github.com/vechain/networkhub/releases/download/v0.0.3/network-hub-macos-arm64


const url = `https://github.com/vechain/networkhub/releases/download/${version}/network-hub-${platform}-${arch}${process.platform === 'win32' ? '.exe' : ''}`;
core.info(`Download URL: ${url}`)
return url;
Expand All @@ -30742,8 +30747,16 @@ async function setup() {

core.info(`Installing networkHub version ${version}`)

//create an auth header using the token provided
const token = core.getInput('token');
if (!token) {
core.setFailed('No token specified')
return
}
// Download the specific version of the tool, e.g. as a tarball
const pathToCLI = await tc.downloadTool(await getDownloadURL(version));
const pathToCLI = await tc.downloadTool(await getDownloadURL(version), undefined, undefined, {
authorization: `Bearer ${token}`
});

// Expose the tool by adding it to the PATH
core.addPath(pathToCLI)
Expand Down
15 changes: 14 additions & 1 deletion action/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ async function getDownloadURL(version) {
core.info(`Platform: ${platform}`)
core.info(`Arch: ${arch}`)

// https://github.com/vechain/networkhub/releases/download/v0.0.3/network-hub-macos-arm64

// https://github.com/vechain/networkhub/releases/download/v0.0.3/network-hub-macos-arm64


const url = `https://github.com/vechain/networkhub/releases/download/${version}/network-hub-${platform}-${arch}${process.platform === 'win32' ? '.exe' : ''}`;
core.info(`Download URL: ${url}`)
return url;
Expand All @@ -56,8 +61,16 @@ async function setup() {

core.info(`Installing networkHub version ${version}`)

//create an auth header using the token provided
const token = core.getInput('token');
if (!token) {
core.setFailed('No token specified')
return
}
// Download the specific version of the tool, e.g. as a tarball
const pathToCLI = await tc.downloadTool(await getDownloadURL(version));
const pathToCLI = await tc.downloadTool(await getDownloadURL(version), undefined, undefined, {
authorization: `Bearer ${token}`
});

// Expose the tool by adding it to the PATH
core.addPath(pathToCLI)
Expand Down

0 comments on commit f0f5a9a

Please sign in to comment.