users/ericsciple/m163tarball_efficient_download
parent
ad6dd29a96
commit
4af80cb867
|
@ -12,26 +12,26 @@ jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1 # todo: switch to v2
|
- uses: actions/checkout@v2-beta
|
||||||
- run: npm ci
|
# - run: npm ci
|
||||||
- run: npm run build
|
# - run: npm run build
|
||||||
- run: npm run format-check
|
# - run: npm run format-check
|
||||||
- run: npm run lint
|
# - run: npm run lint
|
||||||
- run: npm run pack
|
# - run: npm run pack
|
||||||
- run: npm run gendocs
|
# - run: npm run gendocs
|
||||||
- name: Verify no unstaged changes
|
# - name: Verify no unstaged changes
|
||||||
run: __test__/verify-no-unstaged-changes.sh
|
# run: __test__/verify-no-unstaged-changes.sh
|
||||||
|
|
||||||
test:
|
# test:
|
||||||
strategy:
|
# strategy:
|
||||||
matrix:
|
# matrix:
|
||||||
runs-on: [ubuntu-latest, macos-latest, windows-latest]
|
# runs-on: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
runs-on: ${{ matrix.runs-on }}
|
# runs-on: ${{ matrix.runs-on }}
|
||||||
|
|
||||||
steps:
|
# steps:
|
||||||
# Clone this repo
|
# # Clone this repo
|
||||||
- name: Checkout
|
# - name: Checkout
|
||||||
uses: actions/checkout@v1 # todo: switch to V2
|
# uses: actions/checkout@v1 # todo: switch to V2
|
||||||
|
|
||||||
# Basic checkout
|
# Basic checkout
|
||||||
- name: Basic checkout
|
- name: Basic checkout
|
||||||
|
|
|
@ -4807,7 +4807,7 @@ const gitCommandManager = __importStar(__webpack_require__(289));
|
||||||
const io = __importStar(__webpack_require__(1));
|
const io = __importStar(__webpack_require__(1));
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const refHelper = __importStar(__webpack_require__(227));
|
const refHelper = __importStar(__webpack_require__(227));
|
||||||
const repositoryApiHelper = __importStar(__webpack_require__(610));
|
const githubApiHelper = __importStar(__webpack_require__(464));
|
||||||
const authConfigKey = `http.https://github.com/.extraheader`;
|
const authConfigKey = `http.https://github.com/.extraheader`;
|
||||||
function getSource(settings) {
|
function getSource(settings) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
@ -4844,7 +4844,7 @@ function getSource(settings) {
|
||||||
yield prepareExistingDirectory(git, settings.repositoryPath, repositoryUrl, settings.clean);
|
yield prepareExistingDirectory(git, settings.repositoryPath, repositoryUrl, settings.clean);
|
||||||
}
|
}
|
||||||
if (!git || `${1}` == '1') {
|
if (!git || `${1}` == '1') {
|
||||||
yield repositoryApiHelper.download(settings.accessToken, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.repositoryPath);
|
yield githubApiHelper.downloadRepository(settings.accessToken, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.repositoryPath);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Initialize the repository
|
// Initialize the repository
|
||||||
|
@ -8063,6 +8063,50 @@ exports.RequestError = RequestError;
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 464:
|
||||||
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const github = __importStar(__webpack_require__(469));
|
||||||
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
function downloadRepository(accessToken, owner, repo, ref, repositoryPath) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const octokit = new github.GitHub(accessToken);
|
||||||
|
const params = {
|
||||||
|
archive_format: IS_WINDOWS ? 'zipball' : 'tarball',
|
||||||
|
owner: owner,
|
||||||
|
repo: repo,
|
||||||
|
ref: ref
|
||||||
|
};
|
||||||
|
const response = yield octokit.repos.getArchiveLink(params);
|
||||||
|
console.log(`status=${response.status}`);
|
||||||
|
console.log(`headers=${JSON.stringify(response.headers)}`);
|
||||||
|
console.log(`data=${JSON.stringify(typeof (response.data))}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.downloadRepository = downloadRepository;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 469:
|
/***/ 469:
|
||||||
|
@ -8932,50 +8976,6 @@ function octokitRestApiEndpoints(octokit) {
|
||||||
|
|
||||||
module.exports = require("http");
|
module.exports = require("http");
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 610:
|
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const github = __importStar(__webpack_require__(469));
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
|
||||||
function download(accessToken, owner, repo, ref, repositoryPath) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const octokit = new github.GitHub(accessToken);
|
|
||||||
const params = {
|
|
||||||
archive_format: IS_WINDOWS ? 'zipball' : 'tarball',
|
|
||||||
owner: owner,
|
|
||||||
repo: repo,
|
|
||||||
ref: ref
|
|
||||||
};
|
|
||||||
const response = yield octokit.repos.getArchiveLink(params);
|
|
||||||
console.log(`status=${response.status}`);
|
|
||||||
console.log(`headers=${JSON.stringify(response.headers)}`);
|
|
||||||
console.log(`data=${JSON.stringify(response.data)}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.download = download;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 614:
|
/***/ 614:
|
||||||
|
|
|
@ -6,7 +6,7 @@ import * as gitCommandManager from './git-command-manager'
|
||||||
import * as io from '@actions/io'
|
import * as io from '@actions/io'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as refHelper from './ref-helper'
|
import * as refHelper from './ref-helper'
|
||||||
import * as repositoryApiHelper from './repository-api-helper'
|
import * as githubApiHelper from './github-api-helper'
|
||||||
import {IGitCommandManager} from './git-command-manager'
|
import {IGitCommandManager} from './git-command-manager'
|
||||||
|
|
||||||
const authConfigKey = `http.https://github.com/.extraheader`
|
const authConfigKey = `http.https://github.com/.extraheader`
|
||||||
|
@ -79,7 +79,7 @@ export async function getSource(settings: ISourceSettings): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!git || `${1}` == '1') {
|
if (!git || `${1}` == '1') {
|
||||||
await repositoryApiHelper.download(
|
await githubApiHelper.downloadRepository(
|
||||||
settings.accessToken,
|
settings.accessToken,
|
||||||
settings.repositoryOwner,
|
settings.repositoryOwner,
|
||||||
settings.repositoryName,
|
settings.repositoryName,
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {ReposGetArchiveLinkParams} from '@octokit/rest'
|
||||||
|
|
||||||
const IS_WINDOWS = process.platform === 'win32'
|
const IS_WINDOWS = process.platform === 'win32'
|
||||||
|
|
||||||
export async function download(
|
export async function downloadRepository(
|
||||||
accessToken: string,
|
accessToken: string,
|
||||||
owner: string,
|
owner: string,
|
||||||
repo: string,
|
repo: string,
|
||||||
|
@ -20,5 +20,5 @@ export async function download(
|
||||||
const response = await octokit.repos.getArchiveLink(params)
|
const response = await octokit.repos.getArchiveLink(params)
|
||||||
console.log(`status=${response.status}`)
|
console.log(`status=${response.status}`)
|
||||||
console.log(`headers=${JSON.stringify(response.headers)}`)
|
console.log(`headers=${JSON.stringify(response.headers)}`)
|
||||||
console.log(`data=${JSON.stringify(response.data)}`)
|
console.log(`data=${JSON.stringify(typeof response.data)}`)
|
||||||
}
|
}
|
Loading…
Reference in New Issue