Compare commits
7 Commits
v3.2.0
...
releases/v
Author | SHA1 | Date | |
---|---|---|---|
ee0669bd1c | |||
dc323e67f1 | |||
e2f20e631a | |||
b2eb13baee | |||
7884fcad6b | |||
f67ee5d622 | |||
f25a3a9f25 |
6
.github/workflows/check-dist.yml
vendored
6
.github/workflows/check-dist.yml
vendored
@ -22,12 +22,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set Node.js 16.x
|
||||
- name: Set Node.js 12.x
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 16.x
|
||||
node-version: 12.x
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@ -39,7 +39,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
|
2
.github/workflows/licensed.yml
vendored
2
.github/workflows/licensed.yml
vendored
@ -9,6 +9,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
name: Check licenses
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- run: npm ci
|
||||
- run: npm run licensed-check
|
10
.github/workflows/test.yml
vendored
10
.github/workflows/test.yml
vendored
@ -13,8 +13,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 16.x
|
||||
- uses: actions/checkout@v3
|
||||
node-version: 12.x
|
||||
- uses: actions/checkout@v2
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm run format-check
|
||||
@ -32,7 +32,7 @@ jobs:
|
||||
steps:
|
||||
# Clone this repo
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Basic checkout
|
||||
- name: Checkout basic
|
||||
@ -150,7 +150,7 @@ jobs:
|
||||
steps:
|
||||
# Clone this repo
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Basic checkout using git
|
||||
- name: Checkout basic
|
||||
@ -182,7 +182,7 @@ jobs:
|
||||
steps:
|
||||
# Clone this repo
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Basic checkout using git
|
||||
- name: Checkout basic
|
||||
|
30
.github/workflows/update-main-version.yml
vendored
30
.github/workflows/update-main-version.yml
vendored
@ -1,30 +0,0 @@
|
||||
name: Update Main Version
|
||||
run-name: Move ${{ github.event.inputs.main_version }} to ${{ github.event.inputs.target }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
target:
|
||||
description: The tag or reference to use
|
||||
required: true
|
||||
main_version:
|
||||
type: choice
|
||||
description: The main version to update
|
||||
options:
|
||||
- v3
|
||||
|
||||
jobs:
|
||||
tag:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Git config
|
||||
run: |
|
||||
git config user.name github-actions
|
||||
git config user.email github-actions@github.com
|
||||
- name: Tag new target
|
||||
run: git tag -f ${{ github.event.inputs.main_version }} ${{ github.event.inputs.target }}
|
||||
- name: Push new tag
|
||||
run: git push origin ${{ github.event.inputs.main_version }} --force
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,4 +2,3 @@ __test__/_temp
|
||||
_temp/
|
||||
lib/
|
||||
node_modules/
|
||||
.vscode/
|
2
.licenses/npm/qs.dep.yml
generated
2
.licenses/npm/qs.dep.yml
generated
@ -1,6 +1,6 @@
|
||||
---
|
||||
name: qs
|
||||
version: 6.10.1
|
||||
version: 6.11.0
|
||||
type: npm
|
||||
summary: A querystring parser that supports nesting and arrays, with a depth limit
|
||||
homepage: https://github.com/ljharb/qs
|
||||
|
2
.licenses/npm/uuid-3.3.3.dep.yml
generated
2
.licenses/npm/uuid-3.3.3.dep.yml
generated
@ -3,7 +3,7 @@ name: uuid
|
||||
version: 3.3.3
|
||||
type: npm
|
||||
summary: RFC4122 (v1, v4, and v5) UUIDs
|
||||
homepage: https://github.com/kelektiv/node-uuid#readme
|
||||
homepage:
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE.md
|
||||
|
2
.licenses/npm/uuid-8.3.2.dep.yml
generated
2
.licenses/npm/uuid-8.3.2.dep.yml
generated
@ -3,7 +3,7 @@ name: uuid
|
||||
version: 8.3.2
|
||||
type: npm
|
||||
summary: RFC4122 (v1, v4, and v5) UUIDs
|
||||
homepage: https://github.com/uuidjs/uuid#readme
|
||||
homepage:
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE.md
|
||||
|
19
CHANGELOG.md
19
CHANGELOG.md
@ -1,24 +1,19 @@
|
||||
# Changelog
|
||||
|
||||
## v3.1.0
|
||||
- [Use @actions/core `saveState` and `getState`](https://github.com/actions/checkout/pull/939)
|
||||
- [Add `github-server-url` input](https://github.com/actions/checkout/pull/922)
|
||||
## v2.5.0
|
||||
- [Bump @actions/core to v1.10.0](https://github.com/actions/checkout/pull/962)
|
||||
|
||||
## v3.0.2
|
||||
- [Add input `set-safe-directory`](https://github.com/actions/checkout/pull/770)
|
||||
## v2.4.2
|
||||
- [Add input `set-safe-directory`](https://github.com/actions/checkout/pull/776)
|
||||
|
||||
## v3.0.1
|
||||
- [Fixed an issue where checkout failed to run in container jobs due to the new git setting `safe.directory`](https://github.com/actions/checkout/pull/762)
|
||||
- [Bumped various npm package versions](https://github.com/actions/checkout/pull/744)
|
||||
|
||||
## v3.0.0
|
||||
|
||||
- [Update to node 16](https://github.com/actions/checkout/pull/689)
|
||||
## v2.4.1
|
||||
- [Set the safe directory option on git to prevent git commands failing when running in containers](https://github.com/actions/checkout/pull/762)
|
||||
|
||||
## v2.3.1
|
||||
|
||||
- [Fix default branch resolution for .wiki and when using SSH](https://github.com/actions/checkout/pull/284)
|
||||
|
||||
|
||||
## v2.3.0
|
||||
|
||||
- [Fallback to the default branch](https://github.com/actions/checkout/pull/278)
|
||||
|
@ -1,28 +0,0 @@
|
||||
# Contributing
|
||||
|
||||
## Submitting a pull request
|
||||
|
||||
1. Fork and clone the repository
|
||||
1. Configure and install the dependencies: `npm install`
|
||||
1. Create a new branch: `git checkout -b my-branch-name`
|
||||
1. Make your change, add tests, and make sure the tests still pass: `npm run test`
|
||||
1. Make sure your code is correctly formatted: `npm run format`
|
||||
1. Update `dist/index.js` using `npm run build`. This creates a single javascript file that is used as an entrypoint for the action
|
||||
1. Push to your fork and submit a pull request
|
||||
1. Pat yourself on the back and wait for your pull request to be reviewed and merged
|
||||
|
||||
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
||||
|
||||
- Write tests.
|
||||
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
|
||||
|
||||
## Resources
|
||||
|
||||
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
||||
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
|
||||
- [GitHub Help](https://help.github.com)
|
||||
- [Writing good commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
||||
|
||||
Thanks! :heart: :heart: :heart:
|
||||
|
||||
GitHub Actions Team :octocat:
|
55
README.md
55
README.md
@ -1,6 +1,8 @@
|
||||
[](https://github.com/actions/checkout/actions/workflows/test.yml)
|
||||
<p align="center">
|
||||
<a href="https://github.com/actions/checkout"><img alt="GitHub Actions status" src="https://github.com/actions/checkout/workflows/test-local/badge.svg"></a>
|
||||
</p>
|
||||
|
||||
# Checkout V3
|
||||
# Checkout V2
|
||||
|
||||
This action checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it.
|
||||
|
||||
@ -12,14 +14,27 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
|
||||
|
||||
# What's new
|
||||
|
||||
- Updated to the node16 runtime by default
|
||||
- This requires a minimum [Actions Runner](https://github.com/actions/runner/releases/tag/v2.285.0) version of v2.285.0 to run, which is by default available in GHES 3.4 or later.
|
||||
- Improved performance
|
||||
- Fetches only a single commit by default
|
||||
- Script authenticated git commands
|
||||
- Auth token persisted in the local git config
|
||||
- Supports SSH
|
||||
- Creates a local branch
|
||||
- No longer detached HEAD when checking out a branch
|
||||
- Improved layout
|
||||
- The input `path` is always relative to $GITHUB_WORKSPACE
|
||||
- Aligns better with container actions, where $GITHUB_WORKSPACE gets mapped in
|
||||
- Fallback to REST API download
|
||||
- When Git 2.18 or higher is not in the PATH, the REST API will be used to download the files
|
||||
- When using a job container, the container's PATH is used
|
||||
|
||||
Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous versions.
|
||||
|
||||
# Usage
|
||||
|
||||
<!-- start usage -->
|
||||
```yaml
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# Repository name with owner. For example, actions/checkout
|
||||
# Default: ${{ github.repository }}
|
||||
@ -95,12 +110,6 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
|
||||
# config --global --add safe.directory <path>`
|
||||
# Default: true
|
||||
set-safe-directory: ''
|
||||
|
||||
# The base URL for the GitHub instance that you are trying to clone from, will use
|
||||
# environment defaults to fetch from the same instance that the workflow is
|
||||
# running from unless specified. Example URLs are https://github.com or
|
||||
# https://my-ghes-server.example.com
|
||||
github-server-url: ''
|
||||
```
|
||||
<!-- end usage -->
|
||||
|
||||
@ -119,7 +128,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
|
||||
## Fetch all history for all tags and branches
|
||||
|
||||
```yaml
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
```
|
||||
@ -127,7 +136,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
|
||||
## Checkout a different branch
|
||||
|
||||
```yaml
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: my-branch
|
||||
```
|
||||
@ -135,7 +144,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
|
||||
## Checkout HEAD^
|
||||
|
||||
```yaml
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- run: git checkout HEAD^
|
||||
@ -145,12 +154,12 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
|
||||
|
||||
```yaml
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: main
|
||||
|
||||
- name: Checkout tools repo
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: my-org/my-tools
|
||||
path: my-tools
|
||||
@ -160,10 +169,10 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
|
||||
|
||||
```yaml
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Checkout tools repo
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: my-org/my-tools
|
||||
path: my-tools
|
||||
@ -173,12 +182,12 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
|
||||
|
||||
```yaml
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: main
|
||||
|
||||
- name: Checkout private tools
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: my-org/my-private-tools
|
||||
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
|
||||
@ -191,7 +200,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
|
||||
## Checkout pull request HEAD commit instead of merge commit
|
||||
|
||||
```yaml
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
```
|
||||
@ -207,7 +216,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
```
|
||||
|
||||
## Push a commit using the built-in token
|
||||
@ -218,7 +227,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- run: |
|
||||
date > generated.txt
|
||||
git config user.name github-actions
|
||||
|
@ -20,7 +20,6 @@ let tempHomedir: string
|
||||
let git: IGitCommandManager & {env: {[key: string]: string}}
|
||||
let settings: IGitSourceSettings
|
||||
let sshPath: string
|
||||
let githubServerUrl: string
|
||||
|
||||
describe('git-auth-helper tests', () => {
|
||||
beforeAll(async () => {
|
||||
@ -68,18 +67,11 @@ describe('git-auth-helper tests', () => {
|
||||
}
|
||||
})
|
||||
|
||||
async function testAuthHeader(
|
||||
testName: string,
|
||||
serverUrl: string | undefined = undefined
|
||||
) {
|
||||
const configureAuth_configuresAuthHeader =
|
||||
'configureAuth configures auth header'
|
||||
it(configureAuth_configuresAuthHeader, async () => {
|
||||
// Arrange
|
||||
let expectedServerUrl = 'https://github.com'
|
||||
if (serverUrl) {
|
||||
githubServerUrl = serverUrl
|
||||
expectedServerUrl = githubServerUrl
|
||||
}
|
||||
|
||||
await setup(testName)
|
||||
await setup(configureAuth_configuresAuthHeader)
|
||||
expect(settings.authToken).toBeTruthy() // sanity check
|
||||
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
||||
|
||||
@ -96,33 +88,9 @@ describe('git-auth-helper tests', () => {
|
||||
).toString('base64')
|
||||
expect(
|
||||
configContent.indexOf(
|
||||
`http.${expectedServerUrl}/.extraheader AUTHORIZATION: basic ${basicCredential}`
|
||||
`http.https://github.com/.extraheader AUTHORIZATION: basic ${basicCredential}`
|
||||
)
|
||||
).toBeGreaterThanOrEqual(0)
|
||||
}
|
||||
|
||||
const configureAuth_configuresAuthHeader =
|
||||
'configureAuth configures auth header'
|
||||
it(configureAuth_configuresAuthHeader, async () => {
|
||||
await testAuthHeader(configureAuth_configuresAuthHeader)
|
||||
})
|
||||
|
||||
const configureAuth_AcceptsGitHubServerUrl =
|
||||
'inject https://my-ghes-server.com as github server url'
|
||||
it(configureAuth_AcceptsGitHubServerUrl, async () => {
|
||||
await testAuthHeader(
|
||||
configureAuth_AcceptsGitHubServerUrl,
|
||||
'https://my-ghes-server.com'
|
||||
)
|
||||
})
|
||||
|
||||
const configureAuth_AcceptsGitHubServerUrlSetToGHEC =
|
||||
'inject https://github.com as github server url'
|
||||
it(configureAuth_AcceptsGitHubServerUrlSetToGHEC, async () => {
|
||||
await testAuthHeader(
|
||||
configureAuth_AcceptsGitHubServerUrl,
|
||||
'https://github.com'
|
||||
)
|
||||
})
|
||||
|
||||
const configureAuth_configuresAuthHeaderEvenWhenPersistCredentialsFalse =
|
||||
@ -810,8 +778,7 @@ async function setup(testName: string): Promise<void> {
|
||||
sshKnownHosts: '',
|
||||
sshStrict: true,
|
||||
workflowOrganizationId: 123456,
|
||||
setSafeDirectory: true,
|
||||
githubServerUrl: githubServerUrl
|
||||
setSafeDirectory: true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,10 +71,7 @@ inputs:
|
||||
set-safe-directory:
|
||||
description: Add repository path as safe.directory for Git global config by running `git config --global --add safe.directory <path>`
|
||||
default: true
|
||||
github-server-url:
|
||||
description: The base URL for the GitHub instance that you are trying to clone from, will use environment defaults to fetch from the same instance that the workflow is running from unless specified. Example URLs are https://github.com or https://my-ghes-server.example.com
|
||||
required: false
|
||||
runs:
|
||||
using: node16
|
||||
using: node12
|
||||
main: dist/index.js
|
||||
post: dist/index.js
|
||||
|
175
dist/index.js
vendored
175
dist/index.js
vendored
@ -2137,13 +2137,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isGhes = exports.getServerApiUrl = exports.getServerUrl = exports.getFetchUrl = void 0;
|
||||
exports.getServerUrl = exports.getFetchUrl = void 0;
|
||||
const assert = __importStar(__webpack_require__(357));
|
||||
const url_1 = __webpack_require__(835);
|
||||
function getFetchUrl(settings) {
|
||||
assert.ok(settings.repositoryOwner, 'settings.repositoryOwner must be defined');
|
||||
assert.ok(settings.repositoryName, 'settings.repositoryName must be defined');
|
||||
const serviceUrl = getServerUrl(settings.githubServerUrl);
|
||||
const serviceUrl = getServerUrl();
|
||||
const encodedOwner = encodeURIComponent(settings.repositoryOwner);
|
||||
const encodedName = encodeURIComponent(settings.repositoryName);
|
||||
if (settings.sshKey) {
|
||||
@ -2153,27 +2153,13 @@ function getFetchUrl(settings) {
|
||||
return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
|
||||
}
|
||||
exports.getFetchUrl = getFetchUrl;
|
||||
function getServerUrl(url) {
|
||||
let urlValue = url && url.trim().length > 0
|
||||
? url
|
||||
: process.env['GITHUB_SERVER_URL'] || 'https://github.com';
|
||||
return new url_1.URL(urlValue);
|
||||
function getServerUrl() {
|
||||
// todo: remove GITHUB_URL after support for GHES Alpha is no longer needed
|
||||
return new url_1.URL(process.env['GITHUB_SERVER_URL'] ||
|
||||
process.env['GITHUB_URL'] ||
|
||||
'https://github.com');
|
||||
}
|
||||
exports.getServerUrl = getServerUrl;
|
||||
function getServerApiUrl(url) {
|
||||
let apiUrl = 'https://api.github.com';
|
||||
if (isGhes(url)) {
|
||||
const serverUrl = getServerUrl(url);
|
||||
apiUrl = new url_1.URL(`${serverUrl.origin}/api/v3`).toString();
|
||||
}
|
||||
return apiUrl;
|
||||
}
|
||||
exports.getServerApiUrl = getServerApiUrl;
|
||||
function isGhes(url) {
|
||||
const ghUrl = getServerUrl(url);
|
||||
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
||||
}
|
||||
exports.isGhes = isGhes;
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -4513,51 +4499,6 @@ function authenticationPlugin(octokit, options) {
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 195:
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getOctokit = exports.Octokit = void 0;
|
||||
const github = __importStar(__webpack_require__(469));
|
||||
const url_helper_1 = __webpack_require__(81);
|
||||
// Centralize all Octokit references by re-exporting
|
||||
var rest_1 = __webpack_require__(0);
|
||||
Object.defineProperty(exports, "Octokit", { enumerable: true, get: function () { return rest_1.Octokit; } });
|
||||
function getOctokit(authToken, opts) {
|
||||
const options = {
|
||||
baseUrl: (0, url_helper_1.getServerApiUrl)(opts.baseUrl)
|
||||
};
|
||||
if (opts.userAgent) {
|
||||
options.userAgent = opts.userAgent;
|
||||
}
|
||||
return new github.GitHub(authToken, options);
|
||||
}
|
||||
exports.getOctokit = getOctokit;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 197:
|
||||
@ -4761,7 +4702,7 @@ module.exports = require("punycode");
|
||||
/***/ 215:
|
||||
/***/ (function(module) {
|
||||
|
||||
module.exports = {"name":"@octokit/rest","version":"16.43.1","publishConfig":{"access":"public"},"description":"GitHub REST API client for Node.js","keywords":["octokit","github","rest","api-client"],"author":"Gregor Martynus (https://github.com/gr2m)","contributors":[{"name":"Mike de Boer","email":"info@mikedeboer.nl"},{"name":"Fabian Jakobs","email":"fabian@c9.io"},{"name":"Joe Gallo","email":"joe@brassafrax.com"},{"name":"Gregor Martynus","url":"https://github.com/gr2m"}],"repository":"https://github.com/octokit/rest.js","dependencies":{"@octokit/auth-token":"^2.4.0","@octokit/plugin-paginate-rest":"^1.1.1","@octokit/plugin-request-log":"^1.0.0","@octokit/plugin-rest-endpoint-methods":"2.4.0","@octokit/request":"^5.2.0","@octokit/request-error":"^1.0.2","atob-lite":"^2.0.0","before-after-hook":"^2.0.0","btoa-lite":"^1.0.0","deprecation":"^2.0.0","lodash.get":"^4.4.2","lodash.set":"^4.3.2","lodash.uniq":"^4.5.0","octokit-pagination-methods":"^1.1.0","once":"^1.4.0","universal-user-agent":"^4.0.0"},"devDependencies":{"@gimenete/type-writer":"^0.1.3","@octokit/auth":"^1.1.1","@octokit/fixtures-server":"^5.0.6","@octokit/graphql":"^4.2.0","@types/node":"^13.1.0","bundlesize":"^0.18.0","chai":"^4.1.2","compression-webpack-plugin":"^3.1.0","cypress":"^3.0.0","glob":"^7.1.2","http-proxy-agent":"^4.0.0","lodash.camelcase":"^4.3.0","lodash.merge":"^4.6.1","lodash.upperfirst":"^4.3.1","lolex":"^5.1.2","mkdirp":"^1.0.0","mocha":"^7.0.1","mustache":"^4.0.0","nock":"^11.3.3","npm-run-all":"^4.1.2","nyc":"^15.0.0","prettier":"^1.14.2","proxy":"^1.0.0","semantic-release":"^17.0.0","sinon":"^8.0.0","sinon-chai":"^3.0.0","sort-keys":"^4.0.0","string-to-arraybuffer":"^1.0.0","string-to-jsdoc-comment":"^1.0.0","typescript":"^3.3.1","webpack":"^4.0.0","webpack-bundle-analyzer":"^3.0.0","webpack-cli":"^3.0.0"},"types":"index.d.ts","scripts":{"coverage":"nyc report --reporter=html && open coverage/index.html","lint":"prettier --check '{lib,plugins,scripts,test}/**/*.{js,json,ts}' 'docs/*.{js,json}' 'docs/src/**/*' index.js README.md package.json","lint:fix":"prettier --write '{lib,plugins,scripts,test}/**/*.{js,json,ts}' 'docs/*.{js,json}' 'docs/src/**/*' index.js README.md package.json","pretest":"npm run -s lint","test":"nyc mocha test/mocha-node-setup.js \"test/*/**/*-test.js\"","test:browser":"cypress run --browser chrome","build":"npm-run-all build:*","build:ts":"npm run -s update-endpoints:typescript","prebuild:browser":"mkdirp dist/","build:browser":"npm-run-all build:browser:*","build:browser:development":"webpack --mode development --entry . --output-library=Octokit --output=./dist/octokit-rest.js --profile --json > dist/bundle-stats.json","build:browser:production":"webpack --mode production --entry . --plugin=compression-webpack-plugin --output-library=Octokit --output-path=./dist --output-filename=octokit-rest.min.js --devtool source-map","generate-bundle-report":"webpack-bundle-analyzer dist/bundle-stats.json --mode=static --no-open --report dist/bundle-report.html","update-endpoints":"npm-run-all update-endpoints:*","update-endpoints:fetch-json":"node scripts/update-endpoints/fetch-json","update-endpoints:typescript":"node scripts/update-endpoints/typescript","prevalidate:ts":"npm run -s build:ts","validate:ts":"tsc --target es6 --noImplicitAny index.d.ts","postvalidate:ts":"tsc --noEmit --target es6 test/typescript-validate.ts","start-fixtures-server":"octokit-fixtures-server"},"license":"MIT","files":["index.js","index.d.ts","lib","plugins"],"nyc":{"ignore":["test"]},"release":{"publish":["@semantic-release/npm",{"path":"@semantic-release/github","assets":["dist/*","!dist/*.map.gz"]}]},"bundlesize":[{"path":"./dist/octokit-rest.min.js.gz","maxSize":"33 kB"}]};
|
||||
module.exports = {"name":"@octokit/rest","version":"16.43.1","publishConfig":{"access":"public"},"description":"GitHub REST API client for Node.js","keywords":["octokit","github","rest","api-client"],"author":"Gregor Martynus (https://github.com/gr2m)","contributors":[{"name":"Mike de Boer","email":"info@mikedeboer.nl"},{"name":"Fabian Jakobs","email":"fabian@c9.io"},{"name":"Joe Gallo","email":"joe@brassafrax.com"},{"name":"Gregor Martynus","url":"https://github.com/gr2m"}],"repository":"https://github.com/octokit/rest.js","dependencies":{"@octokit/auth-token":"^2.4.0","@octokit/plugin-paginate-rest":"^1.1.1","@octokit/plugin-request-log":"^1.0.0","@octokit/plugin-rest-endpoint-methods":"2.4.0","@octokit/request":"^5.2.0","@octokit/request-error":"^1.0.2","atob-lite":"^2.0.0","before-after-hook":"^2.0.0","btoa-lite":"^1.0.0","deprecation":"^2.0.0","lodash.get":"^4.4.2","lodash.set":"^4.3.2","lodash.uniq":"^4.5.0","octokit-pagination-methods":"^1.1.0","once":"^1.4.0","universal-user-agent":"^4.0.0"},"devDependencies":{"@gimenete/type-writer":"^0.1.3","@octokit/auth":"^1.1.1","@octokit/fixtures-server":"^5.0.6","@octokit/graphql":"^4.2.0","@types/node":"^13.1.0","bundlesize":"^0.18.0","chai":"^4.1.2","compression-webpack-plugin":"^3.1.0","cypress":"^3.0.0","glob":"^7.1.2","http-proxy-agent":"^4.0.0","lodash.camelcase":"^4.3.0","lodash.merge":"^4.6.1","lodash.upperfirst":"^4.3.1","lolex":"^5.1.2","mkdirp":"^1.0.0","mocha":"^7.0.1","mustache":"^4.0.0","nock":"^11.3.3","npm-run-all":"^4.1.2","nyc":"^15.0.0","prettier":"^1.14.2","proxy":"^1.0.0","semantic-release":"^17.0.0","sinon":"^8.0.0","sinon-chai":"^3.0.0","sort-keys":"^4.0.0","string-to-arraybuffer":"^1.0.0","string-to-jsdoc-comment":"^1.0.0","typescript":"^3.3.1","webpack":"^4.0.0","webpack-bundle-analyzer":"^3.0.0","webpack-cli":"^3.0.0"},"types":"index.d.ts","scripts":{"coverage":"nyc report --reporter=html && open coverage/index.html","lint":"prettier --check '{lib,plugins,scripts,test}/**/*.{js,json,ts}' 'docs/*.{js,json}' 'docs/src/**/*' index.js README.md package.json","lint:fix":"prettier --write '{lib,plugins,scripts,test}/**/*.{js,json,ts}' 'docs/*.{js,json}' 'docs/src/**/*' index.js README.md package.json","pretest":"npm run -s lint","test":"nyc mocha test/mocha-node-setup.js \"test/*/**/*-test.js\"","test:browser":"cypress run --browser chrome","build":"npm-run-all build:*","build:ts":"npm run -s update-endpoints:typescript","prebuild:browser":"mkdirp dist/","build:browser":"npm-run-all build:browser:*","build:browser:development":"webpack --mode development --entry . --output-library=Octokit --output=./dist/octokit-rest.js --profile --json > dist/bundle-stats.json","build:browser:production":"webpack --mode production --entry . --plugin=compression-webpack-plugin --output-library=Octokit --output-path=./dist --output-filename=octokit-rest.min.js --devtool source-map","generate-bundle-report":"webpack-bundle-analyzer dist/bundle-stats.json --mode=static --no-open --report dist/bundle-report.html","update-endpoints":"npm-run-all update-endpoints:*","update-endpoints:fetch-json":"node scripts/update-endpoints/fetch-json","update-endpoints:typescript":"node scripts/update-endpoints/typescript","prevalidate:ts":"npm run -s build:ts","validate:ts":"tsc --target es6 --noImplicitAny index.d.ts","postvalidate:ts":"tsc --noEmit --target es6 test/typescript-validate.ts","start-fixtures-server":"octokit-fixtures-server"},"license":"MIT","files":["index.js","index.d.ts","lib","plugins"],"nyc":{"ignore":["test"]},"release":{"publish":["@semantic-release/npm",{"path":"@semantic-release/github","assets":["dist/*","!dist/*.map.gz"]}]},"bundlesize":[{"path":"./dist/octokit-rest.min.js.gz","maxSize":"33 kB"}],"_resolved":"https://registry.npmjs.org/@octokit/rest/-/rest-16.43.1.tgz","_integrity":"sha512-gfFKwRT/wFxq5qlNjnW2dh+qh74XgTQ2B179UX5K1HYCluioWj8Ndbgqw2PVqa1NnVJkGHp2ovMpVn/DImlmkw==","_from":"@octokit/rest@16.43.1"};
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -4800,10 +4741,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.checkCommitInfo = exports.testRef = exports.getRefSpec = exports.getRefSpecForAllHistory = exports.getCheckoutInfo = exports.tagsRefSpec = void 0;
|
||||
const url_1 = __webpack_require__(835);
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const github = __importStar(__webpack_require__(469));
|
||||
const octokit_provider_1 = __webpack_require__(195);
|
||||
const url_helper_1 = __webpack_require__(81);
|
||||
exports.tagsRefSpec = '+refs/tags/*:refs/tags/*';
|
||||
function getCheckoutInfo(git, ref, commit) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
@ -4953,12 +4893,12 @@ function testRef(git, ref, commit) {
|
||||
});
|
||||
}
|
||||
exports.testRef = testRef;
|
||||
function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref, commit, baseUrl) {
|
||||
function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref, commit) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
// GHES?
|
||||
if ((0, url_helper_1.isGhes)(baseUrl)) {
|
||||
if (isGhes()) {
|
||||
return;
|
||||
}
|
||||
// Auth token?
|
||||
@ -5003,8 +4943,7 @@ function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref
|
||||
const actualHeadSha = match[1];
|
||||
if (actualHeadSha !== expectedHeadSha) {
|
||||
core.debug(`Expected head sha ${expectedHeadSha}; actual head sha ${actualHeadSha}`);
|
||||
const octokit = (0, octokit_provider_1.getOctokit)(token, {
|
||||
baseUrl: baseUrl,
|
||||
const octokit = new github.GitHub(token, {
|
||||
userAgent: `actions-checkout-tracepoint/1.0 (code=STALE_MERGE;owner=${repositoryOwner};repo=${repositoryName};pr=${fromPayload('number')};run_id=${process.env['GITHUB_RUN_ID']};expected_head_sha=${expectedHeadSha};actual_head_sha=${actualHeadSha})`
|
||||
});
|
||||
yield octokit.repos.get({ owner: repositoryOwner, repo: repositoryName });
|
||||
@ -5030,6 +4969,10 @@ function select(obj, path) {
|
||||
const key = path.substr(0, i);
|
||||
return select(obj[key], path.substr(i + 1));
|
||||
}
|
||||
function isGhes() {
|
||||
const ghUrl = new url_1.URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
||||
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -7080,7 +7023,7 @@ class GitAuthHelper {
|
||||
this.git = gitCommandManager;
|
||||
this.settings = gitSourceSettings || {};
|
||||
// Token auth header
|
||||
const serverUrl = urlHelper.getServerUrl(this.settings.githubServerUrl);
|
||||
const serverUrl = urlHelper.getServerUrl();
|
||||
this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader`; // "origin" is SCHEME://HOSTNAME[:PORT]
|
||||
const basicCredential = Buffer.from(`x-access-token:${this.settings.authToken}`, 'utf8').toString('base64');
|
||||
core.setSecret(basicCredential);
|
||||
@ -7248,7 +7191,7 @@ class GitAuthHelper {
|
||||
if (this.settings.sshKnownHosts) {
|
||||
knownHosts += `# Begin from input known hosts\n${this.settings.sshKnownHosts}\n# end from input known hosts\n`;
|
||||
}
|
||||
knownHosts += `# Begin implicitly added github.com\ngithub.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==\n# End implicitly added github.com\n`;
|
||||
knownHosts += `# Begin implicitly added github.com\ngithub.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=\n# End implicitly added github.com\n`;
|
||||
this.sshKnownHostsPath = path.join(runnerTemp, `${uniqueId}_known_hosts`);
|
||||
stateHelper.setSshKnownHostsPath(this.sshKnownHostsPath);
|
||||
yield fs.promises.writeFile(this.sshKnownHostsPath, knownHosts);
|
||||
@ -11393,24 +11336,24 @@ exports.getDefaultBranch = exports.downloadRepository = void 0;
|
||||
const assert = __importStar(__webpack_require__(357));
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const github = __importStar(__webpack_require__(469));
|
||||
const io = __importStar(__webpack_require__(1));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const retryHelper = __importStar(__webpack_require__(587));
|
||||
const toolCache = __importStar(__webpack_require__(533));
|
||||
const v4_1 = __importDefault(__webpack_require__(826));
|
||||
const octokit_provider_1 = __webpack_require__(195);
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath, baseUrl) {
|
||||
function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Determine the default branch
|
||||
if (!ref && !commit) {
|
||||
core.info('Determining the default branch');
|
||||
ref = yield getDefaultBranch(authToken, owner, repo, baseUrl);
|
||||
ref = yield getDefaultBranch(authToken, owner, repo);
|
||||
}
|
||||
// Download the archive
|
||||
let archiveData = yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
||||
core.info('Downloading the archive');
|
||||
return yield downloadArchive(authToken, owner, repo, ref, commit, baseUrl);
|
||||
return yield downloadArchive(authToken, owner, repo, ref, commit);
|
||||
}));
|
||||
// Write archive to disk
|
||||
core.info('Writing archive to disk');
|
||||
@ -11454,12 +11397,12 @@ exports.downloadRepository = downloadRepository;
|
||||
/**
|
||||
* Looks up the default branch name
|
||||
*/
|
||||
function getDefaultBranch(authToken, owner, repo, baseUrl) {
|
||||
function getDefaultBranch(authToken, owner, repo) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
||||
var _a;
|
||||
core.info('Retrieving the default branch name');
|
||||
const octokit = (0, octokit_provider_1.getOctokit)(authToken, { baseUrl: baseUrl });
|
||||
const octokit = new github.GitHub(authToken);
|
||||
let result;
|
||||
try {
|
||||
// Get the default branch from the repo info
|
||||
@ -11489,9 +11432,9 @@ function getDefaultBranch(authToken, owner, repo, baseUrl) {
|
||||
});
|
||||
}
|
||||
exports.getDefaultBranch = getDefaultBranch;
|
||||
function downloadArchive(authToken, owner, repo, ref, commit, baseUrl) {
|
||||
function downloadArchive(authToken, owner, repo, ref, commit) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const octokit = (0, octokit_provider_1.getOctokit)(authToken, { baseUrl: baseUrl });
|
||||
const octokit = new github.GitHub(authToken);
|
||||
const params = {
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
@ -13947,6 +13890,7 @@ var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
||||
|
||||
i += 1;
|
||||
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
||||
/* eslint operator-linebreak: [2, "before"] */
|
||||
out += hexTable[0xF0 | (c >> 18)]
|
||||
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
||||
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
||||
@ -17572,7 +17516,7 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
||||
) {
|
||||
obj = [];
|
||||
obj[index] = leaf;
|
||||
} else {
|
||||
} else if (cleanRoot !== '__proto__') {
|
||||
obj[cleanRoot] = leaf;
|
||||
}
|
||||
}
|
||||
@ -18521,9 +18465,6 @@ function getInputs() {
|
||||
// Set safe.directory in git global config.
|
||||
result.setSafeDirectory =
|
||||
(core.getInput('set-safe-directory') || 'true').toUpperCase() === 'TRUE';
|
||||
// Determine the GitHub URL that the repository is being hosted from
|
||||
result.githubServerUrl = core.getInput('github-server-url');
|
||||
core.debug(`GitHub Host URL = ${result.githubServerUrl}`);
|
||||
return result;
|
||||
});
|
||||
}
|
||||
@ -31894,7 +31835,7 @@ function getSource(settings) {
|
||||
else if (settings.sshKey) {
|
||||
throw new Error(`Input 'ssh-key' not supported when falling back to download using the GitHub REST API. To create a local Git repository instead, add Git ${gitCommandManager.MinimumGitVersion} or higher to the PATH.`);
|
||||
}
|
||||
yield githubApiHelper.downloadRepository(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.repositoryPath, settings.githubServerUrl);
|
||||
yield githubApiHelper.downloadRepository(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.repositoryPath);
|
||||
return;
|
||||
}
|
||||
// Save state for POST action
|
||||
@ -31927,7 +31868,7 @@ function getSource(settings) {
|
||||
settings.ref = yield git.getDefaultBranch(repositoryUrl);
|
||||
}
|
||||
else {
|
||||
settings.ref = yield githubApiHelper.getDefaultBranch(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.githubServerUrl);
|
||||
settings.ref = yield githubApiHelper.getDefaultBranch(settings.authToken, settings.repositoryOwner, settings.repositoryName);
|
||||
}
|
||||
core.endGroup();
|
||||
}
|
||||
@ -31993,7 +31934,7 @@ function getSource(settings) {
|
||||
// Log commit sha
|
||||
yield git.log1("--format='%H'");
|
||||
// Check for incorrect pull request merge commit
|
||||
yield refHelper.checkCommitInfo(settings.authToken, commitInfo, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.githubServerUrl);
|
||||
yield refHelper.checkCommitInfo(settings.authToken, commitInfo, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit);
|
||||
}
|
||||
finally {
|
||||
// Remove auth
|
||||
@ -34704,6 +34645,7 @@ var arrayPrefixGenerators = {
|
||||
};
|
||||
|
||||
var isArray = Array.isArray;
|
||||
var split = String.prototype.split;
|
||||
var push = Array.prototype.push;
|
||||
var pushToArray = function (arr, valueOrArray) {
|
||||
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
||||
@ -34740,10 +34682,13 @@ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
|
||||
|| typeof v === 'bigint';
|
||||
};
|
||||
|
||||
var sentinel = {};
|
||||
|
||||
var stringify = function stringify(
|
||||
object,
|
||||
prefix,
|
||||
generateArrayPrefix,
|
||||
commaRoundTrip,
|
||||
strictNullHandling,
|
||||
skipNulls,
|
||||
encoder,
|
||||
@ -34759,8 +34704,23 @@ var stringify = function stringify(
|
||||
) {
|
||||
var obj = object;
|
||||
|
||||
if (sideChannel.has(object)) {
|
||||
var tmpSc = sideChannel;
|
||||
var step = 0;
|
||||
var findFlag = false;
|
||||
while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
|
||||
// Where object last appeared in the ref tree
|
||||
var pos = tmpSc.get(object);
|
||||
step += 1;
|
||||
if (typeof pos !== 'undefined') {
|
||||
if (pos === step) {
|
||||
throw new RangeError('Cyclic object value');
|
||||
} else {
|
||||
findFlag = true; // Break while
|
||||
}
|
||||
}
|
||||
if (typeof tmpSc.get(sentinel) === 'undefined') {
|
||||
step = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof filter === 'function') {
|
||||
@ -34787,6 +34747,14 @@ var stringify = function stringify(
|
||||
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
||||
if (encoder) {
|
||||
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
||||
if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
|
||||
var valuesArray = split.call(String(obj), ',');
|
||||
var valuesJoined = '';
|
||||
for (var i = 0; i < valuesArray.length; ++i) {
|
||||
valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
|
||||
}
|
||||
return [formatter(keyValue) + (commaRoundTrip && isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
|
||||
}
|
||||
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
||||
}
|
||||
return [formatter(prefix) + '=' + formatter(String(obj))];
|
||||
@ -34801,7 +34769,7 @@ var stringify = function stringify(
|
||||
var objKeys;
|
||||
if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
||||
// we need to join elements in
|
||||
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : undefined }];
|
||||
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
|
||||
} else if (isArray(filter)) {
|
||||
objKeys = filter;
|
||||
} else {
|
||||
@ -34809,24 +34777,28 @@ var stringify = function stringify(
|
||||
objKeys = sort ? keys.sort(sort) : keys;
|
||||
}
|
||||
|
||||
for (var i = 0; i < objKeys.length; ++i) {
|
||||
var key = objKeys[i];
|
||||
var value = typeof key === 'object' && key.value !== undefined ? key.value : obj[key];
|
||||
var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix;
|
||||
|
||||
for (var j = 0; j < objKeys.length; ++j) {
|
||||
var key = objKeys[j];
|
||||
var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
|
||||
|
||||
if (skipNulls && value === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var keyPrefix = isArray(obj)
|
||||
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix
|
||||
: prefix + (allowDots ? '.' + key : '[' + key + ']');
|
||||
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
|
||||
: adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
|
||||
|
||||
sideChannel.set(object, true);
|
||||
sideChannel.set(object, step);
|
||||
var valueSideChannel = getSideChannel();
|
||||
valueSideChannel.set(sentinel, sideChannel);
|
||||
pushToArray(values, stringify(
|
||||
value,
|
||||
keyPrefix,
|
||||
generateArrayPrefix,
|
||||
commaRoundTrip,
|
||||
strictNullHandling,
|
||||
skipNulls,
|
||||
encoder,
|
||||
@ -34850,7 +34822,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
|
||||
return defaults;
|
||||
}
|
||||
|
||||
if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') {
|
||||
if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
|
||||
throw new TypeError('Encoder has to be a function.');
|
||||
}
|
||||
|
||||
@ -34923,6 +34895,10 @@ module.exports = function (object, opts) {
|
||||
}
|
||||
|
||||
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
|
||||
if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
||||
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
||||
}
|
||||
var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
|
||||
|
||||
if (!objKeys) {
|
||||
objKeys = Object.keys(obj);
|
||||
@ -34943,6 +34919,7 @@ module.exports = function (object, opts) {
|
||||
obj[key],
|
||||
key,
|
||||
generateArrayPrefix,
|
||||
commaRoundTrip,
|
||||
options.strictNullHandling,
|
||||
options.skipNulls,
|
||||
options.encode ? options.encoder : null,
|
||||
|
18623
package-lock.json
generated
18623
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "checkout",
|
||||
"version": "3.2.0",
|
||||
"version": "2.6.0",
|
||||
"description": "checkout action",
|
||||
"main": "lib/main.js",
|
||||
"scripts": {
|
||||
|
@ -52,7 +52,7 @@ class GitAuthHelper {
|
||||
this.settings = gitSourceSettings || (({} as unknown) as IGitSourceSettings)
|
||||
|
||||
// Token auth header
|
||||
const serverUrl = urlHelper.getServerUrl(this.settings.githubServerUrl)
|
||||
const serverUrl = urlHelper.getServerUrl()
|
||||
this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader` // "origin" is SCHEME://HOSTNAME[:PORT]
|
||||
const basicCredential = Buffer.from(
|
||||
`x-access-token:${this.settings.authToken}`,
|
||||
@ -247,7 +247,7 @@ class GitAuthHelper {
|
||||
if (this.settings.sshKnownHosts) {
|
||||
knownHosts += `# Begin from input known hosts\n${this.settings.sshKnownHosts}\n# end from input known hosts\n`
|
||||
}
|
||||
knownHosts += `# Begin implicitly added github.com\ngithub.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==\n# End implicitly added github.com\n`
|
||||
knownHosts += `# Begin implicitly added github.com\ngithub.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=\n# End implicitly added github.com\n`
|
||||
this.sshKnownHostsPath = path.join(runnerTemp, `${uniqueId}_known_hosts`)
|
||||
stateHelper.setSshKnownHostsPath(this.sshKnownHostsPath)
|
||||
await fs.promises.writeFile(this.sshKnownHostsPath, knownHosts)
|
||||
|
@ -93,8 +93,7 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||
settings.repositoryName,
|
||||
settings.ref,
|
||||
settings.commit,
|
||||
settings.repositoryPath,
|
||||
settings.githubServerUrl
|
||||
settings.repositoryPath
|
||||
)
|
||||
return
|
||||
}
|
||||
@ -139,8 +138,7 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||
settings.ref = await githubApiHelper.getDefaultBranch(
|
||||
settings.authToken,
|
||||
settings.repositoryOwner,
|
||||
settings.repositoryName,
|
||||
settings.githubServerUrl
|
||||
settings.repositoryName
|
||||
)
|
||||
}
|
||||
core.endGroup()
|
||||
@ -234,8 +232,7 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||
settings.repositoryOwner,
|
||||
settings.repositoryName,
|
||||
settings.ref,
|
||||
settings.commit,
|
||||
settings.githubServerUrl
|
||||
settings.commit
|
||||
)
|
||||
} finally {
|
||||
// Remove auth
|
||||
|
@ -83,9 +83,4 @@ export interface IGitSourceSettings {
|
||||
* Indicates whether to add repositoryPath as safe.directory in git global config
|
||||
*/
|
||||
setSafeDirectory: boolean
|
||||
|
||||
/**
|
||||
* User override on the GitHub Server/Host URL that hosts the repository to be cloned
|
||||
*/
|
||||
githubServerUrl: string | undefined
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
import * as assert from 'assert'
|
||||
import * as core from '@actions/core'
|
||||
import * as fs from 'fs'
|
||||
import * as github from '@actions/github'
|
||||
import * as io from '@actions/io'
|
||||
import * as path from 'path'
|
||||
import * as retryHelper from './retry-helper'
|
||||
import * as toolCache from '@actions/tool-cache'
|
||||
import {default as uuid} from 'uuid/v4'
|
||||
import {getOctokit, Octokit} from './octokit-provider'
|
||||
import {Octokit} from '@octokit/rest'
|
||||
|
||||
const IS_WINDOWS = process.platform === 'win32'
|
||||
|
||||
@ -16,19 +17,18 @@ export async function downloadRepository(
|
||||
repo: string,
|
||||
ref: string,
|
||||
commit: string,
|
||||
repositoryPath: string,
|
||||
baseUrl?: string
|
||||
repositoryPath: string
|
||||
): Promise<void> {
|
||||
// Determine the default branch
|
||||
if (!ref && !commit) {
|
||||
core.info('Determining the default branch')
|
||||
ref = await getDefaultBranch(authToken, owner, repo, baseUrl)
|
||||
ref = await getDefaultBranch(authToken, owner, repo)
|
||||
}
|
||||
|
||||
// Download the archive
|
||||
let archiveData = await retryHelper.execute(async () => {
|
||||
core.info('Downloading the archive')
|
||||
return await downloadArchive(authToken, owner, repo, ref, commit, baseUrl)
|
||||
return await downloadArchive(authToken, owner, repo, ref, commit)
|
||||
})
|
||||
|
||||
// Write archive to disk
|
||||
@ -79,12 +79,11 @@ export async function downloadRepository(
|
||||
export async function getDefaultBranch(
|
||||
authToken: string,
|
||||
owner: string,
|
||||
repo: string,
|
||||
baseUrl?: string
|
||||
repo: string
|
||||
): Promise<string> {
|
||||
return await retryHelper.execute(async () => {
|
||||
core.info('Retrieving the default branch name')
|
||||
const octokit = getOctokit(authToken, {baseUrl: baseUrl})
|
||||
const octokit = new github.GitHub(authToken)
|
||||
let result: string
|
||||
try {
|
||||
// Get the default branch from the repo info
|
||||
@ -122,10 +121,9 @@ async function downloadArchive(
|
||||
owner: string,
|
||||
repo: string,
|
||||
ref: string,
|
||||
commit: string,
|
||||
baseUrl?: string
|
||||
commit: string
|
||||
): Promise<Buffer> {
|
||||
const octokit = getOctokit(authToken, {baseUrl: baseUrl})
|
||||
const octokit = new github.GitHub(authToken)
|
||||
const params: Octokit.ReposGetArchiveLinkParams = {
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
|
@ -125,10 +125,5 @@ export async function getInputs(): Promise<IGitSourceSettings> {
|
||||
// Set safe.directory in git global config.
|
||||
result.setSafeDirectory =
|
||||
(core.getInput('set-safe-directory') || 'true').toUpperCase() === 'TRUE'
|
||||
|
||||
// Determine the GitHub URL that the repository is being hosted from
|
||||
result.githubServerUrl = core.getInput('github-server-url')
|
||||
core.debug(`GitHub Host URL = ${result.githubServerUrl}`)
|
||||
|
||||
return result
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ function updateUsage(
|
||||
}
|
||||
|
||||
updateUsage(
|
||||
'actions/checkout@v3',
|
||||
'actions/checkout@v2',
|
||||
path.join(__dirname, '..', '..', 'action.yml'),
|
||||
path.join(__dirname, '..', '..', 'README.md')
|
||||
)
|
||||
|
@ -1,23 +0,0 @@
|
||||
import * as github from '@actions/github'
|
||||
import {Octokit} from '@octokit/rest'
|
||||
import {getServerApiUrl} from './url-helper'
|
||||
|
||||
// Centralize all Octokit references by re-exporting
|
||||
export {Octokit} from '@octokit/rest'
|
||||
|
||||
export type OctokitOptions = {
|
||||
baseUrl?: string
|
||||
userAgent?: string
|
||||
}
|
||||
|
||||
export function getOctokit(authToken: string, opts: OctokitOptions) {
|
||||
const options: Octokit.Options = {
|
||||
baseUrl: getServerApiUrl(opts.baseUrl)
|
||||
}
|
||||
|
||||
if (opts.userAgent) {
|
||||
options.userAgent = opts.userAgent
|
||||
}
|
||||
|
||||
return new github.GitHub(authToken, options)
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
import {URL} from 'url'
|
||||
import {IGitCommandManager} from './git-command-manager'
|
||||
import * as core from '@actions/core'
|
||||
import * as github from '@actions/github'
|
||||
import {getOctokit} from './octokit-provider'
|
||||
import {isGhes} from './url-helper'
|
||||
|
||||
export const tagsRefSpec = '+refs/tags/*:refs/tags/*'
|
||||
|
||||
@ -184,12 +183,11 @@ export async function checkCommitInfo(
|
||||
repositoryOwner: string,
|
||||
repositoryName: string,
|
||||
ref: string,
|
||||
commit: string,
|
||||
baseUrl?: string
|
||||
commit: string
|
||||
): Promise<void> {
|
||||
try {
|
||||
// GHES?
|
||||
if (isGhes(baseUrl)) {
|
||||
if (isGhes()) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -245,8 +243,7 @@ export async function checkCommitInfo(
|
||||
core.debug(
|
||||
`Expected head sha ${expectedHeadSha}; actual head sha ${actualHeadSha}`
|
||||
)
|
||||
const octokit = getOctokit(token, {
|
||||
baseUrl: baseUrl,
|
||||
const octokit = new github.GitHub(token, {
|
||||
userAgent: `actions-checkout-tracepoint/1.0 (code=STALE_MERGE;owner=${repositoryOwner};repo=${repositoryName};pr=${fromPayload(
|
||||
'number'
|
||||
)};run_id=${
|
||||
@ -279,3 +276,10 @@ function select(obj: any, path: string): any {
|
||||
const key = path.substr(0, i)
|
||||
return select(obj[key], path.substr(i + 1))
|
||||
}
|
||||
|
||||
function isGhes(): boolean {
|
||||
const ghUrl = new URL(
|
||||
process.env['GITHUB_SERVER_URL'] || 'https://github.com'
|
||||
)
|
||||
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as assert from 'assert'
|
||||
import {URL} from 'url'
|
||||
import {IGitSourceSettings} from './git-source-settings'
|
||||
import {URL} from 'url'
|
||||
|
||||
export function getFetchUrl(settings: IGitSourceSettings): string {
|
||||
assert.ok(
|
||||
@ -8,7 +8,7 @@ export function getFetchUrl(settings: IGitSourceSettings): string {
|
||||
'settings.repositoryOwner must be defined'
|
||||
)
|
||||
assert.ok(settings.repositoryName, 'settings.repositoryName must be defined')
|
||||
const serviceUrl = getServerUrl(settings.githubServerUrl)
|
||||
const serviceUrl = getServerUrl()
|
||||
const encodedOwner = encodeURIComponent(settings.repositoryOwner)
|
||||
const encodedName = encodeURIComponent(settings.repositoryName)
|
||||
if (settings.sshKey) {
|
||||
@ -19,27 +19,11 @@ export function getFetchUrl(settings: IGitSourceSettings): string {
|
||||
return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`
|
||||
}
|
||||
|
||||
export function getServerUrl(url?: string): URL {
|
||||
let urlValue =
|
||||
url && url.trim().length > 0
|
||||
? url
|
||||
: process.env['GITHUB_SERVER_URL'] || 'https://github.com'
|
||||
return new URL(urlValue)
|
||||
}
|
||||
|
||||
export function getServerApiUrl(url?: string): string {
|
||||
let apiUrl = 'https://api.github.com'
|
||||
|
||||
if (isGhes(url)) {
|
||||
const serverUrl = getServerUrl(url)
|
||||
apiUrl = new URL(`${serverUrl.origin}/api/v3`).toString()
|
||||
}
|
||||
|
||||
return apiUrl
|
||||
}
|
||||
|
||||
export function isGhes(url?: string): boolean {
|
||||
const ghUrl = getServerUrl(url)
|
||||
|
||||
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'
|
||||
export function getServerUrl(): URL {
|
||||
// todo: remove GITHUB_URL after support for GHES Alpha is no longer needed
|
||||
return new URL(
|
||||
process.env['GITHUB_SERVER_URL'] ||
|
||||
process.env['GITHUB_URL'] ||
|
||||
'https://github.com'
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user