Compare commits
21 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ac59398561 | ||
![]() |
3ba5ee6fac | ||
![]() |
8856415920 | ||
![]() |
755da8c3cf | ||
![]() |
26d48e8ea1 | ||
![]() |
bf085276ce | ||
![]() |
5c3ccc22eb | ||
![]() |
1f9a0c22da | ||
![]() |
8230315d06 | ||
![]() |
93ea575cb5 | ||
![]() |
6a84743051 | ||
![]() |
e6d535c99c | ||
![]() |
2541b1294d | ||
![]() |
0ffe6f9c55 | ||
![]() |
dcd71f6466 | ||
![]() |
add3486cc3 | ||
![]() |
5126516654 | ||
![]() |
d50f8ea767 | ||
![]() |
2d1c1198e7 | ||
![]() |
a12a3943b4 | ||
![]() |
8f9e05e482 |
37 changed files with 19734 additions and 3982 deletions
6
.github/workflows/check-dist.yml
vendored
6
.github/workflows/check-dist.yml
vendored
|
@ -22,12 +22,12 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set Node.js 12.x
|
- name: Set Node.js 16.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: 16.x
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
|
@ -39,7 +39,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
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
|
runs-on: ubuntu-latest
|
||||||
name: Check licenses
|
name: Check licenses
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run licensed-check
|
- run: npm run licensed-check
|
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
|
@ -13,8 +13,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: 16.x
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npm run format-check
|
- run: npm run format-check
|
||||||
|
@ -32,7 +32,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
# Clone this repo
|
# Clone this repo
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Basic checkout
|
# Basic checkout
|
||||||
- name: Checkout basic
|
- name: Checkout basic
|
||||||
|
@ -142,7 +142,7 @@ jobs:
|
||||||
options: --dns 127.0.0.1
|
options: --dns 127.0.0.1
|
||||||
services:
|
services:
|
||||||
squid-proxy:
|
squid-proxy:
|
||||||
image: datadog/squid:latest
|
image: ubuntu/squid:latest
|
||||||
ports:
|
ports:
|
||||||
- 3128:3128
|
- 3128:3128
|
||||||
env:
|
env:
|
||||||
|
@ -150,7 +150,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
# Clone this repo
|
# Clone this repo
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Basic checkout using git
|
# Basic checkout using git
|
||||||
- name: Checkout basic
|
- name: Checkout basic
|
||||||
|
@ -182,7 +182,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
# Clone this repo
|
# Clone this repo
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Basic checkout using git
|
# Basic checkout using git
|
||||||
- name: Checkout basic
|
- name: Checkout basic
|
||||||
|
|
30
.github/workflows/update-main-version.yml
vendored
Normal file
30
.github/workflows/update-main-version.yml
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
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,3 +2,4 @@ __test__/_temp
|
||||||
_temp/
|
_temp/
|
||||||
lib/
|
lib/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
.vscode/
|
6
.licenses/npm/@actions/core.dep.yml
generated
6
.licenses/npm/@actions/core.dep.yml
generated
|
@ -1,9 +1,9 @@
|
||||||
---
|
---
|
||||||
name: "@actions/core"
|
name: "@actions/core"
|
||||||
version: 1.2.6
|
version: 1.10.0
|
||||||
type: npm
|
type: npm
|
||||||
summary:
|
summary: Actions core lib
|
||||||
homepage:
|
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE.md
|
- sources: LICENSE.md
|
||||||
|
|
32
.licenses/npm/@actions/http-client-2.0.1.dep.yml
generated
Normal file
32
.licenses/npm/@actions/http-client-2.0.1.dep.yml
generated
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
name: "@actions/http-client"
|
||||||
|
version: 2.0.1
|
||||||
|
type: npm
|
||||||
|
summary: Actions Http Client
|
||||||
|
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
Actions Http Client for Node.js
|
||||||
|
|
||||||
|
Copyright (c) GitHub, Inc.
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
|
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||||
|
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
notices: []
|
6
.licenses/npm/@actions/io.dep.yml
generated
6
.licenses/npm/@actions/io.dep.yml
generated
|
@ -1,13 +1,15 @@
|
||||||
---
|
---
|
||||||
name: "@actions/io"
|
name: "@actions/io"
|
||||||
version: 1.0.1
|
version: 1.1.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions io lib
|
summary: Actions io lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/master/packages/io
|
homepage: https://github.com/actions/toolkit/tree/main/packages/io
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE.md
|
- sources: LICENSE.md
|
||||||
text: |-
|
text: |-
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright 2019 GitHub
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
2
.licenses/npm/node-fetch.dep.yml
generated
2
.licenses/npm/node-fetch.dep.yml
generated
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
name: node-fetch
|
name: node-fetch
|
||||||
version: 2.6.5
|
version: 2.6.7
|
||||||
type: npm
|
type: npm
|
||||||
summary: A light-weight module that brings window.fetch to node.js
|
summary: A light-weight module that brings window.fetch to node.js
|
||||||
homepage: https://github.com/bitinn/node-fetch
|
homepage: https://github.com/bitinn/node-fetch
|
||||||
|
|
2
.licenses/npm/qs.dep.yml
generated
2
.licenses/npm/qs.dep.yml
generated
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
name: qs
|
name: qs
|
||||||
version: 6.10.1
|
version: 6.11.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: A querystring parser that supports nesting and arrays, with a depth limit
|
summary: A querystring parser that supports nesting and arrays, with a depth limit
|
||||||
homepage: https://github.com/ljharb/qs
|
homepage: https://github.com/ljharb/qs
|
||||||
|
|
20
.licenses/npm/uuid-8.3.2.dep.yml
generated
Normal file
20
.licenses/npm/uuid-8.3.2.dep.yml
generated
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
name: uuid
|
||||||
|
version: 8.3.2
|
||||||
|
type: npm
|
||||||
|
summary: RFC4122 (v1, v4, and v5) UUIDs
|
||||||
|
homepage: https://github.com/uuidjs/uuid#readme
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE.md
|
||||||
|
text: |
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2010-2020 Robert Kieffer and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
notices: []
|
19
CHANGELOG.md
19
CHANGELOG.md
|
@ -1,19 +1,24 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## v2.5.0
|
## v3.1.0
|
||||||
- [Bump @actions/core to v1.10.0](https://github.com/actions/checkout/pull/962)
|
- [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.4.2
|
## v3.0.2
|
||||||
- [Add input `set-safe-directory`](https://github.com/actions/checkout/pull/776)
|
- [Add input `set-safe-directory`](https://github.com/actions/checkout/pull/770)
|
||||||
|
|
||||||
## v2.4.1
|
## v3.0.1
|
||||||
- [Set the safe directory option on git to prevent git commands failing when running in containers](https://github.com/actions/checkout/pull/762)
|
- [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.3.1
|
## v2.3.1
|
||||||
|
|
||||||
- [Fix default branch resolution for .wiki and when using SSH](https://github.com/actions/checkout/pull/284)
|
- [Fix default branch resolution for .wiki and when using SSH](https://github.com/actions/checkout/pull/284)
|
||||||
|
|
||||||
|
|
||||||
## v2.3.0
|
## v2.3.0
|
||||||
|
|
||||||
- [Fallback to the default branch](https://github.com/actions/checkout/pull/278)
|
- [Fallback to the default branch](https://github.com/actions/checkout/pull/278)
|
||||||
|
|
28
CONTRIBUTING.md
Normal file
28
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# 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:
|
57
README.md
57
README.md
|
@ -1,8 +1,6 @@
|
||||||
<p align="center">
|
[](https://github.com/actions/checkout/actions/workflows/test.yml)
|
||||||
<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 V2
|
# Checkout V3
|
||||||
|
|
||||||
This action checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it.
|
This action checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it.
|
||||||
|
|
||||||
|
@ -14,27 +12,14 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
|
||||||
|
|
||||||
# What's new
|
# What's new
|
||||||
|
|
||||||
- Improved performance
|
- Updated to the node16 runtime by default
|
||||||
- Fetches only a single commit 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.
|
||||||
- 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
|
# Usage
|
||||||
|
|
||||||
<!-- start usage -->
|
<!-- start usage -->
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
# Repository name with owner. For example, actions/checkout
|
# Repository name with owner. For example, actions/checkout
|
||||||
# Default: ${{ github.repository }}
|
# Default: ${{ github.repository }}
|
||||||
|
@ -110,6 +95,12 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
|
||||||
# config --global --add safe.directory <path>`
|
# config --global --add safe.directory <path>`
|
||||||
# Default: true
|
# Default: true
|
||||||
set-safe-directory: ''
|
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 -->
|
<!-- end usage -->
|
||||||
|
|
||||||
|
@ -128,7 +119,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
|
||||||
## Fetch all history for all tags and branches
|
## Fetch all history for all tags and branches
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
```
|
```
|
||||||
|
@ -136,7 +127,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
|
||||||
## Checkout a different branch
|
## Checkout a different branch
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: my-branch
|
ref: my-branch
|
||||||
```
|
```
|
||||||
|
@ -144,7 +135,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
|
||||||
## Checkout HEAD^
|
## Checkout HEAD^
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
- run: git checkout HEAD^
|
- run: git checkout HEAD^
|
||||||
|
@ -154,40 +145,42 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
path: main
|
path: main
|
||||||
|
|
||||||
- name: Checkout tools repo
|
- name: Checkout tools repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: my-org/my-tools
|
repository: my-org/my-tools
|
||||||
path: my-tools
|
path: my-tools
|
||||||
```
|
```
|
||||||
|
> - If your secondary repository is private you will need to add the option noted in [Checkout multiple repos (private)](#Checkout-multiple-repos-private)
|
||||||
|
|
||||||
## Checkout multiple repos (nested)
|
## Checkout multiple repos (nested)
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Checkout tools repo
|
- name: Checkout tools repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: my-org/my-tools
|
repository: my-org/my-tools
|
||||||
path: my-tools
|
path: my-tools
|
||||||
```
|
```
|
||||||
|
> - If your secondary repository is private you will need to add the option noted in [Checkout multiple repos (private)](#Checkout-multiple-repos-private)
|
||||||
|
|
||||||
## Checkout multiple repos (private)
|
## Checkout multiple repos (private)
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
path: main
|
path: main
|
||||||
|
|
||||||
- name: Checkout private tools
|
- name: Checkout private tools
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: my-org/my-private-tools
|
repository: my-org/my-private-tools
|
||||||
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
|
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
|
||||||
|
@ -200,7 +193,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
|
||||||
## Checkout pull request HEAD commit instead of merge commit
|
## Checkout pull request HEAD commit instead of merge commit
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
```
|
```
|
||||||
|
@ -216,7 +209,7 @@ jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
```
|
```
|
||||||
|
|
||||||
## Push a commit using the built-in token
|
## Push a commit using the built-in token
|
||||||
|
@ -227,7 +220,7 @@ jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- run: |
|
- run: |
|
||||||
date > generated.txt
|
date > generated.txt
|
||||||
git config user.name github-actions
|
git config user.name github-actions
|
||||||
|
|
|
@ -20,6 +20,7 @@ let tempHomedir: string
|
||||||
let git: IGitCommandManager & {env: {[key: string]: string}}
|
let git: IGitCommandManager & {env: {[key: string]: string}}
|
||||||
let settings: IGitSourceSettings
|
let settings: IGitSourceSettings
|
||||||
let sshPath: string
|
let sshPath: string
|
||||||
|
let githubServerUrl: string
|
||||||
|
|
||||||
describe('git-auth-helper tests', () => {
|
describe('git-auth-helper tests', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
@ -67,11 +68,18 @@ describe('git-auth-helper tests', () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const configureAuth_configuresAuthHeader =
|
async function testAuthHeader(
|
||||||
'configureAuth configures auth header'
|
testName: string,
|
||||||
it(configureAuth_configuresAuthHeader, async () => {
|
serverUrl: string | undefined = undefined
|
||||||
|
) {
|
||||||
// Arrange
|
// Arrange
|
||||||
await setup(configureAuth_configuresAuthHeader)
|
let expectedServerUrl = 'https://github.com'
|
||||||
|
if (serverUrl) {
|
||||||
|
githubServerUrl = serverUrl
|
||||||
|
expectedServerUrl = githubServerUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
await setup(testName)
|
||||||
expect(settings.authToken).toBeTruthy() // sanity check
|
expect(settings.authToken).toBeTruthy() // sanity check
|
||||||
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
||||||
|
|
||||||
|
@ -88,9 +96,33 @@ describe('git-auth-helper tests', () => {
|
||||||
).toString('base64')
|
).toString('base64')
|
||||||
expect(
|
expect(
|
||||||
configContent.indexOf(
|
configContent.indexOf(
|
||||||
`http.https://github.com/.extraheader AUTHORIZATION: basic ${basicCredential}`
|
`http.${expectedServerUrl}/.extraheader AUTHORIZATION: basic ${basicCredential}`
|
||||||
)
|
)
|
||||||
).toBeGreaterThanOrEqual(0)
|
).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 =
|
const configureAuth_configuresAuthHeaderEvenWhenPersistCredentialsFalse =
|
||||||
|
@ -778,7 +810,8 @@ async function setup(testName: string): Promise<void> {
|
||||||
sshKnownHosts: '',
|
sshKnownHosts: '',
|
||||||
sshStrict: true,
|
sshStrict: true,
|
||||||
workflowOrganizationId: 123456,
|
workflowOrganizationId: 123456,
|
||||||
setSafeDirectory: true
|
setSafeDirectory: true,
|
||||||
|
githubServerUrl: githubServerUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
80
__test__/git-command-manager.test.ts
Normal file
80
__test__/git-command-manager.test.ts
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
import * as exec from '@actions/exec'
|
||||||
|
import * as fshelper from '../lib/fs-helper'
|
||||||
|
import * as commandManager from '../lib/git-command-manager'
|
||||||
|
|
||||||
|
let git: commandManager.IGitCommandManager
|
||||||
|
let mockExec = jest.fn()
|
||||||
|
|
||||||
|
describe('git-auth-helper tests', () => {
|
||||||
|
beforeAll(async () => {})
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
jest.spyOn(fshelper, 'fileExistsSync').mockImplementation(jest.fn())
|
||||||
|
jest.spyOn(fshelper, 'directoryExistsSync').mockImplementation(jest.fn())
|
||||||
|
})
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jest.restoreAllMocks()
|
||||||
|
})
|
||||||
|
|
||||||
|
afterAll(() => {})
|
||||||
|
|
||||||
|
it('branch list matches', async () => {
|
||||||
|
mockExec.mockImplementation((path, args, options) => {
|
||||||
|
console.log(args, options.listeners.stdout)
|
||||||
|
|
||||||
|
if (args.includes('version')) {
|
||||||
|
options.listeners.stdout(Buffer.from('2.18'))
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.includes('rev-parse')) {
|
||||||
|
options.listeners.stdline(Buffer.from('refs/heads/foo'))
|
||||||
|
options.listeners.stdline(Buffer.from('refs/heads/bar'))
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1
|
||||||
|
})
|
||||||
|
jest.spyOn(exec, 'exec').mockImplementation(mockExec)
|
||||||
|
const workingDirectory = 'test'
|
||||||
|
const lfs = false
|
||||||
|
git = await commandManager.createCommandManager(workingDirectory, lfs)
|
||||||
|
|
||||||
|
let branches = await git.branchList(false)
|
||||||
|
|
||||||
|
expect(branches).toHaveLength(2)
|
||||||
|
expect(branches.sort()).toEqual(['foo', 'bar'].sort())
|
||||||
|
})
|
||||||
|
|
||||||
|
it('ambiguous ref name output is captured', async () => {
|
||||||
|
mockExec.mockImplementation((path, args, options) => {
|
||||||
|
console.log(args, options.listeners.stdout)
|
||||||
|
|
||||||
|
if (args.includes('version')) {
|
||||||
|
options.listeners.stdout(Buffer.from('2.18'))
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.includes('rev-parse')) {
|
||||||
|
options.listeners.stdline(Buffer.from('refs/heads/foo'))
|
||||||
|
// If refs/tags/v1 and refs/heads/tags/v1 existed on this repository
|
||||||
|
options.listeners.errline(
|
||||||
|
Buffer.from("error: refname 'tags/v1' is ambiguous")
|
||||||
|
)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1
|
||||||
|
})
|
||||||
|
jest.spyOn(exec, 'exec').mockImplementation(mockExec)
|
||||||
|
const workingDirectory = 'test'
|
||||||
|
const lfs = false
|
||||||
|
git = await commandManager.createCommandManager(workingDirectory, lfs)
|
||||||
|
|
||||||
|
let branches = await git.branchList(false)
|
||||||
|
|
||||||
|
expect(branches).toHaveLength(1)
|
||||||
|
expect(branches.sort()).toEqual(['foo'].sort())
|
||||||
|
})
|
||||||
|
})
|
|
@ -71,7 +71,10 @@ inputs:
|
||||||
set-safe-directory:
|
set-safe-directory:
|
||||||
description: Add repository path as safe.directory for Git global config by running `git config --global --add safe.directory <path>`
|
description: Add repository path as safe.directory for Git global config by running `git config --global --add safe.directory <path>`
|
||||||
default: true
|
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:
|
runs:
|
||||||
using: node12
|
using: node16
|
||||||
main: dist/index.js
|
main: dist/index.js
|
||||||
post: dist/index.js
|
post: dist/index.js
|
||||||
|
|
450
dist/index.js
vendored
450
dist/index.js
vendored
|
@ -98,6 +98,25 @@ module.exports = Octokit;
|
||||||
|
|
||||||
"use strict";
|
"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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
@ -108,11 +127,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const childProcess = __webpack_require__(129);
|
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
|
||||||
const path = __webpack_require__(622);
|
const assert_1 = __webpack_require__(357);
|
||||||
|
const childProcess = __importStar(__webpack_require__(129));
|
||||||
|
const path = __importStar(__webpack_require__(622));
|
||||||
const util_1 = __webpack_require__(669);
|
const util_1 = __webpack_require__(669);
|
||||||
const ioUtil = __webpack_require__(672);
|
const ioUtil = __importStar(__webpack_require__(672));
|
||||||
const exec = util_1.promisify(childProcess.exec);
|
const exec = util_1.promisify(childProcess.exec);
|
||||||
|
const execFile = util_1.promisify(childProcess.execFile);
|
||||||
/**
|
/**
|
||||||
* Copies a file or folder.
|
* Copies a file or folder.
|
||||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||||
|
@ -123,14 +145,14 @@ const exec = util_1.promisify(childProcess.exec);
|
||||||
*/
|
*/
|
||||||
function cp(source, dest, options = {}) {
|
function cp(source, dest, options = {}) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const { force, recursive } = readCopyOptions(options);
|
const { force, recursive, copySourceDirectory } = readCopyOptions(options);
|
||||||
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
||||||
// Dest is an existing file, but not forcing
|
// Dest is an existing file, but not forcing
|
||||||
if (destStat && destStat.isFile() && !force) {
|
if (destStat && destStat.isFile() && !force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// If dest is an existing directory, should copy inside.
|
// If dest is an existing directory, should copy inside.
|
||||||
const newDest = destStat && destStat.isDirectory()
|
const newDest = destStat && destStat.isDirectory() && copySourceDirectory
|
||||||
? path.join(dest, path.basename(source))
|
? path.join(dest, path.basename(source))
|
||||||
: dest;
|
: dest;
|
||||||
if (!(yield ioUtil.exists(source))) {
|
if (!(yield ioUtil.exists(source))) {
|
||||||
|
@ -195,12 +217,22 @@ function rmRF(inputPath) {
|
||||||
if (ioUtil.IS_WINDOWS) {
|
if (ioUtil.IS_WINDOWS) {
|
||||||
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
||||||
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
||||||
|
// Check for invalid characters
|
||||||
|
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
||||||
|
if (/[*"<>|]/.test(inputPath)) {
|
||||||
|
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
|
const cmdPath = ioUtil.getCmdPath();
|
||||||
if (yield ioUtil.isDirectory(inputPath, true)) {
|
if (yield ioUtil.isDirectory(inputPath, true)) {
|
||||||
yield exec(`rd /s /q "${inputPath}"`);
|
yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
||||||
|
env: { inputPath }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
yield exec(`del /f /a "${inputPath}"`);
|
yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
||||||
|
env: { inputPath }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
@ -233,7 +265,7 @@ function rmRF(inputPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isDir) {
|
if (isDir) {
|
||||||
yield exec(`rm -rf "${inputPath}"`);
|
yield execFile(`rm`, [`-rf`, `${inputPath}`]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
yield ioUtil.unlink(inputPath);
|
yield ioUtil.unlink(inputPath);
|
||||||
|
@ -251,7 +283,8 @@ exports.rmRF = rmRF;
|
||||||
*/
|
*/
|
||||||
function mkdirP(fsPath) {
|
function mkdirP(fsPath) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
yield ioUtil.mkdirP(fsPath);
|
assert_1.ok(fsPath, 'a path argument must be provided');
|
||||||
|
yield ioUtil.mkdir(fsPath, { recursive: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.mkdirP = mkdirP;
|
exports.mkdirP = mkdirP;
|
||||||
|
@ -279,12 +312,30 @@ function which(tool, check) {
|
||||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
const matches = yield findInPath(tool);
|
||||||
|
if (matches && matches.length > 0) {
|
||||||
|
return matches[0];
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.which = which;
|
||||||
|
/**
|
||||||
|
* Returns a list of all occurrences of the given tool on the system path.
|
||||||
|
*
|
||||||
|
* @returns Promise<string[]> the paths of the tool
|
||||||
|
*/
|
||||||
|
function findInPath(tool) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!tool) {
|
||||||
|
throw new Error("parameter 'tool' is required");
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
// build the list of extensions to try
|
// build the list of extensions to try
|
||||||
const extensions = [];
|
const extensions = [];
|
||||||
if (ioUtil.IS_WINDOWS && process.env.PATHEXT) {
|
if (ioUtil.IS_WINDOWS && process.env['PATHEXT']) {
|
||||||
for (const extension of process.env.PATHEXT.split(path.delimiter)) {
|
for (const extension of process.env['PATHEXT'].split(path.delimiter)) {
|
||||||
if (extension) {
|
if (extension) {
|
||||||
extensions.push(extension);
|
extensions.push(extension);
|
||||||
}
|
}
|
||||||
|
@ -294,13 +345,13 @@ function which(tool, check) {
|
||||||
if (ioUtil.isRooted(tool)) {
|
if (ioUtil.isRooted(tool)) {
|
||||||
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
return filePath;
|
return [filePath];
|
||||||
}
|
}
|
||||||
return '';
|
return [];
|
||||||
}
|
}
|
||||||
// if any path separators, return empty
|
// if any path separators, return empty
|
||||||
if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) {
|
if (tool.includes(path.sep)) {
|
||||||
return '';
|
return [];
|
||||||
}
|
}
|
||||||
// build the list of directories
|
// build the list of directories
|
||||||
//
|
//
|
||||||
|
@ -316,25 +367,25 @@ function which(tool, check) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// return the first match
|
// find all matches
|
||||||
|
const matches = [];
|
||||||
for (const directory of directories) {
|
for (const directory of directories) {
|
||||||
const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions);
|
const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions);
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
return filePath;
|
matches.push(filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '';
|
return matches;
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
throw new Error(`which failed with message ${err.message}`);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.which = which;
|
exports.findInPath = findInPath;
|
||||||
function readCopyOptions(options) {
|
function readCopyOptions(options) {
|
||||||
const force = options.force == null ? true : options.force;
|
const force = options.force == null ? true : options.force;
|
||||||
const recursive = Boolean(options.recursive);
|
const recursive = Boolean(options.recursive);
|
||||||
return { force, recursive };
|
const copySourceDirectory = options.copySourceDirectory == null
|
||||||
|
? true
|
||||||
|
: Boolean(options.copySourceDirectory);
|
||||||
|
return { force, recursive, copySourceDirectory };
|
||||||
}
|
}
|
||||||
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
@ -2086,13 +2137,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getServerUrl = exports.getFetchUrl = void 0;
|
exports.isGhes = exports.getServerApiUrl = exports.getServerUrl = exports.getFetchUrl = void 0;
|
||||||
const assert = __importStar(__webpack_require__(357));
|
const assert = __importStar(__webpack_require__(357));
|
||||||
const url_1 = __webpack_require__(835);
|
const url_1 = __webpack_require__(835);
|
||||||
function getFetchUrl(settings) {
|
function getFetchUrl(settings) {
|
||||||
assert.ok(settings.repositoryOwner, 'settings.repositoryOwner must be defined');
|
assert.ok(settings.repositoryOwner, 'settings.repositoryOwner must be defined');
|
||||||
assert.ok(settings.repositoryName, 'settings.repositoryName must be defined');
|
assert.ok(settings.repositoryName, 'settings.repositoryName must be defined');
|
||||||
const serviceUrl = getServerUrl();
|
const serviceUrl = getServerUrl(settings.githubServerUrl);
|
||||||
const encodedOwner = encodeURIComponent(settings.repositoryOwner);
|
const encodedOwner = encodeURIComponent(settings.repositoryOwner);
|
||||||
const encodedName = encodeURIComponent(settings.repositoryName);
|
const encodedName = encodeURIComponent(settings.repositoryName);
|
||||||
if (settings.sshKey) {
|
if (settings.sshKey) {
|
||||||
|
@ -2102,13 +2153,27 @@ function getFetchUrl(settings) {
|
||||||
return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
|
return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
|
||||||
}
|
}
|
||||||
exports.getFetchUrl = getFetchUrl;
|
exports.getFetchUrl = getFetchUrl;
|
||||||
function getServerUrl() {
|
function getServerUrl(url) {
|
||||||
// todo: remove GITHUB_URL after support for GHES Alpha is no longer needed
|
let urlValue = url && url.trim().length > 0
|
||||||
return new url_1.URL(process.env['GITHUB_SERVER_URL'] ||
|
? url
|
||||||
process.env['GITHUB_URL'] ||
|
: process.env['GITHUB_SERVER_URL'] || 'https://github.com';
|
||||||
'https://github.com');
|
return new url_1.URL(urlValue);
|
||||||
}
|
}
|
||||||
exports.getServerUrl = getServerUrl;
|
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;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@ -4018,7 +4083,7 @@ function setSshKnownHostsPath(sshKnownHostsPath) {
|
||||||
}
|
}
|
||||||
exports.setSshKnownHostsPath = setSshKnownHostsPath;
|
exports.setSshKnownHostsPath = setSshKnownHostsPath;
|
||||||
/**
|
/**
|
||||||
* Save the sef-safe-directory input so the POST action can retrieve the value.
|
* Save the set-safe-directory input so the POST action can retrieve the value.
|
||||||
*/
|
*/
|
||||||
function setSafeDirectory() {
|
function setSafeDirectory() {
|
||||||
core.saveState('setSafeDirectory', 'true');
|
core.saveState('setSafeDirectory', 'true');
|
||||||
|
@ -4448,6 +4513,51 @@ 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:
|
/***/ 197:
|
||||||
|
@ -4651,7 +4761,7 @@ module.exports = require("punycode");
|
||||||
/***/ 215:
|
/***/ 215:
|
||||||
/***/ (function(module) {
|
/***/ (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"}],"_resolved":"https://registry.npmjs.org/@octokit/rest/-/rest-16.43.1.tgz","_integrity":"sha512-gfFKwRT/wFxq5qlNjnW2dh+qh74XgTQ2B179UX5K1HYCluioWj8Ndbgqw2PVqa1NnVJkGHp2ovMpVn/DImlmkw==","_from":"@octokit/rest@16.43.1"};
|
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"}]};
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
@ -4690,9 +4800,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.checkCommitInfo = exports.testRef = exports.getRefSpec = exports.getRefSpecForAllHistory = exports.getCheckoutInfo = exports.tagsRefSpec = void 0;
|
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 core = __importStar(__webpack_require__(470));
|
||||||
const github = __importStar(__webpack_require__(469));
|
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/*';
|
exports.tagsRefSpec = '+refs/tags/*:refs/tags/*';
|
||||||
function getCheckoutInfo(git, ref, commit) {
|
function getCheckoutInfo(git, ref, commit) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
@ -4842,12 +4953,12 @@ function testRef(git, ref, commit) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.testRef = testRef;
|
exports.testRef = testRef;
|
||||||
function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref, commit) {
|
function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref, commit, baseUrl) {
|
||||||
var _a, _b;
|
var _a, _b;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
// GHES?
|
// GHES?
|
||||||
if (isGhes()) {
|
if ((0, url_helper_1.isGhes)(baseUrl)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Auth token?
|
// Auth token?
|
||||||
|
@ -4892,7 +5003,8 @@ function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref
|
||||||
const actualHeadSha = match[1];
|
const actualHeadSha = match[1];
|
||||||
if (actualHeadSha !== expectedHeadSha) {
|
if (actualHeadSha !== expectedHeadSha) {
|
||||||
core.debug(`Expected head sha ${expectedHeadSha}; actual head sha ${actualHeadSha}`);
|
core.debug(`Expected head sha ${expectedHeadSha}; actual head sha ${actualHeadSha}`);
|
||||||
const octokit = new github.GitHub(token, {
|
const octokit = (0, octokit_provider_1.getOctokit)(token, {
|
||||||
|
baseUrl: baseUrl,
|
||||||
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})`
|
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 });
|
yield octokit.repos.get({ owner: repositoryOwner, repo: repositoryName });
|
||||||
|
@ -4918,10 +5030,6 @@ function select(obj, path) {
|
||||||
const key = path.substr(0, i);
|
const key = path.substr(0, i);
|
||||||
return select(obj[key], path.substr(i + 1));
|
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';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@ -6972,7 +7080,7 @@ class GitAuthHelper {
|
||||||
this.git = gitCommandManager;
|
this.git = gitCommandManager;
|
||||||
this.settings = gitSourceSettings || {};
|
this.settings = gitSourceSettings || {};
|
||||||
// Token auth header
|
// Token auth header
|
||||||
const serverUrl = urlHelper.getServerUrl();
|
const serverUrl = urlHelper.getServerUrl(this.settings.githubServerUrl);
|
||||||
this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader`; // "origin" is SCHEME://HOSTNAME[:PORT]
|
this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader`; // "origin" is SCHEME://HOSTNAME[:PORT]
|
||||||
const basicCredential = Buffer.from(`x-access-token:${this.settings.authToken}`, 'utf8').toString('base64');
|
const basicCredential = Buffer.from(`x-access-token:${this.settings.authToken}`, 'utf8').toString('base64');
|
||||||
core.setSecret(basicCredential);
|
core.setSecret(basicCredential);
|
||||||
|
@ -7064,7 +7172,9 @@ class GitAuthHelper {
|
||||||
// Configure a placeholder value. This approach avoids the credential being captured
|
// Configure a placeholder value. This approach avoids the credential being captured
|
||||||
// by process creation audit events, which are commonly logged. For more information,
|
// by process creation audit events, which are commonly logged. For more information,
|
||||||
// refer to https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
|
// refer to https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
|
||||||
const output = yield this.git.submoduleForeach(`git config --local '${this.tokenConfigKey}' '${this.tokenPlaceholderConfigValue}' && git config --local --show-origin --name-only --get-regexp remote.origin.url`, this.settings.nestedSubmodules);
|
const output = yield this.git.submoduleForeach(
|
||||||
|
// wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
|
||||||
|
`sh -c "git config --local '${this.tokenConfigKey}' '${this.tokenPlaceholderConfigValue}' && git config --local --show-origin --name-only --get-regexp remote.origin.url"`, this.settings.nestedSubmodules);
|
||||||
// Replace the placeholder
|
// Replace the placeholder
|
||||||
const configPaths = output.match(/(?<=(^|\n)file:)[^\t]+(?=\tremote\.origin\.url)/g) || [];
|
const configPaths = output.match(/(?<=(^|\n)file:)[^\t]+(?=\tremote\.origin\.url)/g) || [];
|
||||||
for (const configPath of configPaths) {
|
for (const configPath of configPaths) {
|
||||||
|
@ -7231,7 +7341,9 @@ class GitAuthHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const pattern = regexpHelper.escape(configKey);
|
const pattern = regexpHelper.escape(configKey);
|
||||||
yield this.git.submoduleForeach(`git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :`, true);
|
yield this.git.submoduleForeach(
|
||||||
|
// wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
|
||||||
|
`sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7329,8 +7441,10 @@ class GitCommandManager {
|
||||||
const result = [];
|
const result = [];
|
||||||
// Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
|
// Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
|
||||||
// "branch --list" is more difficult when in a detached HEAD state.
|
// "branch --list" is more difficult when in a detached HEAD state.
|
||||||
// Note, this implementation uses "rev-parse --symbolic-full-name" because there is a bug
|
// TODO(https://github.com/actions/checkout/issues/786): this implementation uses
|
||||||
// in Git 2.18 that causes "rev-parse --symbolic" to output symbolic full names.
|
// "rev-parse --symbolic-full-name" because there is a bug
|
||||||
|
// in Git 2.18 that causes "rev-parse --symbolic" to output symbolic full names. When
|
||||||
|
// 2.18 is no longer supported, we can switch back to --symbolic.
|
||||||
const args = ['rev-parse', '--symbolic-full-name'];
|
const args = ['rev-parse', '--symbolic-full-name'];
|
||||||
if (remote) {
|
if (remote) {
|
||||||
args.push('--remotes=origin');
|
args.push('--remotes=origin');
|
||||||
|
@ -7338,19 +7452,43 @@ class GitCommandManager {
|
||||||
else {
|
else {
|
||||||
args.push('--branches');
|
args.push('--branches');
|
||||||
}
|
}
|
||||||
const output = yield this.execGit(args);
|
const stderr = [];
|
||||||
for (let branch of output.stdout.trim().split('\n')) {
|
const errline = [];
|
||||||
|
const stdout = [];
|
||||||
|
const stdline = [];
|
||||||
|
const listeners = {
|
||||||
|
stderr: (data) => {
|
||||||
|
stderr.push(data.toString());
|
||||||
|
},
|
||||||
|
errline: (data) => {
|
||||||
|
errline.push(data.toString());
|
||||||
|
},
|
||||||
|
stdout: (data) => {
|
||||||
|
stdout.push(data.toString());
|
||||||
|
},
|
||||||
|
stdline: (data) => {
|
||||||
|
stdline.push(data.toString());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// Suppress the output in order to avoid flooding annotations with innocuous errors.
|
||||||
|
yield this.execGit(args, false, true, listeners);
|
||||||
|
core.debug(`stderr callback is: ${stderr}`);
|
||||||
|
core.debug(`errline callback is: ${errline}`);
|
||||||
|
core.debug(`stdout callback is: ${stdout}`);
|
||||||
|
core.debug(`stdline callback is: ${stdline}`);
|
||||||
|
for (let branch of stdline) {
|
||||||
branch = branch.trim();
|
branch = branch.trim();
|
||||||
if (branch) {
|
if (!branch) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (branch.startsWith('refs/heads/')) {
|
if (branch.startsWith('refs/heads/')) {
|
||||||
branch = branch.substr('refs/heads/'.length);
|
branch = branch.substring('refs/heads/'.length);
|
||||||
}
|
}
|
||||||
else if (branch.startsWith('refs/remotes/')) {
|
else if (branch.startsWith('refs/remotes/')) {
|
||||||
branch = branch.substr('refs/remotes/'.length);
|
branch = branch.substring('refs/remotes/'.length);
|
||||||
}
|
}
|
||||||
result.push(branch);
|
result.push(branch);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -7600,7 +7738,7 @@ class GitCommandManager {
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
execGit(args, allowAllExitCodes = false, silent = false) {
|
execGit(args, allowAllExitCodes = false, silent = false, customListeners = {}) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
fshelper.directoryExistsSync(this.workingDirectory, true);
|
fshelper.directoryExistsSync(this.workingDirectory, true);
|
||||||
const result = new GitOutput();
|
const result = new GitOutput();
|
||||||
|
@ -7611,20 +7749,24 @@ class GitCommandManager {
|
||||||
for (const key of Object.keys(this.gitEnv)) {
|
for (const key of Object.keys(this.gitEnv)) {
|
||||||
env[key] = this.gitEnv[key];
|
env[key] = this.gitEnv[key];
|
||||||
}
|
}
|
||||||
|
const defaultListener = {
|
||||||
|
stdout: (data) => {
|
||||||
|
stdout.push(data.toString());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const mergedListeners = Object.assign(Object.assign({}, defaultListener), customListeners);
|
||||||
const stdout = [];
|
const stdout = [];
|
||||||
const options = {
|
const options = {
|
||||||
cwd: this.workingDirectory,
|
cwd: this.workingDirectory,
|
||||||
env,
|
env,
|
||||||
silent,
|
silent,
|
||||||
ignoreReturnCode: allowAllExitCodes,
|
ignoreReturnCode: allowAllExitCodes,
|
||||||
listeners: {
|
listeners: mergedListeners
|
||||||
stdout: (data) => {
|
|
||||||
stdout.push(data.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
result.exitCode = yield exec.exec(`"${this.gitPath}"`, args, options);
|
result.exitCode = yield exec.exec(`"${this.gitPath}"`, args, options);
|
||||||
result.stdout = stdout.join('');
|
result.stdout = stdout.join('');
|
||||||
|
core.debug(result.exitCode.toString());
|
||||||
|
core.debug(result.stdout);
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -10567,7 +10709,7 @@ Object.defineProperty(Response.prototype, Symbol.toStringTag, {
|
||||||
});
|
});
|
||||||
|
|
||||||
const INTERNALS$2 = Symbol('Request internals');
|
const INTERNALS$2 = Symbol('Request internals');
|
||||||
const URL = whatwgUrl.URL;
|
const URL = Url.URL || whatwgUrl.URL;
|
||||||
|
|
||||||
// fix an issue where "format", "parse" aren't a named export for node <10
|
// fix an issue where "format", "parse" aren't a named export for node <10
|
||||||
const parse_url = Url.parse;
|
const parse_url = Url.parse;
|
||||||
|
@ -10830,9 +10972,17 @@ AbortError.prototype = Object.create(Error.prototype);
|
||||||
AbortError.prototype.constructor = AbortError;
|
AbortError.prototype.constructor = AbortError;
|
||||||
AbortError.prototype.name = 'AbortError';
|
AbortError.prototype.name = 'AbortError';
|
||||||
|
|
||||||
|
const URL$1 = Url.URL || whatwgUrl.URL;
|
||||||
|
|
||||||
// fix an issue where "PassThrough", "resolve" aren't a named export for node <10
|
// fix an issue where "PassThrough", "resolve" aren't a named export for node <10
|
||||||
const PassThrough$1 = Stream.PassThrough;
|
const PassThrough$1 = Stream.PassThrough;
|
||||||
const resolve_url = Url.resolve;
|
|
||||||
|
const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) {
|
||||||
|
const orig = new URL$1(original).hostname;
|
||||||
|
const dest = new URL$1(destination).hostname;
|
||||||
|
|
||||||
|
return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch function
|
* Fetch function
|
||||||
|
@ -10920,7 +11070,19 @@ function fetch(url, opts) {
|
||||||
const location = headers.get('Location');
|
const location = headers.get('Location');
|
||||||
|
|
||||||
// HTTP fetch step 5.3
|
// HTTP fetch step 5.3
|
||||||
const locationURL = location === null ? null : resolve_url(request.url, location);
|
let locationURL = null;
|
||||||
|
try {
|
||||||
|
locationURL = location === null ? null : new URL$1(location, request.url).toString();
|
||||||
|
} catch (err) {
|
||||||
|
// error here can only be invalid URL in Location: header
|
||||||
|
// do not throw when options.redirect == manual
|
||||||
|
// let the user extract the errorneous redirect URL
|
||||||
|
if (request.redirect !== 'manual') {
|
||||||
|
reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'));
|
||||||
|
finalize();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// HTTP fetch step 5.5
|
// HTTP fetch step 5.5
|
||||||
switch (request.redirect) {
|
switch (request.redirect) {
|
||||||
|
@ -10968,6 +11130,12 @@ function fetch(url, opts) {
|
||||||
size: request.size
|
size: request.size
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!isDomainOrSubdomain(request.url, locationURL)) {
|
||||||
|
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
|
||||||
|
requestOpts.headers.delete(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// HTTP-redirect fetch step 9
|
// HTTP-redirect fetch step 9
|
||||||
if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
|
if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
|
||||||
reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
|
reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
|
||||||
|
@ -11255,24 +11423,24 @@ exports.getDefaultBranch = exports.downloadRepository = void 0;
|
||||||
const assert = __importStar(__webpack_require__(357));
|
const assert = __importStar(__webpack_require__(357));
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const fs = __importStar(__webpack_require__(747));
|
const fs = __importStar(__webpack_require__(747));
|
||||||
const github = __importStar(__webpack_require__(469));
|
|
||||||
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 retryHelper = __importStar(__webpack_require__(587));
|
const retryHelper = __importStar(__webpack_require__(587));
|
||||||
const toolCache = __importStar(__webpack_require__(533));
|
const toolCache = __importStar(__webpack_require__(533));
|
||||||
const v4_1 = __importDefault(__webpack_require__(826));
|
const v4_1 = __importDefault(__webpack_require__(826));
|
||||||
|
const octokit_provider_1 = __webpack_require__(195);
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath) {
|
function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath, baseUrl) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Determine the default branch
|
// Determine the default branch
|
||||||
if (!ref && !commit) {
|
if (!ref && !commit) {
|
||||||
core.info('Determining the default branch');
|
core.info('Determining the default branch');
|
||||||
ref = yield getDefaultBranch(authToken, owner, repo);
|
ref = yield getDefaultBranch(authToken, owner, repo, baseUrl);
|
||||||
}
|
}
|
||||||
// Download the archive
|
// Download the archive
|
||||||
let archiveData = yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
let archiveData = yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
||||||
core.info('Downloading the archive');
|
core.info('Downloading the archive');
|
||||||
return yield downloadArchive(authToken, owner, repo, ref, commit);
|
return yield downloadArchive(authToken, owner, repo, ref, commit, baseUrl);
|
||||||
}));
|
}));
|
||||||
// Write archive to disk
|
// Write archive to disk
|
||||||
core.info('Writing archive to disk');
|
core.info('Writing archive to disk');
|
||||||
|
@ -11316,12 +11484,12 @@ exports.downloadRepository = downloadRepository;
|
||||||
/**
|
/**
|
||||||
* Looks up the default branch name
|
* Looks up the default branch name
|
||||||
*/
|
*/
|
||||||
function getDefaultBranch(authToken, owner, repo) {
|
function getDefaultBranch(authToken, owner, repo, baseUrl) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
||||||
var _a;
|
var _a;
|
||||||
core.info('Retrieving the default branch name');
|
core.info('Retrieving the default branch name');
|
||||||
const octokit = new github.GitHub(authToken);
|
const octokit = (0, octokit_provider_1.getOctokit)(authToken, { baseUrl: baseUrl });
|
||||||
let result;
|
let result;
|
||||||
try {
|
try {
|
||||||
// Get the default branch from the repo info
|
// Get the default branch from the repo info
|
||||||
|
@ -11351,9 +11519,9 @@ function getDefaultBranch(authToken, owner, repo) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getDefaultBranch = getDefaultBranch;
|
exports.getDefaultBranch = getDefaultBranch;
|
||||||
function downloadArchive(authToken, owner, repo, ref, commit) {
|
function downloadArchive(authToken, owner, repo, ref, commit, baseUrl) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const octokit = new github.GitHub(authToken);
|
const octokit = (0, octokit_provider_1.getOctokit)(authToken, { baseUrl: baseUrl });
|
||||||
const params = {
|
const params = {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
repo: repo,
|
repo: repo,
|
||||||
|
@ -13809,6 +13977,7 @@ var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
||||||
|
|
||||||
i += 1;
|
i += 1;
|
||||||
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
||||||
|
/* eslint operator-linebreak: [2, "before"] */
|
||||||
out += hexTable[0xF0 | (c >> 18)]
|
out += hexTable[0xF0 | (c >> 18)]
|
||||||
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
||||||
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
||||||
|
@ -16310,6 +16479,25 @@ module.exports = require("util");
|
||||||
|
|
||||||
"use strict";
|
"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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
@ -16321,9 +16509,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
};
|
};
|
||||||
var _a;
|
var _a;
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const assert_1 = __webpack_require__(357);
|
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
|
||||||
const fs = __webpack_require__(747);
|
const fs = __importStar(__webpack_require__(747));
|
||||||
const path = __webpack_require__(622);
|
const path = __importStar(__webpack_require__(622));
|
||||||
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
||||||
exports.IS_WINDOWS = process.platform === 'win32';
|
exports.IS_WINDOWS = process.platform === 'win32';
|
||||||
function exists(fsPath) {
|
function exists(fsPath) {
|
||||||
|
@ -16364,49 +16552,6 @@ function isRooted(p) {
|
||||||
return p.startsWith('/');
|
return p.startsWith('/');
|
||||||
}
|
}
|
||||||
exports.isRooted = isRooted;
|
exports.isRooted = isRooted;
|
||||||
/**
|
|
||||||
* Recursively create a directory at `fsPath`.
|
|
||||||
*
|
|
||||||
* This implementation is optimistic, meaning it attempts to create the full
|
|
||||||
* path first, and backs up the path stack from there.
|
|
||||||
*
|
|
||||||
* @param fsPath The path to create
|
|
||||||
* @param maxDepth The maximum recursion depth
|
|
||||||
* @param depth The current recursion depth
|
|
||||||
*/
|
|
||||||
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
assert_1.ok(fsPath, 'a path argument must be provided');
|
|
||||||
fsPath = path.resolve(fsPath);
|
|
||||||
if (depth >= maxDepth)
|
|
||||||
return exports.mkdir(fsPath);
|
|
||||||
try {
|
|
||||||
yield exports.mkdir(fsPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
switch (err.code) {
|
|
||||||
case 'ENOENT': {
|
|
||||||
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
|
||||||
yield exports.mkdir(fsPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
let stats;
|
|
||||||
try {
|
|
||||||
stats = yield exports.stat(fsPath);
|
|
||||||
}
|
|
||||||
catch (err2) {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
if (!stats.isDirectory())
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.mkdirP = mkdirP;
|
|
||||||
/**
|
/**
|
||||||
* Best effort attempt to determine whether a file exists and is executable.
|
* Best effort attempt to determine whether a file exists and is executable.
|
||||||
* @param filePath file path to check
|
* @param filePath file path to check
|
||||||
|
@ -16503,6 +16648,12 @@ function isUnixExecutable(stats) {
|
||||||
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
||||||
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
||||||
}
|
}
|
||||||
|
// Get the path of cmd.exe in windows
|
||||||
|
function getCmdPath() {
|
||||||
|
var _a;
|
||||||
|
return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`;
|
||||||
|
}
|
||||||
|
exports.getCmdPath = getCmdPath;
|
||||||
//# sourceMappingURL=io-util.js.map
|
//# sourceMappingURL=io-util.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@ -17452,7 +17603,7 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
||||||
) {
|
) {
|
||||||
obj = [];
|
obj = [];
|
||||||
obj[index] = leaf;
|
obj[index] = leaf;
|
||||||
} else {
|
} else if (cleanRoot !== '__proto__') {
|
||||||
obj[cleanRoot] = leaf;
|
obj[cleanRoot] = leaf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18401,6 +18552,9 @@ function getInputs() {
|
||||||
// Set safe.directory in git global config.
|
// Set safe.directory in git global config.
|
||||||
result.setSafeDirectory =
|
result.setSafeDirectory =
|
||||||
(core.getInput('set-safe-directory') || 'true').toUpperCase() === 'TRUE';
|
(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;
|
return result;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -31771,7 +31925,7 @@ function getSource(settings) {
|
||||||
else if (settings.sshKey) {
|
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.`);
|
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);
|
yield githubApiHelper.downloadRepository(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.repositoryPath, settings.githubServerUrl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Save state for POST action
|
// Save state for POST action
|
||||||
|
@ -31804,7 +31958,7 @@ function getSource(settings) {
|
||||||
settings.ref = yield git.getDefaultBranch(repositoryUrl);
|
settings.ref = yield git.getDefaultBranch(repositoryUrl);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
settings.ref = yield githubApiHelper.getDefaultBranch(settings.authToken, settings.repositoryOwner, settings.repositoryName);
|
settings.ref = yield githubApiHelper.getDefaultBranch(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.githubServerUrl);
|
||||||
}
|
}
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
}
|
}
|
||||||
|
@ -31870,7 +32024,7 @@ function getSource(settings) {
|
||||||
// Log commit sha
|
// Log commit sha
|
||||||
yield git.log1("--format='%H'");
|
yield git.log1("--format='%H'");
|
||||||
// Check for incorrect pull request merge commit
|
// Check for incorrect pull request merge commit
|
||||||
yield refHelper.checkCommitInfo(settings.authToken, commitInfo, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit);
|
yield refHelper.checkCommitInfo(settings.authToken, commitInfo, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.githubServerUrl);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
// Remove auth
|
// Remove auth
|
||||||
|
@ -34581,6 +34735,7 @@ var arrayPrefixGenerators = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var isArray = Array.isArray;
|
var isArray = Array.isArray;
|
||||||
|
var split = String.prototype.split;
|
||||||
var push = Array.prototype.push;
|
var push = Array.prototype.push;
|
||||||
var pushToArray = function (arr, valueOrArray) {
|
var pushToArray = function (arr, valueOrArray) {
|
||||||
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
||||||
|
@ -34617,10 +34772,13 @@ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
|
||||||
|| typeof v === 'bigint';
|
|| typeof v === 'bigint';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var sentinel = {};
|
||||||
|
|
||||||
var stringify = function stringify(
|
var stringify = function stringify(
|
||||||
object,
|
object,
|
||||||
prefix,
|
prefix,
|
||||||
generateArrayPrefix,
|
generateArrayPrefix,
|
||||||
|
commaRoundTrip,
|
||||||
strictNullHandling,
|
strictNullHandling,
|
||||||
skipNulls,
|
skipNulls,
|
||||||
encoder,
|
encoder,
|
||||||
|
@ -34636,8 +34794,23 @@ var stringify = function stringify(
|
||||||
) {
|
) {
|
||||||
var obj = object;
|
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');
|
throw new RangeError('Cyclic object value');
|
||||||
|
} else {
|
||||||
|
findFlag = true; // Break while
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof tmpSc.get(sentinel) === 'undefined') {
|
||||||
|
step = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof filter === 'function') {
|
if (typeof filter === 'function') {
|
||||||
|
@ -34664,6 +34837,14 @@ var stringify = function stringify(
|
||||||
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
||||||
if (encoder) {
|
if (encoder) {
|
||||||
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
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(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
||||||
}
|
}
|
||||||
return [formatter(prefix) + '=' + formatter(String(obj))];
|
return [formatter(prefix) + '=' + formatter(String(obj))];
|
||||||
|
@ -34678,7 +34859,7 @@ var stringify = function stringify(
|
||||||
var objKeys;
|
var objKeys;
|
||||||
if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
||||||
// we need to join elements in
|
// 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)) {
|
} else if (isArray(filter)) {
|
||||||
objKeys = filter;
|
objKeys = filter;
|
||||||
} else {
|
} else {
|
||||||
|
@ -34686,24 +34867,28 @@ var stringify = function stringify(
|
||||||
objKeys = sort ? keys.sort(sort) : keys;
|
objKeys = sort ? keys.sort(sort) : keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < objKeys.length; ++i) {
|
var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix;
|
||||||
var key = objKeys[i];
|
|
||||||
var value = typeof key === 'object' && key.value !== undefined ? key.value : obj[key];
|
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) {
|
if (skipNulls && value === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var keyPrefix = isArray(obj)
|
var keyPrefix = isArray(obj)
|
||||||
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix
|
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
|
||||||
: prefix + (allowDots ? '.' + key : '[' + key + ']');
|
: adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
|
||||||
|
|
||||||
sideChannel.set(object, true);
|
sideChannel.set(object, step);
|
||||||
var valueSideChannel = getSideChannel();
|
var valueSideChannel = getSideChannel();
|
||||||
|
valueSideChannel.set(sentinel, sideChannel);
|
||||||
pushToArray(values, stringify(
|
pushToArray(values, stringify(
|
||||||
value,
|
value,
|
||||||
keyPrefix,
|
keyPrefix,
|
||||||
generateArrayPrefix,
|
generateArrayPrefix,
|
||||||
|
commaRoundTrip,
|
||||||
strictNullHandling,
|
strictNullHandling,
|
||||||
skipNulls,
|
skipNulls,
|
||||||
encoder,
|
encoder,
|
||||||
|
@ -34727,7 +34912,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
|
||||||
return defaults;
|
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.');
|
throw new TypeError('Encoder has to be a function.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34800,6 +34985,10 @@ module.exports = function (object, opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
|
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) {
|
if (!objKeys) {
|
||||||
objKeys = Object.keys(obj);
|
objKeys = Object.keys(obj);
|
||||||
|
@ -34820,6 +35009,7 @@ module.exports = function (object, opts) {
|
||||||
obj[key],
|
obj[key],
|
||||||
key,
|
key,
|
||||||
generateArrayPrefix,
|
generateArrayPrefix,
|
||||||
|
commaRoundTrip,
|
||||||
options.strictNullHandling,
|
options.strictNullHandling,
|
||||||
options.skipNulls,
|
options.skipNulls,
|
||||||
options.encode ? options.encoder : null,
|
options.encode ? options.encoder : null,
|
||||||
|
|
22577
package-lock.json
generated
22577
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "checkout",
|
"name": "checkout",
|
||||||
"version": "2.0.2",
|
"version": "3.2.0",
|
||||||
"description": "checkout action",
|
"description": "checkout action",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
"@actions/github": "^2.2.0",
|
"@actions/github": "^2.2.0",
|
||||||
"@actions/io": "^1.0.1",
|
"@actions/io": "^1.1.2",
|
||||||
"@actions/tool-cache": "^1.1.2",
|
"@actions/tool-cache": "^1.1.2",
|
||||||
"uuid": "^3.3.3"
|
"uuid": "^3.3.3"
|
||||||
},
|
},
|
||||||
|
@ -39,11 +39,12 @@
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^27.0.2",
|
||||||
"@types/node": "^12.7.12",
|
"@types/node": "^12.7.12",
|
||||||
"@types/uuid": "^3.4.6",
|
"@types/uuid": "^3.4.6",
|
||||||
"@typescript-eslint/parser": "^5.1.0",
|
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
||||||
|
"@typescript-eslint/parser": "^5.45.0",
|
||||||
"@zeit/ncc": "^0.20.5",
|
"@zeit/ncc": "^0.20.5",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-plugin-github": "^4.3.2",
|
"eslint-plugin-github": "^4.3.2",
|
||||||
"eslint-plugin-jest": "^25.2.2",
|
"eslint-plugin-jest": "^25.7.0",
|
||||||
"jest": "^27.3.0",
|
"jest": "^27.3.0",
|
||||||
"jest-circus": "^27.3.0",
|
"jest-circus": "^27.3.0",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
|
|
|
@ -52,7 +52,7 @@ class GitAuthHelper {
|
||||||
this.settings = gitSourceSettings || (({} as unknown) as IGitSourceSettings)
|
this.settings = gitSourceSettings || (({} as unknown) as IGitSourceSettings)
|
||||||
|
|
||||||
// Token auth header
|
// Token auth header
|
||||||
const serverUrl = urlHelper.getServerUrl()
|
const serverUrl = urlHelper.getServerUrl(this.settings.githubServerUrl)
|
||||||
this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader` // "origin" is SCHEME://HOSTNAME[:PORT]
|
this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader` // "origin" is SCHEME://HOSTNAME[:PORT]
|
||||||
const basicCredential = Buffer.from(
|
const basicCredential = Buffer.from(
|
||||||
`x-access-token:${this.settings.authToken}`,
|
`x-access-token:${this.settings.authToken}`,
|
||||||
|
@ -157,7 +157,8 @@ class GitAuthHelper {
|
||||||
// by process creation audit events, which are commonly logged. For more information,
|
// by process creation audit events, which are commonly logged. For more information,
|
||||||
// refer to https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
|
// refer to https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
|
||||||
const output = await this.git.submoduleForeach(
|
const output = await this.git.submoduleForeach(
|
||||||
`git config --local '${this.tokenConfigKey}' '${this.tokenPlaceholderConfigValue}' && git config --local --show-origin --name-only --get-regexp remote.origin.url`,
|
// wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
|
||||||
|
`sh -c "git config --local '${this.tokenConfigKey}' '${this.tokenPlaceholderConfigValue}' && git config --local --show-origin --name-only --get-regexp remote.origin.url"`,
|
||||||
this.settings.nestedSubmodules
|
this.settings.nestedSubmodules
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -365,7 +366,8 @@ class GitAuthHelper {
|
||||||
|
|
||||||
const pattern = regexpHelper.escape(configKey)
|
const pattern = regexpHelper.escape(configKey)
|
||||||
await this.git.submoduleForeach(
|
await this.git.submoduleForeach(
|
||||||
`git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :`,
|
// wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
|
||||||
|
`sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,11 @@ class GitCommandManager {
|
||||||
|
|
||||||
// Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
|
// Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
|
||||||
// "branch --list" is more difficult when in a detached HEAD state.
|
// "branch --list" is more difficult when in a detached HEAD state.
|
||||||
// Note, this implementation uses "rev-parse --symbolic-full-name" because there is a bug
|
|
||||||
// in Git 2.18 that causes "rev-parse --symbolic" to output symbolic full names.
|
// TODO(https://github.com/actions/checkout/issues/786): this implementation uses
|
||||||
|
// "rev-parse --symbolic-full-name" because there is a bug
|
||||||
|
// in Git 2.18 that causes "rev-parse --symbolic" to output symbolic full names. When
|
||||||
|
// 2.18 is no longer supported, we can switch back to --symbolic.
|
||||||
|
|
||||||
const args = ['rev-parse', '--symbolic-full-name']
|
const args = ['rev-parse', '--symbolic-full-name']
|
||||||
if (remote) {
|
if (remote) {
|
||||||
|
@ -104,20 +107,48 @@ class GitCommandManager {
|
||||||
args.push('--branches')
|
args.push('--branches')
|
||||||
}
|
}
|
||||||
|
|
||||||
const output = await this.execGit(args)
|
const stderr: string[] = []
|
||||||
|
const errline: string[] = []
|
||||||
|
const stdout: string[] = []
|
||||||
|
const stdline: string[] = []
|
||||||
|
|
||||||
for (let branch of output.stdout.trim().split('\n')) {
|
const listeners = {
|
||||||
|
stderr: (data: Buffer) => {
|
||||||
|
stderr.push(data.toString())
|
||||||
|
},
|
||||||
|
errline: (data: Buffer) => {
|
||||||
|
errline.push(data.toString())
|
||||||
|
},
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
stdout.push(data.toString())
|
||||||
|
},
|
||||||
|
stdline: (data: Buffer) => {
|
||||||
|
stdline.push(data.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Suppress the output in order to avoid flooding annotations with innocuous errors.
|
||||||
|
await this.execGit(args, false, true, listeners)
|
||||||
|
|
||||||
|
core.debug(`stderr callback is: ${stderr}`)
|
||||||
|
core.debug(`errline callback is: ${errline}`)
|
||||||
|
core.debug(`stdout callback is: ${stdout}`)
|
||||||
|
core.debug(`stdline callback is: ${stdline}`)
|
||||||
|
|
||||||
|
for (let branch of stdline) {
|
||||||
branch = branch.trim()
|
branch = branch.trim()
|
||||||
if (branch) {
|
if (!branch) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if (branch.startsWith('refs/heads/')) {
|
if (branch.startsWith('refs/heads/')) {
|
||||||
branch = branch.substr('refs/heads/'.length)
|
branch = branch.substring('refs/heads/'.length)
|
||||||
} else if (branch.startsWith('refs/remotes/')) {
|
} else if (branch.startsWith('refs/remotes/')) {
|
||||||
branch = branch.substr('refs/remotes/'.length)
|
branch = branch.substring('refs/remotes/'.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
result.push(branch)
|
result.push(branch)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -395,7 +426,8 @@ class GitCommandManager {
|
||||||
private async execGit(
|
private async execGit(
|
||||||
args: string[],
|
args: string[],
|
||||||
allowAllExitCodes = false,
|
allowAllExitCodes = false,
|
||||||
silent = false
|
silent = false,
|
||||||
|
customListeners = {}
|
||||||
): Promise<GitOutput> {
|
): Promise<GitOutput> {
|
||||||
fshelper.directoryExistsSync(this.workingDirectory, true)
|
fshelper.directoryExistsSync(this.workingDirectory, true)
|
||||||
|
|
||||||
|
@ -409,22 +441,29 @@ class GitCommandManager {
|
||||||
env[key] = this.gitEnv[key]
|
env[key] = this.gitEnv[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
const stdout: string[] = []
|
const defaultListener = {
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
stdout.push(data.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const mergedListeners = {...defaultListener, ...customListeners}
|
||||||
|
|
||||||
|
const stdout: string[] = []
|
||||||
const options = {
|
const options = {
|
||||||
cwd: this.workingDirectory,
|
cwd: this.workingDirectory,
|
||||||
env,
|
env,
|
||||||
silent,
|
silent,
|
||||||
ignoreReturnCode: allowAllExitCodes,
|
ignoreReturnCode: allowAllExitCodes,
|
||||||
listeners: {
|
listeners: mergedListeners
|
||||||
stdout: (data: Buffer) => {
|
|
||||||
stdout.push(data.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result.exitCode = await exec.exec(`"${this.gitPath}"`, args, options)
|
result.exitCode = await exec.exec(`"${this.gitPath}"`, args, options)
|
||||||
result.stdout = stdout.join('')
|
result.stdout = stdout.join('')
|
||||||
|
|
||||||
|
core.debug(result.exitCode.toString())
|
||||||
|
core.debug(result.stdout)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,8 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||||
settings.repositoryName,
|
settings.repositoryName,
|
||||||
settings.ref,
|
settings.ref,
|
||||||
settings.commit,
|
settings.commit,
|
||||||
settings.repositoryPath
|
settings.repositoryPath,
|
||||||
|
settings.githubServerUrl
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -138,7 +139,8 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||||
settings.ref = await githubApiHelper.getDefaultBranch(
|
settings.ref = await githubApiHelper.getDefaultBranch(
|
||||||
settings.authToken,
|
settings.authToken,
|
||||||
settings.repositoryOwner,
|
settings.repositoryOwner,
|
||||||
settings.repositoryName
|
settings.repositoryName,
|
||||||
|
settings.githubServerUrl
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
@ -232,7 +234,8 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||||
settings.repositoryOwner,
|
settings.repositoryOwner,
|
||||||
settings.repositoryName,
|
settings.repositoryName,
|
||||||
settings.ref,
|
settings.ref,
|
||||||
settings.commit
|
settings.commit,
|
||||||
|
settings.githubServerUrl
|
||||||
)
|
)
|
||||||
} finally {
|
} finally {
|
||||||
// Remove auth
|
// Remove auth
|
||||||
|
|
|
@ -83,4 +83,9 @@ export interface IGitSourceSettings {
|
||||||
* Indicates whether to add repositoryPath as safe.directory in git global config
|
* Indicates whether to add repositoryPath as safe.directory in git global config
|
||||||
*/
|
*/
|
||||||
setSafeDirectory: boolean
|
setSafeDirectory: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User override on the GitHub Server/Host URL that hosts the repository to be cloned
|
||||||
|
*/
|
||||||
|
githubServerUrl: string | undefined
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
import * as assert from 'assert'
|
import * as assert from 'assert'
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as github from '@actions/github'
|
|
||||||
import * as io from '@actions/io'
|
import * as io from '@actions/io'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as retryHelper from './retry-helper'
|
import * as retryHelper from './retry-helper'
|
||||||
import * as toolCache from '@actions/tool-cache'
|
import * as toolCache from '@actions/tool-cache'
|
||||||
import {default as uuid} from 'uuid/v4'
|
import {default as uuid} from 'uuid/v4'
|
||||||
import {Octokit} from '@octokit/rest'
|
import {getOctokit, Octokit} from './octokit-provider'
|
||||||
|
|
||||||
const IS_WINDOWS = process.platform === 'win32'
|
const IS_WINDOWS = process.platform === 'win32'
|
||||||
|
|
||||||
|
@ -17,18 +16,19 @@ export async function downloadRepository(
|
||||||
repo: string,
|
repo: string,
|
||||||
ref: string,
|
ref: string,
|
||||||
commit: string,
|
commit: string,
|
||||||
repositoryPath: string
|
repositoryPath: string,
|
||||||
|
baseUrl?: string
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// Determine the default branch
|
// Determine the default branch
|
||||||
if (!ref && !commit) {
|
if (!ref && !commit) {
|
||||||
core.info('Determining the default branch')
|
core.info('Determining the default branch')
|
||||||
ref = await getDefaultBranch(authToken, owner, repo)
|
ref = await getDefaultBranch(authToken, owner, repo, baseUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download the archive
|
// Download the archive
|
||||||
let archiveData = await retryHelper.execute(async () => {
|
let archiveData = await retryHelper.execute(async () => {
|
||||||
core.info('Downloading the archive')
|
core.info('Downloading the archive')
|
||||||
return await downloadArchive(authToken, owner, repo, ref, commit)
|
return await downloadArchive(authToken, owner, repo, ref, commit, baseUrl)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Write archive to disk
|
// Write archive to disk
|
||||||
|
@ -79,11 +79,12 @@ export async function downloadRepository(
|
||||||
export async function getDefaultBranch(
|
export async function getDefaultBranch(
|
||||||
authToken: string,
|
authToken: string,
|
||||||
owner: string,
|
owner: string,
|
||||||
repo: string
|
repo: string,
|
||||||
|
baseUrl?: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
return await retryHelper.execute(async () => {
|
return await retryHelper.execute(async () => {
|
||||||
core.info('Retrieving the default branch name')
|
core.info('Retrieving the default branch name')
|
||||||
const octokit = new github.GitHub(authToken)
|
const octokit = getOctokit(authToken, {baseUrl: baseUrl})
|
||||||
let result: string
|
let result: string
|
||||||
try {
|
try {
|
||||||
// Get the default branch from the repo info
|
// Get the default branch from the repo info
|
||||||
|
@ -121,9 +122,10 @@ async function downloadArchive(
|
||||||
owner: string,
|
owner: string,
|
||||||
repo: string,
|
repo: string,
|
||||||
ref: string,
|
ref: string,
|
||||||
commit: string
|
commit: string,
|
||||||
|
baseUrl?: string
|
||||||
): Promise<Buffer> {
|
): Promise<Buffer> {
|
||||||
const octokit = new github.GitHub(authToken)
|
const octokit = getOctokit(authToken, {baseUrl: baseUrl})
|
||||||
const params: Octokit.ReposGetArchiveLinkParams = {
|
const params: Octokit.ReposGetArchiveLinkParams = {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
repo: repo,
|
repo: repo,
|
||||||
|
|
|
@ -125,5 +125,10 @@ export async function getInputs(): Promise<IGitSourceSettings> {
|
||||||
// Set safe.directory in git global config.
|
// Set safe.directory in git global config.
|
||||||
result.setSafeDirectory =
|
result.setSafeDirectory =
|
||||||
(core.getInput('set-safe-directory') || 'true').toUpperCase() === 'TRUE'
|
(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
|
return result
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ function updateUsage(
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUsage(
|
updateUsage(
|
||||||
'actions/checkout@v2',
|
'actions/checkout@v3',
|
||||||
path.join(__dirname, '..', '..', 'action.yml'),
|
path.join(__dirname, '..', '..', 'action.yml'),
|
||||||
path.join(__dirname, '..', '..', 'README.md')
|
path.join(__dirname, '..', '..', 'README.md')
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,4 +5,4 @@ set -e
|
||||||
src/misc/licensed-download.sh
|
src/misc/licensed-download.sh
|
||||||
|
|
||||||
echo 'Running: licensed cached'
|
echo 'Running: licensed cached'
|
||||||
_temp/licensed-3.3.1/licensed status
|
_temp/licensed-3.6.0/licensed status
|
|
@ -2,23 +2,23 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ ! -f _temp/licensed-3.3.1.done ]; then
|
if [ ! -f _temp/licensed-3.6.0.done ]; then
|
||||||
echo 'Clearing temp'
|
echo 'Clearing temp'
|
||||||
rm -rf _temp/licensed-3.3.1 || true
|
rm -rf _temp/licensed-3.6.0 || true
|
||||||
|
|
||||||
echo 'Downloading licensed'
|
echo 'Downloading licensed'
|
||||||
mkdir -p _temp/licensed-3.3.1
|
mkdir -p _temp/licensed-3.6.0
|
||||||
pushd _temp/licensed-3.3.1
|
pushd _temp/licensed-3.6.0
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.3.1/licensed-3.3.1-darwin-x64.tar.gz
|
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.6.0/licensed-3.6.0-darwin-x64.tar.gz
|
||||||
else
|
else
|
||||||
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.3.1/licensed-3.3.1-linux-x64.tar.gz
|
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.6.0/licensed-3.6.0-linux-x64.tar.gz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo 'Extracting licenesed'
|
echo 'Extracting licenesed'
|
||||||
tar -xzf licensed.tar.gz
|
tar -xzf licensed.tar.gz
|
||||||
popd
|
popd
|
||||||
touch _temp/licensed-3.3.1.done
|
touch _temp/licensed-3.6.0.done
|
||||||
else
|
else
|
||||||
echo 'Licensed already downloaded'
|
echo 'Licensed already downloaded'
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -5,4 +5,4 @@ set -e
|
||||||
src/misc/licensed-download.sh
|
src/misc/licensed-download.sh
|
||||||
|
|
||||||
echo 'Running: licensed cached'
|
echo 'Running: licensed cached'
|
||||||
_temp/licensed-3.3.1/licensed cache
|
_temp/licensed-3.6.0/licensed cache
|
23
src/octokit-provider.ts
Normal file
23
src/octokit-provider.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
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,7 +1,8 @@
|
||||||
import {URL} from 'url'
|
|
||||||
import {IGitCommandManager} from './git-command-manager'
|
import {IGitCommandManager} from './git-command-manager'
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
|
import {getOctokit} from './octokit-provider'
|
||||||
|
import {isGhes} from './url-helper'
|
||||||
|
|
||||||
export const tagsRefSpec = '+refs/tags/*:refs/tags/*'
|
export const tagsRefSpec = '+refs/tags/*:refs/tags/*'
|
||||||
|
|
||||||
|
@ -183,11 +184,12 @@ export async function checkCommitInfo(
|
||||||
repositoryOwner: string,
|
repositoryOwner: string,
|
||||||
repositoryName: string,
|
repositoryName: string,
|
||||||
ref: string,
|
ref: string,
|
||||||
commit: string
|
commit: string,
|
||||||
|
baseUrl?: string
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
try {
|
||||||
// GHES?
|
// GHES?
|
||||||
if (isGhes()) {
|
if (isGhes(baseUrl)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +245,8 @@ export async function checkCommitInfo(
|
||||||
core.debug(
|
core.debug(
|
||||||
`Expected head sha ${expectedHeadSha}; actual head sha ${actualHeadSha}`
|
`Expected head sha ${expectedHeadSha}; actual head sha ${actualHeadSha}`
|
||||||
)
|
)
|
||||||
const octokit = new github.GitHub(token, {
|
const octokit = getOctokit(token, {
|
||||||
|
baseUrl: baseUrl,
|
||||||
userAgent: `actions-checkout-tracepoint/1.0 (code=STALE_MERGE;owner=${repositoryOwner};repo=${repositoryName};pr=${fromPayload(
|
userAgent: `actions-checkout-tracepoint/1.0 (code=STALE_MERGE;owner=${repositoryOwner};repo=${repositoryName};pr=${fromPayload(
|
||||||
'number'
|
'number'
|
||||||
)};run_id=${
|
)};run_id=${
|
||||||
|
@ -276,10 +279,3 @@ function select(obj: any, path: string): any {
|
||||||
const key = path.substr(0, i)
|
const key = path.substr(0, i)
|
||||||
return select(obj[key], path.substr(i + 1))
|
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'
|
|
||||||
}
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ export function setSshKnownHostsPath(sshKnownHostsPath: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the sef-safe-directory input so the POST action can retrieve the value.
|
* Save the set-safe-directory input so the POST action can retrieve the value.
|
||||||
*/
|
*/
|
||||||
export function setSafeDirectory() {
|
export function setSafeDirectory() {
|
||||||
core.saveState('setSafeDirectory', 'true')
|
core.saveState('setSafeDirectory', 'true')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as assert from 'assert'
|
import * as assert from 'assert'
|
||||||
import {IGitSourceSettings} from './git-source-settings'
|
|
||||||
import {URL} from 'url'
|
import {URL} from 'url'
|
||||||
|
import {IGitSourceSettings} from './git-source-settings'
|
||||||
|
|
||||||
export function getFetchUrl(settings: IGitSourceSettings): string {
|
export function getFetchUrl(settings: IGitSourceSettings): string {
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -8,7 +8,7 @@ export function getFetchUrl(settings: IGitSourceSettings): string {
|
||||||
'settings.repositoryOwner must be defined'
|
'settings.repositoryOwner must be defined'
|
||||||
)
|
)
|
||||||
assert.ok(settings.repositoryName, 'settings.repositoryName must be defined')
|
assert.ok(settings.repositoryName, 'settings.repositoryName must be defined')
|
||||||
const serviceUrl = getServerUrl()
|
const serviceUrl = getServerUrl(settings.githubServerUrl)
|
||||||
const encodedOwner = encodeURIComponent(settings.repositoryOwner)
|
const encodedOwner = encodeURIComponent(settings.repositoryOwner)
|
||||||
const encodedName = encodeURIComponent(settings.repositoryName)
|
const encodedName = encodeURIComponent(settings.repositoryName)
|
||||||
if (settings.sshKey) {
|
if (settings.sshKey) {
|
||||||
|
@ -19,11 +19,27 @@ export function getFetchUrl(settings: IGitSourceSettings): string {
|
||||||
return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`
|
return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getServerUrl(): URL {
|
export function getServerUrl(url?: string): URL {
|
||||||
// todo: remove GITHUB_URL after support for GHES Alpha is no longer needed
|
let urlValue =
|
||||||
return new URL(
|
url && url.trim().length > 0
|
||||||
process.env['GITHUB_SERVER_URL'] ||
|
? url
|
||||||
process.env['GITHUB_URL'] ||
|
: process.env['GITHUB_SERVER_URL'] || 'https://github.com'
|
||||||
'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'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue