From b750541d2b898eda75e8a36fbee698c9c1978599 Mon Sep 17 00:00:00 2001 From: eric sciple Date: Mon, 9 Dec 2019 17:01:19 -0500 Subject: . --- .github/workflows/test.yml | 36 ++++++++--------- dist/index.js | 92 ++++++++++++++++++++++---------------------- src/git-source-provider.ts | 4 +- src/github-api-helper.ts | 24 ++++++++++++ src/repository-api-helper.ts | 24 ------------ 5 files changed, 90 insertions(+), 90 deletions(-) create mode 100644 src/github-api-helper.ts delete mode 100644 src/repository-api-helper.ts diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7876739..a485002 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,26 +12,26 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 # todo: switch to v2 - - run: npm ci - - run: npm run build - - run: npm run format-check - - run: npm run lint - - run: npm run pack - - run: npm run gendocs - - name: Verify no unstaged changes - run: __test__/verify-no-unstaged-changes.sh + - uses: actions/checkout@v2-beta + # - run: npm ci + # - run: npm run build + # - run: npm run format-check + # - run: npm run lint + # - run: npm run pack + # - run: npm run gendocs + # - name: Verify no unstaged changes + # run: __test__/verify-no-unstaged-changes.sh - test: - strategy: - matrix: - runs-on: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.runs-on }} + # test: + # strategy: + # matrix: + # runs-on: [ubuntu-latest, macos-latest, windows-latest] + # runs-on: ${{ matrix.runs-on }} - steps: - # Clone this repo - - name: Checkout - uses: actions/checkout@v1 # todo: switch to V2 + # steps: + # # Clone this repo + # - name: Checkout + # uses: actions/checkout@v1 # todo: switch to V2 # Basic checkout - name: Basic checkout diff --git a/dist/index.js b/dist/index.js index 52679ff..f6bf49e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4807,7 +4807,7 @@ const gitCommandManager = __importStar(__webpack_require__(289)); const io = __importStar(__webpack_require__(1)); const path = __importStar(__webpack_require__(622)); 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`; function getSource(settings) { return __awaiter(this, void 0, void 0, function* () { @@ -4844,7 +4844,7 @@ function getSource(settings) { yield prepareExistingDirectory(git, settings.repositoryPath, repositoryUrl, settings.clean); } 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 { // Initialize the repository @@ -8063,6 +8063,50 @@ exports.RequestError = RequestError; //# 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: @@ -8932,50 +8976,6 @@ function octokitRestApiEndpoints(octokit) { 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: diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts index dc3e27e..f96cd5d 100644 --- a/src/git-source-provider.ts +++ b/src/git-source-provider.ts @@ -6,7 +6,7 @@ import * as gitCommandManager from './git-command-manager' import * as io from '@actions/io' import * as path from 'path' 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' const authConfigKey = `http.https://github.com/.extraheader` @@ -79,7 +79,7 @@ export async function getSource(settings: ISourceSettings): Promise { } if (!git || `${1}` == '1') { - await repositoryApiHelper.download( + await githubApiHelper.downloadRepository( settings.accessToken, settings.repositoryOwner, settings.repositoryName, diff --git a/src/github-api-helper.ts b/src/github-api-helper.ts new file mode 100644 index 0000000..3da0154 --- /dev/null +++ b/src/github-api-helper.ts @@ -0,0 +1,24 @@ +import * as github from '@actions/github' +import {ReposGetArchiveLinkParams} from '@octokit/rest' + +const IS_WINDOWS = process.platform === 'win32' + +export async function downloadRepository( + accessToken: string, + owner: string, + repo: string, + ref: string, + repositoryPath: string +): Promise { + const octokit = new github.GitHub(accessToken) + const params: ReposGetArchiveLinkParams = { + archive_format: IS_WINDOWS ? 'zipball' : 'tarball', + owner: owner, + repo: repo, + ref: ref + } + const response = await octokit.repos.getArchiveLink(params) + console.log(`status=${response.status}`) + console.log(`headers=${JSON.stringify(response.headers)}`) + console.log(`data=${JSON.stringify(typeof response.data)}`) +} diff --git a/src/repository-api-helper.ts b/src/repository-api-helper.ts deleted file mode 100644 index 2e7d69b..0000000 --- a/src/repository-api-helper.ts +++ /dev/null @@ -1,24 +0,0 @@ -import * as github from '@actions/github' -import {ReposGetArchiveLinkParams} from '@octokit/rest' - -const IS_WINDOWS = process.platform === 'win32' - -export async function download( - accessToken: string, - owner: string, - repo: string, - ref: string, - repositoryPath: string -): Promise { - const octokit = new github.GitHub(accessToken) - const params: ReposGetArchiveLinkParams = { - archive_format: IS_WINDOWS ? 'zipball' : 'tarball', - owner: owner, - repo: repo, - ref: ref - } - const response = await octokit.repos.getArchiveLink(params) - console.log(`status=${response.status}`) - console.log(`headers=${JSON.stringify(response.headers)}`) - console.log(`data=${JSON.stringify(response.data)}`) -} -- cgit v1.2.3