mirror of
https://github.com/Mozilla-Actions/sccache-action.git
synced 2026-04-08 17:42:13 +08:00
Use the latest version of sccache if no version is specified (#27)
This commit is contained in:
17
src/setup.ts
17
src/setup.ts
@@ -19,16 +19,25 @@ import {
|
||||
extractZip,
|
||||
cacheDir
|
||||
} from '@actions/tool-cache';
|
||||
import {getOctokit} from '@actions/github';
|
||||
|
||||
import * as fs from 'fs';
|
||||
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
async function setup() {
|
||||
// TODO: we can support install latest version by default if version
|
||||
// is not input.
|
||||
const version = core.getInput('version');
|
||||
core.info(`try to setup sccache version: ${version}'`);
|
||||
let version = core.getInput('version');
|
||||
if (version.length === 0) {
|
||||
// If no version is specified, the latest version is used by default.
|
||||
const token = core.getInput('token', {required: true});
|
||||
const octokit = getOctokit(token);
|
||||
const release = await octokit.rest.repos.getLatestRelease({
|
||||
owner: 'mozilla',
|
||||
repo: 'sccache'
|
||||
});
|
||||
version = release.data.tag_name;
|
||||
}
|
||||
core.info(`try to setup sccache version: ${version}`);
|
||||
|
||||
const filename = getFilename(version);
|
||||
const dirname = getDirname(version);
|
||||
|
||||
Reference in New Issue
Block a user