mirror of
https://github.com/DeLaGuardo/setup-clojure.git
synced 2024-12-27 08:31:04 +08:00
Support "github-token" parameter
This commit is contained in:
parent
fa522696ba
commit
016052c6fc
2
.github/workflows/smoke-tests.yml
vendored
2
.github/workflows/smoke-tests.yml
vendored
@ -90,6 +90,7 @@ jobs:
|
||||
uses: ./
|
||||
with:
|
||||
lein: 2.9.1
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Check leiningen version
|
||||
run: lein version
|
||||
@ -117,6 +118,7 @@ jobs:
|
||||
uses: ./
|
||||
with:
|
||||
boot: 2.8.3
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Check boot version
|
||||
run: boot -V
|
||||
|
@ -12,7 +12,11 @@ inputs:
|
||||
tools-deps:
|
||||
description: '[DEPRECATED] The tools deps version to make available on the path.'
|
||||
cli:
|
||||
description: 'Clojure CLI version to make availablr on the path.'
|
||||
description: 'Clojure CLI version to make available on the path.'
|
||||
github-token:
|
||||
description: >+
|
||||
To fix rate limit errors, provide `secrets.GITHUB_TOKEN` value to this field.
|
||||
More info: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'dist/index.js'
|
||||
|
14
dist/index.js
vendored
14
dist/index.js
vendored
@ -1621,14 +1621,14 @@ if (!tempDirectory) {
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
function setup(version) {
|
||||
function setup(version, githubAuth) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let toolPath = tc.find('Boot', utils.getCacheVersionString(version), os.arch());
|
||||
if (toolPath && version !== 'latest') {
|
||||
core.info(`Boot found in cache ${toolPath}`);
|
||||
}
|
||||
else {
|
||||
const bootBootstrapFile = yield tc.downloadTool(`https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh`);
|
||||
const bootBootstrapFile = yield tc.downloadTool(`https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh`, undefined, githubAuth);
|
||||
const tempDir = path.join(tempDirectory, `temp_${Math.floor(Math.random() * 2000000000)}`);
|
||||
const bootDir = yield installBoot(bootBootstrapFile, tempDir, version);
|
||||
core.debug(`Boot installed to ${bootDir}`);
|
||||
@ -3541,14 +3541,14 @@ const os = __importStar(__webpack_require__(87));
|
||||
const utils = __importStar(__webpack_require__(611));
|
||||
const tempDirectory = utils.getTempDir();
|
||||
const IS_WINDOWS = utils.isWindows();
|
||||
function setup(version) {
|
||||
function setup(version, githubAuth) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let toolPath = tc.find('Leiningen', utils.getCacheVersionString(version), os.arch());
|
||||
if (toolPath && version !== 'latest') {
|
||||
core.info(`Leiningen found in cache ${toolPath}`);
|
||||
}
|
||||
else {
|
||||
const leiningenFile = yield tc.downloadTool(`https://raw.githubusercontent.com/technomancy/leiningen/${version === 'latest' ? 'stable' : version}/bin/lein${IS_WINDOWS ? '.ps1' : ''}`);
|
||||
const leiningenFile = yield tc.downloadTool(`https://raw.githubusercontent.com/technomancy/leiningen/${version === 'latest' ? 'stable' : version}/bin/lein${IS_WINDOWS ? '.ps1' : ''}`, undefined, githubAuth);
|
||||
const tempDir = path.join(tempDirectory, `temp_${Math.floor(Math.random() * 2000000000)}`);
|
||||
const leiningenDir = yield installLeiningen(leiningenFile, tempDir);
|
||||
core.debug(`Leiningen installed to ${leiningenDir}`);
|
||||
@ -3645,14 +3645,16 @@ function run() {
|
||||
const BOOT_VERSION = core.getInput('boot');
|
||||
const TDEPS_VERSION = core.getInput('tools-deps');
|
||||
const CLI_VERSION = core.getInput('cli');
|
||||
const githubToken = core.getInput('github-token');
|
||||
const githubAuth = githubToken ? `token ${githubToken}` : undefined;
|
||||
if (LEIN_VERSION) {
|
||||
lein.setup(LEIN_VERSION);
|
||||
lein.setup(LEIN_VERSION, githubAuth);
|
||||
}
|
||||
if (BOOT_VERSION) {
|
||||
if (IS_WINDOWS) {
|
||||
throw new Error('Boot on windows is not supported yet.');
|
||||
}
|
||||
boot.setup(BOOT_VERSION);
|
||||
boot.setup(BOOT_VERSION, githubAuth);
|
||||
}
|
||||
if (CLI_VERSION) {
|
||||
if (IS_WINDOWS) {
|
||||
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@ -24,7 +24,10 @@ if (!tempDirectory) {
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp')
|
||||
}
|
||||
|
||||
export async function setup(version: string): Promise<void> {
|
||||
export async function setup(
|
||||
version: string,
|
||||
githubAuth?: string
|
||||
): Promise<void> {
|
||||
let toolPath = tc.find(
|
||||
'Boot',
|
||||
utils.getCacheVersionString(version),
|
||||
@ -35,7 +38,9 @@ export async function setup(version: string): Promise<void> {
|
||||
core.info(`Boot found in cache ${toolPath}`)
|
||||
} else {
|
||||
const bootBootstrapFile = await tc.downloadTool(
|
||||
`https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh`
|
||||
`https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh`,
|
||||
undefined,
|
||||
githubAuth
|
||||
)
|
||||
const tempDir: string = path.join(
|
||||
tempDirectory,
|
||||
|
@ -10,7 +10,10 @@ import * as utils from './utils'
|
||||
const tempDirectory = utils.getTempDir()
|
||||
const IS_WINDOWS = utils.isWindows()
|
||||
|
||||
export async function setup(version: string): Promise<void> {
|
||||
export async function setup(
|
||||
version: string,
|
||||
githubAuth?: string
|
||||
): Promise<void> {
|
||||
let toolPath = tc.find(
|
||||
'Leiningen',
|
||||
utils.getCacheVersionString(version),
|
||||
@ -23,7 +26,9 @@ export async function setup(version: string): Promise<void> {
|
||||
const leiningenFile = await tc.downloadTool(
|
||||
`https://raw.githubusercontent.com/technomancy/leiningen/${
|
||||
version === 'latest' ? 'stable' : version
|
||||
}/bin/lein${IS_WINDOWS ? '.ps1' : ''}`
|
||||
}/bin/lein${IS_WINDOWS ? '.ps1' : ''}`,
|
||||
undefined,
|
||||
githubAuth
|
||||
)
|
||||
const tempDir: string = path.join(
|
||||
tempDirectory,
|
||||
|
@ -13,15 +13,18 @@ async function run(): Promise<void> {
|
||||
const TDEPS_VERSION = core.getInput('tools-deps')
|
||||
const CLI_VERSION = core.getInput('cli')
|
||||
|
||||
const githubToken = core.getInput('github-token')
|
||||
const githubAuth = githubToken ? `token ${githubToken}` : undefined
|
||||
|
||||
if (LEIN_VERSION) {
|
||||
lein.setup(LEIN_VERSION)
|
||||
lein.setup(LEIN_VERSION, githubAuth)
|
||||
}
|
||||
|
||||
if (BOOT_VERSION) {
|
||||
if (IS_WINDOWS) {
|
||||
throw new Error('Boot on windows is not supported yet.')
|
||||
}
|
||||
boot.setup(BOOT_VERSION)
|
||||
boot.setup(BOOT_VERSION, githubAuth)
|
||||
}
|
||||
|
||||
if (CLI_VERSION) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user