mirror of
https://github.com/actions/deploy-pages.git
synced 2026-03-28 17:04:53 +00:00
Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13b55b33dd | ||
|
|
c284911fe1 | ||
|
|
ae44070880 | ||
|
|
34a8f6066a | ||
|
|
b65643c0ab | ||
|
|
faceed1585 | ||
|
|
230466c706 | ||
|
|
38d34f8e6f | ||
|
|
cd33125d26 | ||
|
|
dd970aea72 | ||
|
|
7433d78cba | ||
|
|
56d63c68a6 | ||
|
|
1050c5c646 | ||
|
|
f8e6f4a56d | ||
|
|
b687ea25c8 | ||
|
|
ccfe503c3f | ||
|
|
ed119588ad | ||
|
|
a53c6bc7f1 | ||
|
|
cc18e529bf | ||
|
|
b751a79e06 | ||
|
|
dda23d18e4 | ||
|
|
3430969625 | ||
|
|
6784dc0464 | ||
|
|
89c47f5a13 | ||
|
|
77d7344265 | ||
|
|
84abb89dc5 | ||
|
|
de14547edc | ||
|
|
ced2b1a16b | ||
|
|
3a91181e1b | ||
|
|
6fa14b662d | ||
|
|
f9e640bce0 | ||
|
|
3eefb79441 | ||
|
|
971e36e6ad | ||
|
|
6abbee335a | ||
|
|
e149aa9f91 | ||
|
|
0077311596 | ||
|
|
03b62d1911 | ||
|
|
ada3f9d061 | ||
|
|
82b8ae3f91 | ||
|
|
d183a290bd | ||
|
|
8c6ef3d8d5 | ||
|
|
5a0bbc6e7d | ||
|
|
49af2606ad | ||
|
|
8b1057e1ce | ||
|
|
1f9a7ee304 | ||
|
|
3aff9369e6 | ||
|
|
a3969a1774 | ||
|
|
d9c5ae4728 | ||
|
|
94490d3099 | ||
|
|
b2f7f34415 | ||
|
|
dc61a05a4c | ||
|
|
57dcea9665 | ||
|
|
11d1068b0c | ||
|
|
641f4888c4 | ||
|
|
6c3eed1621 | ||
|
|
fa86ad3bc1 | ||
|
|
976abf18ca | ||
|
|
377be98d59 | ||
|
|
9dbe382482 | ||
|
|
96a5bb957b | ||
|
|
8458d4c873 | ||
|
|
0fd60c869b | ||
|
|
9f42854283 | ||
|
|
935c3f915d | ||
|
|
9c31b72d4a | ||
|
|
2b0ca4a2d6 | ||
|
|
f7b0e1891f | ||
|
|
8b4e85a223 | ||
|
|
cca68c9d4b | ||
|
|
73a7feb190 | ||
|
|
2457a7fc63 | ||
|
|
a562022ed9 | ||
|
|
b865ababeb | ||
|
|
12ab2b16cf | ||
|
|
157c090d5a | ||
|
|
39bfa7a819 | ||
|
|
cdd88557f6 | ||
|
|
9cf15d70b7 | ||
|
|
80d8f1cab8 | ||
|
|
ffdf102557 | ||
|
|
a1b3914731 |
4
.github/workflows/check-dist.yml
vendored
4
.github/workflows/check-dist.yml
vendored
@@ -22,10 +22,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.JS
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: npm
|
||||
|
||||
4
.github/workflows/check-formatting.yml
vendored
4
.github/workflows/check-formatting.yml
vendored
@@ -19,10 +19,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.JS
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: npm
|
||||
|
||||
4
.github/workflows/check-linter.yml
vendored
4
.github/workflows/check-linter.yml
vendored
@@ -19,10 +19,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.JS
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: npm
|
||||
|
||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
|
||||
2
.github/workflows/draft-release.yml
vendored
2
.github/workflows/draft-release.yml
vendored
@@ -11,6 +11,6 @@ jobs:
|
||||
draft-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@569eb7ee3a85817ab916c8f8ff03a5bd96c9c83e # v5.23.0
|
||||
- uses: release-drafter/release-drafter@09c613e259eb8d4e7c81c2cb00618eb5fc4575a7 # v5.25.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
4
.github/workflows/rebuild-dependabot-prs.yml
vendored
4
.github/workflows/rebuild-dependabot-prs.yml
vendored
@@ -22,12 +22,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.PAGES_AUTOMATION_PAT }}
|
||||
|
||||
- name: Setup Node.JS
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: npm
|
||||
|
||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -14,10 +14,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.JS
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: npm
|
||||
|
||||
@@ -1 +1 @@
|
||||
18.9.0
|
||||
20.10.0
|
||||
|
||||
21
README.md
21
README.md
@@ -41,7 +41,7 @@ jobs:
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action
|
||||
uses: actions/deploy-pages@v3 # or specific "vX.X.X" version tag for this action
|
||||
```
|
||||
|
||||
### Inputs 📥
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
| `token` | `true` | `${{ github.token }}` | The GitHub token used to create an authenticated client - Provided for you by default! |
|
||||
| `timeout` | `false` | `"600000"` | Time in milliseconds after which to timeout and cancel the deployment (default: 10 minutes) |
|
||||
| `error_count` | `false` | `"10"` | Maximum number of status report errors before cancelling a deployment (default: 10) |
|
||||
| `reporting_interval` | `false` | `"5000"` | Time in milliseconds between two deployment status report (default: 5 seconds) |
|
||||
| `reporting_interval` | `false` | `"5000"` | Time in milliseconds between two deployment status reports (default: 5 seconds) |
|
||||
| `artifact_name` | `false` | `"github-pages"` | The name of the artifact to deploy |
|
||||
| `preview` | `false` | `"false"` | Is this attempting to deploy a pull request as a GitHub Pages preview site? (NOTE: This feature is only in alpha currently and is not available to the public!) |
|
||||
|
||||
@@ -67,10 +67,6 @@ jobs:
|
||||
| -------- | ----------- |
|
||||
| `GITHUB_PAGES` | This environment variable is created and set to the string value `"true"` so that framework build tools may choose to differentiate their output based on the intended target hosting platform. |
|
||||
|
||||
## Scope
|
||||
|
||||
⚠️ Official support for building Pages with Actions is in public beta at the moment.
|
||||
|
||||
## Security Considerations
|
||||
|
||||
There are a few important considerations to be aware of:
|
||||
@@ -89,16 +85,17 @@ There are a few important considerations to be aware of:
|
||||
|
||||
## Compatibility
|
||||
|
||||
This action is primarily design for use with GitHub.com's Actions workflows and Pages deployments. However, certain releases should also be compatible with GitHub Enterprise Server (GHES) `3.7` and above.
|
||||
This action is primarily designed for use with GitHub.com's Actions workflows and Pages deployments. However, certain releases should also be compatible with GitHub Enterprise Server (GHES) `3.7` and above.
|
||||
|
||||
| Release | GHES Compatibility |
|
||||
|:---|:---|
|
||||
| [`v2`](https://github.com/actions/deploy-pages/releases/tag/v2) | 🛑 Incompatible. Anticipating compatibility with `>= 3.9`. |
|
||||
| [`v2.0.1`](https://github.com/actions/deploy-pages/releases/tag/v2.0.1) | 🛑 Incompatible. Anticipating compatibility with `>= 3.9`. |
|
||||
| [`v2.0.0`](https://github.com/actions/deploy-pages/releases/tag/v2.0.0) | 🛑 Incompatible. Anticipating compatibility with `>= 3.9`. |
|
||||
| [`v3`](https://github.com/actions/deploy-pages/releases/tag/v3) | `>= 3.9` |
|
||||
| `v3.x.x` | `>= 3.9` |
|
||||
| [`v2`](https://github.com/actions/deploy-pages/releases/tag/v2) | `>= 3.9` |
|
||||
| `v2.x.x` | `>= 3.9` |
|
||||
| [`v1`](https://github.com/actions/deploy-pages/releases/tag/v1) | `>= 3.7` |
|
||||
| [`v1.2.8`](https://github.com/actions/deploy-pages/releases/tag/v1.2.8) | `>= 3.7` |
|
||||
| [`v1.2.7`](https://github.com/actions/deploy-pages/releases/tag/v1.2.7) | :warning: [Incompatible](https://github.com/actions/deploy-pages/issues/137). Anticipating compatibility with `>= 3.9`. |
|
||||
| [`v1.2.7`](https://github.com/actions/deploy-pages/releases/tag/v1.2.7) | :warning: `>= 3.9` [Incompatible with prior versions!](https://github.com/actions/deploy-pages/issues/137) |
|
||||
| [`v1.2.6`](https://github.com/actions/deploy-pages/releases/tag/v1.2.6) | `>= 3.7` |
|
||||
| `v1.x.x` | `>= 3.7` |
|
||||
|
||||
@@ -110,7 +107,7 @@ In order to release a new version of this Action:
|
||||
|
||||
2. Publish the draft release from the `main` branch with semantic version as the tag name, _with_ the checkbox to publish to the GitHub Marketplace checked. :ballot_box_with_check:
|
||||
|
||||
3. After publishing the release, the [`release` workflow][release] will automatically run to create/update the corresponding the major version tag such as `v1`.
|
||||
3. After publishing the release, the [`release` workflow][release] will automatically run to create/update the corresponding major version tag such as `v1`.
|
||||
|
||||
⚠️ Environment approval is required. Check the [Release workflow run list][release-workflow-runs].
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ name: 'Deploy GitHub Pages site'
|
||||
description: 'A GitHub Action to deploy an artifact as a GitHub Pages site'
|
||||
author: 'GitHub'
|
||||
runs:
|
||||
using: 'node16'
|
||||
using: 'node20'
|
||||
main: 'dist/index.js'
|
||||
inputs:
|
||||
token:
|
||||
|
||||
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 79.72%"><title>Coverage: 79.72%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#e05d44"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">79.72%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">79.72%</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 81.39%"><title>Coverage: 81.39%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#dfb317"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">81.39%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">81.39%</text></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
53924
dist/index.js
generated
vendored
53924
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
152
dist/licenses.txt
generated
vendored
152
dist/licenses.txt
generated
vendored
@@ -47,6 +47,28 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
@fastify/busboy
|
||||
MIT
|
||||
Copyright Brian White. All rights reserved.
|
||||
|
||||
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.
|
||||
|
||||
@octokit/auth-token
|
||||
MIT
|
||||
The MIT License
|
||||
@@ -219,16 +241,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@vercel/ncc
|
||||
MIT
|
||||
Copyright 2018 ZEIT, Inc.
|
||||
|
||||
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.
|
||||
|
||||
before-after-hook
|
||||
Apache-2.0
|
||||
Apache License
|
||||
@@ -455,57 +467,6 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
http-status-messages
|
||||
|
||||
is-plain-object
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
node-fetch
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 David Frank
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
once
|
||||
ISC
|
||||
The ISC License
|
||||
@@ -525,9 +486,6 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
tr46
|
||||
MIT
|
||||
|
||||
tunnel
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
@@ -553,6 +511,31 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
undici
|
||||
MIT
|
||||
MIT License
|
||||
|
||||
Copyright (c) Matteo Collina and Undici 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.
|
||||
|
||||
|
||||
universal-user-agent
|
||||
ISC
|
||||
# [ISC License](https://spdx.org/licenses/ISC)
|
||||
@@ -577,47 +560,6 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
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.
|
||||
|
||||
|
||||
webidl-conversions
|
||||
BSD-2-Clause
|
||||
# The BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2014, Domenic Denicola
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
whatwg-url
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015–2016 Sebastian Mayr
|
||||
|
||||
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.
|
||||
|
||||
|
||||
wrappy
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
4622
package-lock.json
generated
4622
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
@@ -4,21 +4,22 @@
|
||||
"description": "Deploy an actions artifact to GitHub Pages",
|
||||
"main": "./dist/index.js",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/github": "^5.1.1",
|
||||
"@actions/http-client": "^2.1.0",
|
||||
"@octokit/request-error": "^3.0.3",
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@actions/http-client": "^2.2.0",
|
||||
"@octokit/request-error": "^5.0.1",
|
||||
"http-status-messages": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
"eslint": "^8.42.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"eslint-plugin-github": "^4.8.0",
|
||||
"jest": "^29.5.0",
|
||||
"nock": "^13.3.1",
|
||||
"prettier": "^2.8.8",
|
||||
"make-coverage-badge": "^1.2.0"
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.55.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-github": "^4.10.1",
|
||||
"jest": "^29.7.0",
|
||||
"make-coverage-badge": "^1.2.0",
|
||||
"nock": "^13.4.0",
|
||||
"prettier": "^3.1.0",
|
||||
"undici": "^6.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"all": "npm run format && npm run lint && npm run prepare && npm run test && npm run coverage-badge",
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
const core = require('@actions/core')
|
||||
// For mocking network calls with core http (http-client)
|
||||
const nock = require('nock')
|
||||
// For mocking network calls with native Fetch (octokit)
|
||||
const { MockAgent, setGlobalDispatcher } = require('undici')
|
||||
|
||||
const { Deployment, MAX_TIMEOUT, ONE_GIGABYTE, SIZE_LIMIT_DESCRIPTION } = require('../../internal/deployment')
|
||||
|
||||
@@ -7,6 +10,8 @@ const fakeJwt =
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiNjllMWIxOC1jOGFiLTRhZGQtOGYxOC03MzVlMzVjZGJhZjAiLCJzdWIiOiJyZXBvOnBhcGVyLXNwYS9taW55aTplbnZpcm9ubWVudDpQcm9kdWN0aW9uIiwiYXVkIjoiaHR0cHM6Ly9naXRodWIuY29tL3BhcGVyLXNwYSIsInJlZiI6InJlZnMvaGVhZHMvbWFpbiIsInNoYSI6ImEyODU1MWJmODdiZDk3NTFiMzdiMmM0YjM3M2MxZjU3NjFmYWM2MjYiLCJyZXBvc2l0b3J5IjoicGFwZXItc3BhL21pbnlpIiwicmVwb3NpdG9yeV9vd25lciI6InBhcGVyLXNwYSIsInJ1bl9pZCI6IjE1NDY0NTkzNjQiLCJydW5fbnVtYmVyIjoiMzQiLCJydW5fYXR0ZW1wdCI6IjIiLCJhY3RvciI6IllpTXlzdHkiLCJ3b3JrZmxvdyI6IkNJIiwiaGVhZF9yZWYiOiIiLCJiYXNlX3JlZiI6IiIsImV2ZW50X25hbWUiOiJwdXNoIiwicmVmX3R5cGUiOiJicmFuY2giLCJlbnZpcm9ubWVudCI6IlByb2R1Y3Rpb24iLCJqb2Jfd29ya2Zsb3dfcmVmIjoicGFwZXItc3BhL21pbnlpLy5naXRodWIvd29ya2Zsb3dzL2JsYW5rLnltbEByZWZzL2hlYWRzL21haW4iLCJpc3MiOiJodHRwczovL3Rva2VuLmFjdGlvbnMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwibmJmIjoxNjM4ODI4MDI4LCJleHAiOjE2Mzg4Mjg5MjgsImlhdCI6MTYzODgyODYyOH0.1wyupfxu1HGoTyIqatYg0hIxy2-0bMO-yVlmLSMuu2w'
|
||||
|
||||
describe('Deployment', () => {
|
||||
let mockPool
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
process.env.ACTIONS_RUNTIME_URL = 'http://my-url/'
|
||||
@@ -25,6 +30,8 @@ describe('Deployment', () => {
|
||||
return 'github-pages'
|
||||
case 'token':
|
||||
return process.env.GITHUB_TOKEN
|
||||
case 'reporting_interval':
|
||||
return 50 // Lower reporting interval to speed up test
|
||||
default:
|
||||
return process.env[`INPUT_${param.toUpperCase()}`] || ''
|
||||
}
|
||||
@@ -37,11 +44,18 @@ describe('Deployment', () => {
|
||||
jest.spyOn(core, 'setFailed').mockImplementation(param => {
|
||||
return param
|
||||
})
|
||||
|
||||
// Mock error/warning/info/debug
|
||||
jest.spyOn(core, 'error').mockImplementation(jest.fn())
|
||||
jest.spyOn(core, 'warning').mockImplementation(jest.fn())
|
||||
jest.spyOn(core, 'info').mockImplementation(jest.fn())
|
||||
jest.spyOn(core, 'debug').mockImplementation(jest.fn())
|
||||
|
||||
// Set up Fetch mocking
|
||||
const mockAgent = new MockAgent()
|
||||
mockAgent.disableNetConnect()
|
||||
setGlobalDispatcher(mockAgent)
|
||||
mockPool = mockAgent.get('https://api.github.com')
|
||||
})
|
||||
|
||||
describe('#create', () => {
|
||||
@@ -62,16 +76,32 @@ describe('Deployment', () => {
|
||||
]
|
||||
})
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA,
|
||||
oidc_token: fakeJwt
|
||||
})
|
||||
.reply(200, {
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 3 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'oidc_token' &&
|
||||
keys[2] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA &&
|
||||
body.oidc_token === fakeJwt
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(
|
||||
200,
|
||||
{
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
},
|
||||
{ headers: { 'content-type': 'application/json' } }
|
||||
)
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
|
||||
@@ -85,7 +115,6 @@ describe('Deployment', () => {
|
||||
)
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
})
|
||||
|
||||
it('can successfully create a preview deployment', async () => {
|
||||
@@ -100,18 +129,35 @@ describe('Deployment', () => {
|
||||
]
|
||||
})
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA,
|
||||
oidc_token: fakeJwt,
|
||||
preview: true
|
||||
})
|
||||
.reply(200, {
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome',
|
||||
preview_url: 'https://actions.drafts.github.io/is-awesome'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 4 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'oidc_token' &&
|
||||
keys[2] === 'pages_build_version' &&
|
||||
keys[3] === 'preview' &&
|
||||
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA &&
|
||||
body.oidc_token === fakeJwt &&
|
||||
body.preview === true
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(
|
||||
200,
|
||||
{
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome',
|
||||
preview_url: 'https://actions.drafts.github.io/is-awesome'
|
||||
},
|
||||
{ headers: { 'content-type': 'application/json' } }
|
||||
)
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
|
||||
@@ -128,7 +174,6 @@ describe('Deployment', () => {
|
||||
)
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
})
|
||||
|
||||
it('reports errors with failed artifact exchange', async () => {
|
||||
@@ -154,12 +199,23 @@ describe('Deployment', () => {
|
||||
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
|
||||
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] })
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://invalid-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 2 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://invalid-artifact.com&%24expand=SignedContent' &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(500, { message: 'oh no' })
|
||||
.reply(500, { message: 'oh no' }, { headers: { 'content-type': 'application/json' } })
|
||||
|
||||
// Create the deployment
|
||||
const deployment = new Deployment()
|
||||
@@ -170,7 +226,6 @@ describe('Deployment', () => {
|
||||
)
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
})
|
||||
|
||||
it('reports errors with an unexpected 403 during deployment', async () => {
|
||||
@@ -179,12 +234,23 @@ describe('Deployment', () => {
|
||||
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
|
||||
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] })
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://invalid-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 2 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://invalid-artifact.com&%24expand=SignedContent' &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(403, { message: 'You are forbidden' })
|
||||
.reply(403, { message: 'You are forbidden' }, { headers: { 'content-type': 'application/json' } })
|
||||
|
||||
// Create the deployment
|
||||
const deployment = new Deployment()
|
||||
@@ -195,7 +261,6 @@ describe('Deployment', () => {
|
||||
)
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
})
|
||||
|
||||
it('reports errors with an unexpected 404 during deployment', async () => {
|
||||
@@ -204,12 +269,23 @@ describe('Deployment', () => {
|
||||
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
|
||||
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] })
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://invalid-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 2 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://invalid-artifact.com&%24expand=SignedContent' &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(404, { message: 'Not found' })
|
||||
.reply(404, { message: 'Not found' }, { headers: { 'content-type': 'application/json' } })
|
||||
|
||||
// Create the deployment
|
||||
const deployment = new Deployment()
|
||||
@@ -220,7 +296,6 @@ describe('Deployment', () => {
|
||||
)
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
})
|
||||
|
||||
it('reports errors with failed deployments', async () => {
|
||||
@@ -229,12 +304,23 @@ describe('Deployment', () => {
|
||||
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
|
||||
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] })
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://invalid-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 2 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://invalid-artifact.com&%24expand=SignedContent' &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(400, { message: 'Bad request' })
|
||||
.reply(400, { message: 'Bad request' }, { headers: { 'content-type': 'application/json' } })
|
||||
|
||||
// Create the deployment
|
||||
const deployment = new Deployment()
|
||||
@@ -245,7 +331,6 @@ describe('Deployment', () => {
|
||||
)
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
})
|
||||
|
||||
it('warns if the artifact size is bigger than maximum', async () => {
|
||||
@@ -261,16 +346,32 @@ describe('Deployment', () => {
|
||||
]
|
||||
})
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA,
|
||||
oidc_token: fakeJwt
|
||||
})
|
||||
.reply(200, {
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 3 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'oidc_token' &&
|
||||
keys[2] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
|
||||
body.oidc_token === fakeJwt &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(
|
||||
200,
|
||||
{
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
},
|
||||
{ headers: { 'content-type': 'application/json' } }
|
||||
)
|
||||
|
||||
const deployment = new Deployment()
|
||||
await deployment.create(fakeJwt)
|
||||
@@ -284,7 +385,6 @@ describe('Deployment', () => {
|
||||
)
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
})
|
||||
|
||||
it('warns when the timeout is greater than the maximum allowed', async () => {
|
||||
@@ -299,25 +399,44 @@ describe('Deployment', () => {
|
||||
]
|
||||
})
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA,
|
||||
oidc_token: fakeJwt
|
||||
})
|
||||
.reply(200, {
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 3 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'oidc_token' &&
|
||||
keys[2] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
|
||||
body.oidc_token === fakeJwt &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(
|
||||
200,
|
||||
{
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
},
|
||||
{ headers: { 'content-type': 'application/json' } }
|
||||
)
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
|
||||
// Set timeout to greater than max
|
||||
jest.spyOn(core, 'getInput').mockImplementation(param => {
|
||||
switch (param) {
|
||||
case 'artifact_name':
|
||||
return 'github-pages'
|
||||
case 'token':
|
||||
return process.env.GITHUB_TOKEN
|
||||
case 'reporting_interval':
|
||||
return 50 // Lower reporting interval to speed up test
|
||||
case 'timeout':
|
||||
return MAX_TIMEOUT + 1
|
||||
default:
|
||||
@@ -333,7 +452,6 @@ describe('Deployment', () => {
|
||||
)
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -350,22 +468,39 @@ describe('Deployment', () => {
|
||||
]
|
||||
})
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA,
|
||||
oidc_token: fakeJwt
|
||||
})
|
||||
.reply(200, {
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 3 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'oidc_token' &&
|
||||
keys[2] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
|
||||
body.oidc_token === fakeJwt &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(
|
||||
200,
|
||||
{
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
},
|
||||
{ headers: { 'content-type': 'application/json' } }
|
||||
)
|
||||
|
||||
const deploymentStatusScope = nock('https://api.github.com')
|
||||
.get(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`)
|
||||
.reply(200, {
|
||||
status: 'succeed'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
method: 'GET'
|
||||
})
|
||||
.reply(200, { status: 'succeed' }, { headers: { 'content-type': 'application/json' } })
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
|
||||
@@ -378,8 +513,6 @@ describe('Deployment', () => {
|
||||
expect(core.info).toHaveBeenLastCalledWith('Reported success!')
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
deploymentStatusScope.done()
|
||||
})
|
||||
|
||||
it('fails check when no deployment is found', async () => {
|
||||
@@ -401,16 +534,32 @@ describe('Deployment', () => {
|
||||
]
|
||||
})
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA,
|
||||
oidc_token: fakeJwt
|
||||
})
|
||||
.reply(200, {
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 3 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'oidc_token' &&
|
||||
keys[2] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
|
||||
body.oidc_token === fakeJwt &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(
|
||||
200,
|
||||
{
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
},
|
||||
{ headers: { 'content-type': 'application/json' } }
|
||||
)
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
|
||||
@@ -421,7 +570,6 @@ describe('Deployment', () => {
|
||||
expect(core.setFailed).toBeCalledWith('Unable to get deployment status.')
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
})
|
||||
|
||||
it('enforces max timeout', async () => {
|
||||
@@ -436,24 +584,51 @@ describe('Deployment', () => {
|
||||
]
|
||||
})
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA,
|
||||
oidc_token: fakeJwt
|
||||
})
|
||||
.reply(200, {
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 3 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'oidc_token' &&
|
||||
keys[2] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
|
||||
body.oidc_token === fakeJwt &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(
|
||||
200,
|
||||
{
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
},
|
||||
{ headers: { 'content-type': 'application/json' } }
|
||||
)
|
||||
|
||||
const cancelDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}/cancel`)
|
||||
.reply(200, {})
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
method: 'GET'
|
||||
})
|
||||
.reply(200, { status: 'deployment_in_progress' }, { headers: { 'content-type': 'application/json' } })
|
||||
.times(2)
|
||||
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}/cancel`,
|
||||
method: 'POST'
|
||||
})
|
||||
.reply(200, {}, { headers: { 'content-type': 'application/json' } })
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
|
||||
// Set timeout to great than max
|
||||
// Set timeout to greater than max
|
||||
jest.spyOn(core, 'getInput').mockImplementation(param => {
|
||||
switch (param) {
|
||||
case 'artifact_name':
|
||||
@@ -462,6 +637,8 @@ describe('Deployment', () => {
|
||||
return process.env.GITHUB_TOKEN
|
||||
case 'error_count':
|
||||
return 10
|
||||
case 'reporting_interval':
|
||||
return 50 // Lower the interval for the test
|
||||
case 'timeout':
|
||||
return MAX_TIMEOUT + 1
|
||||
default:
|
||||
@@ -469,25 +646,26 @@ describe('Deployment', () => {
|
||||
}
|
||||
})
|
||||
|
||||
const now = Date.now()
|
||||
const mockStartTime = now - MAX_TIMEOUT
|
||||
jest
|
||||
.spyOn(Date, 'now')
|
||||
.mockImplementationOnce(() => mockStartTime)
|
||||
.mockImplementationOnce(() => now)
|
||||
// Jump the "current time" by MAX_TIMEOUT ever time Date.now is called
|
||||
const _now = Date.now
|
||||
let nowCalls = 0
|
||||
const nowSpy = jest.spyOn(Date, 'now').mockImplementation(() => {
|
||||
nowCalls++
|
||||
return _now() + MAX_TIMEOUT * nowCalls
|
||||
})
|
||||
|
||||
// Create the deployment
|
||||
const deployment = new Deployment()
|
||||
await deployment.create(fakeJwt)
|
||||
await deployment.check()
|
||||
|
||||
nowSpy.mockRestore()
|
||||
|
||||
expect(deployment.timeout).toEqual(MAX_TIMEOUT)
|
||||
expect(core.error).toBeCalledWith('Timeout reached, aborting!')
|
||||
expect(core.setFailed).toBeCalledWith('Timeout reached, aborting!')
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
cancelDeploymentScope.done()
|
||||
})
|
||||
|
||||
it('sets timeout to user timeout if user timeout is less than max timeout', async () => {
|
||||
@@ -502,24 +680,43 @@ describe('Deployment', () => {
|
||||
]
|
||||
})
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA,
|
||||
oidc_token: fakeJwt
|
||||
})
|
||||
.reply(200, {
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 3 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'oidc_token' &&
|
||||
keys[2] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
|
||||
body.oidc_token === fakeJwt &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(
|
||||
200,
|
||||
{
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
},
|
||||
{ headers: { 'content-type': 'application/json' } }
|
||||
)
|
||||
|
||||
const cancelDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}/cancel`)
|
||||
.reply(200, {})
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}/cancel`,
|
||||
method: 'POST'
|
||||
})
|
||||
.reply(200, {}, { headers: { 'content-type': 'application/json' } })
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
|
||||
// Set timeout to great than max
|
||||
// Set timeout to greater than max
|
||||
jest.spyOn(core, 'getInput').mockImplementation(param => {
|
||||
switch (param) {
|
||||
case 'artifact_name':
|
||||
@@ -528,6 +725,8 @@ describe('Deployment', () => {
|
||||
return process.env.GITHUB_TOKEN
|
||||
case 'error_count':
|
||||
return 10
|
||||
case 'reporting_interval':
|
||||
return 42 // The default of 5000 is too long for the test
|
||||
case 'timeout':
|
||||
return 42
|
||||
default:
|
||||
@@ -552,8 +751,6 @@ describe('Deployment', () => {
|
||||
expect(core.setFailed).toBeCalledWith('Timeout reached, aborting!')
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
cancelDeploymentScope.done()
|
||||
})
|
||||
|
||||
it('sets output to success when timeout is set but not reached', async () => {
|
||||
@@ -568,26 +765,43 @@ describe('Deployment', () => {
|
||||
]
|
||||
})
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA,
|
||||
oidc_token: fakeJwt
|
||||
})
|
||||
.reply(200, {
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 3 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'oidc_token' &&
|
||||
keys[2] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
|
||||
body.oidc_token === fakeJwt &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(
|
||||
200,
|
||||
{
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
},
|
||||
{ headers: { 'content-type': 'application/json' } }
|
||||
)
|
||||
|
||||
const deploymentStatusScope = nock('https://api.github.com')
|
||||
.get(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`)
|
||||
.reply(200, {
|
||||
status: 'succeed'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
method: 'GET'
|
||||
})
|
||||
.reply(200, { status: 'succeed' }, { headers: { 'content-type': 'application/json' } })
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
|
||||
// Set timeout to great than max
|
||||
// Set timeout to greater than max
|
||||
jest.spyOn(core, 'getInput').mockImplementation(param => {
|
||||
switch (param) {
|
||||
case 'artifact_name':
|
||||
@@ -596,6 +810,8 @@ describe('Deployment', () => {
|
||||
return process.env.GITHUB_TOKEN
|
||||
case 'error_count':
|
||||
return 10
|
||||
case 'reporting_interval':
|
||||
return 0 // The default of 5000 is too long for the test
|
||||
case 'timeout':
|
||||
return 42
|
||||
default:
|
||||
@@ -604,7 +820,7 @@ describe('Deployment', () => {
|
||||
})
|
||||
|
||||
const now = Date.now()
|
||||
const mockStartTime = now
|
||||
const mockStartTime = now // No time elapsed
|
||||
jest
|
||||
.spyOn(Date, 'now')
|
||||
.mockImplementationOnce(() => mockStartTime)
|
||||
@@ -621,8 +837,6 @@ describe('Deployment', () => {
|
||||
expect(core.info).toHaveBeenLastCalledWith('Reported success!')
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
deploymentStatusScope.done()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -639,20 +853,39 @@ describe('Deployment', () => {
|
||||
]
|
||||
})
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA,
|
||||
oidc_token: fakeJwt
|
||||
})
|
||||
.reply(200, {
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 3 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'oidc_token' &&
|
||||
keys[2] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
|
||||
body.oidc_token === fakeJwt &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(
|
||||
200,
|
||||
{
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
},
|
||||
{ headers: { 'content-type': 'application/json' } }
|
||||
)
|
||||
|
||||
const cancelDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}/cancel`)
|
||||
.reply(200, {})
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}/cancel`,
|
||||
method: 'POST'
|
||||
})
|
||||
.reply(200, {}, { headers: { 'content-type': 'application/json' } })
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
|
||||
@@ -666,8 +899,6 @@ describe('Deployment', () => {
|
||||
expect(core.info).toHaveBeenLastCalledWith(`Canceled deployment with ID ${process.env.GITHUB_SHA}`)
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
cancelDeploymentScope.done()
|
||||
})
|
||||
|
||||
it('can exit if a pages deployment was not created and none need to be cancelled', async () => {
|
||||
@@ -695,21 +926,39 @@ describe('Deployment', () => {
|
||||
]
|
||||
})
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA,
|
||||
oidc_token: fakeJwt
|
||||
})
|
||||
.reply(200, {
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
|
||||
method: 'POST',
|
||||
body: bodyString => {
|
||||
const body = JSON.parse(bodyString)
|
||||
const keys = Object.keys(body).sort()
|
||||
return (
|
||||
keys.length === 3 &&
|
||||
keys[0] === 'artifact_url' &&
|
||||
keys[1] === 'oidc_token' &&
|
||||
keys[2] === 'pages_build_version' &&
|
||||
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
|
||||
body.oidc_token === fakeJwt &&
|
||||
body.pages_build_version === process.env.GITHUB_SHA
|
||||
)
|
||||
}
|
||||
})
|
||||
.reply(
|
||||
200,
|
||||
{
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
},
|
||||
{ headers: { 'content-type': 'application/json' } }
|
||||
)
|
||||
|
||||
// nock will throw an error every time it tries to cancel the deployment
|
||||
const cancelDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}/cancel`)
|
||||
.reply(500, {})
|
||||
mockPool
|
||||
.intercept({
|
||||
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}/cancel`,
|
||||
method: 'POST'
|
||||
})
|
||||
.reply(500, {}, { headers: { 'content-type': 'application/json' } })
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
|
||||
@@ -723,8 +972,6 @@ describe('Deployment', () => {
|
||||
expect(core.error).toHaveBeenCalledWith(`Canceling Pages deployment failed`, expect.anything())
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
cancelDeploymentScope.done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -17,6 +17,7 @@ const temporaryErrorStatus = {
|
||||
|
||||
const finalErrorStatus = {
|
||||
deployment_failed: 'Deployment failed, try again later.',
|
||||
deployment_perms_error: 'Deployment failed. Please ensure that the file permissions are correct.',
|
||||
deployment_content_failed:
|
||||
'Artifact could not be deployed. Please ensure the content does not contain any hard links, symlinks and total size is less than 10GB.',
|
||||
deployment_cancelled: 'Deployment cancelled.',
|
||||
@@ -101,9 +102,6 @@ class Deployment {
|
||||
} catch (error) {
|
||||
core.error(error.stack)
|
||||
|
||||
// output raw error in debug mode.
|
||||
core.debug(JSON.stringify(error))
|
||||
|
||||
// build customized error message based on server response
|
||||
if (error.response) {
|
||||
let errorMessage = `Failed to create deployment (status: ${error.status}) with build version ${this.buildVersion}. `
|
||||
@@ -188,9 +186,6 @@ class Deployment {
|
||||
} catch (error) {
|
||||
core.error(error.stack)
|
||||
|
||||
// output raw error in debug mode.
|
||||
core.debug(JSON.stringify(error))
|
||||
|
||||
// build customized error message based on server response
|
||||
if (error.response) {
|
||||
errorStatus = error.status || error.response.status
|
||||
|
||||
Reference in New Issue
Block a user