mirror of
https://github.com/actions/deploy-pages.git
synced 2026-03-28 08:54:53 +00:00
Compare commits
123 Commits
artifacts-
...
v4.0.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6db90164a | ||
|
|
055f4259a5 | ||
|
|
5ab929b077 | ||
|
|
3ff795bc32 | ||
|
|
f5a2f0d405 | ||
|
|
1364cde56e | ||
|
|
2ed07f7488 | ||
|
|
d5a892b11c | ||
|
|
05977f58bc | ||
|
|
9414024cfc | ||
|
|
600e88d072 | ||
|
|
a43ab5c2d5 | ||
|
|
9c8c21a7c6 | ||
|
|
decdde0ac0 | ||
|
|
0b3be6ba52 | ||
|
|
c2c861cca0 | ||
|
|
294fbcd300 | ||
|
|
2a4b535672 | ||
|
|
4825f57d2c | ||
|
|
fa29843a5a | ||
|
|
d005625ad3 | ||
|
|
636701b46d | ||
|
|
25b80099b0 | ||
|
|
ace85779a4 | ||
|
|
22931f5a71 | ||
|
|
87c3283f01 | ||
|
|
87625d9f1e | ||
|
|
8de45ac1dc | ||
|
|
7a9bd943aa | ||
|
|
eee8a27158 | ||
|
|
b6e5c85160 | ||
|
|
b8d2528df3 | ||
|
|
53d1eac7fd | ||
|
|
3f0ef9d75d | ||
|
|
82751044df | ||
|
|
9be9d731c9 | ||
|
|
d8afefafec | ||
|
|
304d0b77f8 | ||
|
|
3a33eeefa1 | ||
|
|
d8af841ac3 | ||
|
|
35a0f06cfc | ||
|
|
5cba2b1245 | ||
|
|
e03d00b325 | ||
|
|
d6fbcf80b1 | ||
|
|
013b725db3 | ||
|
|
ed0e794532 | ||
|
|
1c0b543596 | ||
|
|
fe3d75dd3a | ||
|
|
b3879bac7d | ||
|
|
72ab98158a | ||
|
|
c704b8a6e2 | ||
|
|
02cb90ee32 | ||
|
|
88807a7a35 | ||
|
|
e386446c2a | ||
|
|
340b369533 | ||
|
|
4be34033fc | ||
|
|
0486580c63 | ||
|
|
af9eaca61c | ||
|
|
81251b551f | ||
|
|
47cf65bf47 | ||
|
|
1a1c979b91 | ||
|
|
925d92be20 | ||
|
|
b80d7fe30e | ||
|
|
d724c5069f | ||
|
|
f33f41b675 | ||
|
|
0d45f33cde | ||
|
|
d1e23d0efd | ||
|
|
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 | ||
|
|
377be98d59 |
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
@@ -4,8 +4,14 @@ updates:
|
|||||||
directory: '/'
|
directory: '/'
|
||||||
schedule:
|
schedule:
|
||||||
interval: 'weekly'
|
interval: 'weekly'
|
||||||
|
groups:
|
||||||
|
non-breaking-changes:
|
||||||
|
update-types: [minor, patch]
|
||||||
|
|
||||||
- package-ecosystem: 'npm'
|
- package-ecosystem: 'npm'
|
||||||
directory: '/'
|
directory: '/'
|
||||||
schedule:
|
schedule:
|
||||||
interval: 'weekly'
|
interval: 'weekly'
|
||||||
|
groups:
|
||||||
|
non-breaking-changes:
|
||||||
|
update-types: [minor, patch]
|
||||||
|
|||||||
2
.github/release-drafter.yml
vendored
2
.github/release-drafter.yml
vendored
@@ -10,7 +10,7 @@ template: |
|
|||||||
|
|
||||||
See details of [all code changes](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release.
|
See details of [all code changes](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release.
|
||||||
|
|
||||||
:warning: For use with products other than GitHub.com, such as GitHub Enterprise Server, please consult the [compatibility table](https://github.com/$OWNER/$REPOSITORY/#compatibilty).
|
:warning: For use with products other than GitHub.com, such as GitHub Enterprise Server, please consult the [compatibility table](https://github.com/$OWNER/$REPOSITORY/#compatibility).
|
||||||
categories:
|
categories:
|
||||||
- title: '🚀 Features'
|
- title: '🚀 Features'
|
||||||
labels:
|
labels:
|
||||||
|
|||||||
6
.github/workflows/check-dist.yml
vendored
6
.github/workflows/check-dist.yml
vendored
@@ -22,10 +22,10 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.JS
|
- name: Setup Node.JS
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.node-version'
|
node-version-file: '.node-version'
|
||||||
cache: npm
|
cache: npm
|
||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# If index.js was different than expected, upload the expected version as an artifact
|
# If index.js was different than expected, upload the expected version as an artifact
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
|
|||||||
4
.github/workflows/check-formatting.yml
vendored
4
.github/workflows/check-formatting.yml
vendored
@@ -19,10 +19,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.JS
|
- name: Setup Node.JS
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.node-version'
|
node-version-file: '.node-version'
|
||||||
cache: npm
|
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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.JS
|
- name: Setup Node.JS
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.node-version'
|
node-version-file: '.node-version'
|
||||||
cache: npm
|
cache: npm
|
||||||
|
|||||||
8
.github/workflows/codeql-analysis.yml
vendored
8
.github/workflows/codeql-analysis.yml
vendored
@@ -38,11 +38,11 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
@@ -53,7 +53,7 @@ jobs:
|
|||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v2
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
@@ -67,4 +67,4 @@ jobs:
|
|||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v3
|
||||||
|
|||||||
2
.github/workflows/draft-release.yml
vendored
2
.github/workflows/draft-release.yml
vendored
@@ -11,6 +11,6 @@ jobs:
|
|||||||
draft-release:
|
draft-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: release-drafter/release-drafter@65c5fb495d1e69aa8c08a3317bc44ff8aabe9772 # v5.24.0
|
- uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.PAGES_AUTOMATION_PAT }}
|
token: ${{ secrets.PAGES_AUTOMATION_PAT }}
|
||||||
|
|
||||||
- name: Setup Node.JS
|
- name: Setup Node.JS
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.node-version'
|
node-version-file: '.node-version'
|
||||||
cache: npm
|
cache: npm
|
||||||
|
|||||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -24,7 +24,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Update the ${{ env.TAG_NAME }} tag
|
- name: Update the ${{ env.TAG_NAME }} tag
|
||||||
id: update-major-tag
|
id: update-major-tag
|
||||||
uses: actions/publish-action@v0.2.2
|
uses: actions/publish-action@v0.3.0
|
||||||
with:
|
with:
|
||||||
source-tag: ${{ env.TAG_NAME }}
|
source-tag: ${{ env.TAG_NAME }}
|
||||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
||||||
|
|||||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -14,10 +14,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.JS
|
- name: Setup Node.JS
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.node-version'
|
node-version-file: '.node-version'
|
||||||
cache: npm
|
cache: npm
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
18.9.0
|
20.10.0
|
||||||
|
|||||||
11
README.md
11
README.md
@@ -41,7 +41,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action
|
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
|
||||||
```
|
```
|
||||||
|
|
||||||
### Inputs 📥
|
### Inputs 📥
|
||||||
@@ -51,7 +51,7 @@ jobs:
|
|||||||
| `token` | `true` | `${{ github.token }}` | The GitHub token used to create an authenticated client - Provided for you by default! |
|
| `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) |
|
| `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) |
|
| `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 |
|
| `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!) |
|
| `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!) |
|
||||||
|
|
||||||
@@ -85,10 +85,13 @@ There are a few important considerations to be aware of:
|
|||||||
|
|
||||||
## Compatibility
|
## 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 |
|
| Release | GHES Compatibility |
|
||||||
|:---|:---|
|
|:---|:---|
|
||||||
|
| [`v4`](https://github.com/actions/deploy-pages/releases/tag/v4) | :warning: Incompatible at this time |
|
||||||
|
| [`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`](https://github.com/actions/deploy-pages/releases/tag/v2) | `>= 3.9` |
|
||||||
| `v2.x.x` | `>= 3.9` |
|
| `v2.x.x` | `>= 3.9` |
|
||||||
| [`v1`](https://github.com/actions/deploy-pages/releases/tag/v1) | `>= 3.7` |
|
| [`v1`](https://github.com/actions/deploy-pages/releases/tag/v1) | `>= 3.7` |
|
||||||
@@ -105,7 +108,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:
|
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].
|
⚠️ 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'
|
description: 'A GitHub Action to deploy an artifact as a GitHub Pages site'
|
||||||
author: 'GitHub'
|
author: 'GitHub'
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
inputs:
|
inputs:
|
||||||
token:
|
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.53%"><title>Coverage: 79.53%</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.53%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">79.53%</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: 80.84%"><title>Coverage: 80.84%</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">80.84%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">80.84%</text></g></svg>
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
144623
dist/index.js
generated
vendored
144623
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
2708
dist/licenses.txt
generated
vendored
2708
dist/licenses.txt
generated
vendored
File diff suppressed because it is too large
Load Diff
8842
package-lock.json
generated
8842
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@@ -4,18 +4,22 @@
|
|||||||
"description": "Deploy an actions artifact to GitHub Pages",
|
"description": "Deploy an actions artifact to GitHub Pages",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/artifact": "^2.1.3",
|
||||||
"@actions/github": "^5.1.1"
|
"@actions/core": "^1.10.1",
|
||||||
|
"@actions/github": "^6.0.0",
|
||||||
|
"@octokit/request-error": "^5.0.1",
|
||||||
|
"http-status-messages": "^1.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.38.1",
|
||||||
"eslint": "^8.44.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-plugin-github": "^4.8.0",
|
"eslint-plugin-github": "^4.10.1",
|
||||||
"jest": "^29.6.1",
|
"jest": "^29.7.0",
|
||||||
"make-coverage-badge": "^1.2.0",
|
"make-coverage-badge": "^1.2.0",
|
||||||
"nock": "^13.3.1",
|
"nock": "^13.5.3",
|
||||||
"prettier": "^3.0.0"
|
"prettier": "^3.2.5",
|
||||||
|
"undici": "^6.6.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"all": "npm run format && npm run lint && npm run prepare && npm run test && npm run coverage-badge",
|
"all": "npm run format && npm run lint && npm run prepare && npm run test && npm run coverage-badge",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,50 +1,107 @@
|
|||||||
const core = require('@actions/core')
|
const core = require('@actions/core')
|
||||||
const github = require('@actions/github')
|
const github = require('@actions/github')
|
||||||
|
const { DefaultArtifactClient } = require('@actions/artifact')
|
||||||
|
const { RequestError } = require('@octokit/request-error')
|
||||||
|
const HttpStatusMessages = require('http-status-messages')
|
||||||
|
|
||||||
async function getArtifactMetadata({ githubToken, runId, artifactName }) {
|
function wrapTwirpResponseLikeOctokit(twirpResponse, requestOptions) {
|
||||||
const octokit = github.getOctokit(githubToken)
|
// Specific response shape aligned with Octokit
|
||||||
|
const response = {
|
||||||
|
url: requestOptions.url,
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
...requestOptions.headers
|
||||||
|
},
|
||||||
|
data: twirpResponse
|
||||||
|
}
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mimic the errors thrown by Octokit for consistency.
|
||||||
|
function wrapTwirpErrorLikeOctokit(twirpError, requestOptions) {
|
||||||
|
const rawErrorMsg = twirpError?.message || twirpError?.toString() || ''
|
||||||
|
const statusCodeMatch = rawErrorMsg.match(/Failed request: \((?<statusCode>\d+)\)/)
|
||||||
|
const statusCode = statusCodeMatch?.groups?.statusCode ?? 500
|
||||||
|
|
||||||
|
// Try to provide the best error message
|
||||||
|
const errorMsg =
|
||||||
|
rawErrorMsg ||
|
||||||
|
// Fallback to the HTTP status message based on the status code
|
||||||
|
HttpStatusMessages[statusCode] ||
|
||||||
|
// Or if the status code is unexpected...
|
||||||
|
`Unknown error (${statusCode})`
|
||||||
|
|
||||||
|
// RequestError is an Octokit-specific class
|
||||||
|
return new RequestError(errorMsg, statusCode, {
|
||||||
|
response: {
|
||||||
|
url: requestOptions.url,
|
||||||
|
status: statusCode,
|
||||||
|
headers: {
|
||||||
|
...requestOptions.headers
|
||||||
|
},
|
||||||
|
data: rawErrorMsg ? { message: rawErrorMsg } : ''
|
||||||
|
},
|
||||||
|
request: requestOptions
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function getArtifactsServiceOrigin() {
|
||||||
|
const resultsUrl = process.env.ACTIONS_RESULTS_URL
|
||||||
|
return resultsUrl ? new URL(resultsUrl).origin : ''
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getArtifactMetadata({ artifactName }) {
|
||||||
|
const artifactClient = new DefaultArtifactClient()
|
||||||
|
|
||||||
|
// Primarily for debugging purposes, accuracy is not critical
|
||||||
|
const requestOptions = {
|
||||||
|
method: 'POST',
|
||||||
|
url: `${getArtifactsServiceOrigin()}/twirp/github.actions.results.api.v1.ArtifactService/ListArtifacts`,
|
||||||
|
headers: {
|
||||||
|
'content-type': 'application/json'
|
||||||
|
},
|
||||||
|
body: {}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
core.info(`Fetching artifact metadata for ${artifactName} in run ${runId}`)
|
core.info(`Fetching artifact metadata for "${artifactName}" in this workflow run`)
|
||||||
|
|
||||||
const response = await octokit.request(
|
let response
|
||||||
'GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts?name={artifactName}',
|
try {
|
||||||
{
|
const twirpResponse = await artifactClient.listArtifacts()
|
||||||
owner: github.context.repo.owner,
|
response = wrapTwirpResponseLikeOctokit(twirpResponse, requestOptions)
|
||||||
repo: github.context.repo.repo,
|
} catch (twirpError) {
|
||||||
run_id: runId,
|
core.error('Listing artifact metadata failed', twirpError)
|
||||||
artifactName: artifactName
|
const octokitError = wrapTwirpErrorLikeOctokit(twirpError, requestOptions)
|
||||||
}
|
throw octokitError
|
||||||
)
|
}
|
||||||
|
|
||||||
const artifactCount = response.data.total_count
|
const filteredArtifacts = response.data.artifacts.filter(artifact => artifact.name === artifactName)
|
||||||
|
|
||||||
|
const artifactCount = filteredArtifacts.length
|
||||||
core.debug(`List artifact count: ${artifactCount}`)
|
core.debug(`List artifact count: ${artifactCount}`)
|
||||||
|
|
||||||
if (artifactCount === 0) {
|
if (artifactCount === 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`No artifacts found for workflow run ${runId}. Ensure artifacts are uploaded with actions/artifact@v4 or later.`
|
`No artifacts named "${artifactName}" were found for this workflow run. Ensure artifacts are uploaded with actions/upload-artifact@v4 or later.`
|
||||||
)
|
)
|
||||||
} else if (artifactCount > 1) {
|
} else if (artifactCount > 1) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Multiple artifact unexpectedly found for workflow run ${runId}. Artifact count is ${artifactCount}.`
|
`Multiple artifacts named "${artifactName}" were unexpectedly found for this workflow run. Artifact count is ${artifactCount}.`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const artifact = response.data.artifacts[0]
|
const artifact = filteredArtifacts[0]
|
||||||
core.debug(`Artifact: ${JSON.stringify(artifact)}`)
|
core.debug(`Artifact: ${JSON.stringify(artifact)}`)
|
||||||
|
|
||||||
const artifactSize = artifact.size_in_bytes
|
if (!artifact.size) {
|
||||||
if (!artifactSize) {
|
|
||||||
core.warning('Artifact size was not found. Unable to verify if artifact size exceeds the allowed size.')
|
core.warning('Artifact size was not found. Unable to verify if artifact size exceeds the allowed size.')
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return artifact
|
||||||
id: artifact.id,
|
|
||||||
size: artifactSize
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.error(
|
core.error(
|
||||||
'Fetching artifact metadata failed. Is githubstatus.com reporting issues with API requests, Pages or Actions? Please re-run the deployment at a later time.',
|
'Fetching artifact metadata failed. Is githubstatus.com reporting issues with API requests, Pages, or Actions? Please re-run the deployment at a later time.',
|
||||||
error
|
error
|
||||||
)
|
)
|
||||||
throw error
|
throw error
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const temporaryErrorStatus = {
|
|||||||
|
|
||||||
const finalErrorStatus = {
|
const finalErrorStatus = {
|
||||||
deployment_failed: 'Deployment failed, try again later.',
|
deployment_failed: 'Deployment failed, try again later.',
|
||||||
deployment_perms_error: 'Deployment failed, Please ensure that the file permissions are correct.',
|
deployment_perms_error: 'Deployment failed. Please ensure that the file permissions are correct.',
|
||||||
deployment_content_failed:
|
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.',
|
'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.',
|
deployment_cancelled: 'Deployment cancelled.',
|
||||||
@@ -63,11 +63,7 @@ class Deployment {
|
|||||||
core.debug(`Action ID: ${this.actionsId}`)
|
core.debug(`Action ID: ${this.actionsId}`)
|
||||||
core.debug(`Actions Workflow Run ID: ${this.workflowRun}`)
|
core.debug(`Actions Workflow Run ID: ${this.workflowRun}`)
|
||||||
|
|
||||||
const artifactData = await getArtifactMetadata({
|
const artifactData = await getArtifactMetadata({ artifactName: this.artifactName })
|
||||||
githubToken: this.githubToken,
|
|
||||||
runId: this.workflowRun,
|
|
||||||
artifactName: this.artifactName
|
|
||||||
})
|
|
||||||
|
|
||||||
if (artifactData?.size > ONE_GIGABYTE) {
|
if (artifactData?.size > ONE_GIGABYTE) {
|
||||||
core.warning(
|
core.warning(
|
||||||
@@ -102,14 +98,17 @@ class Deployment {
|
|||||||
|
|
||||||
// build customized error message based on server response
|
// build customized error message based on server response
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
let errorMessage = `Failed to create deployment (status: ${error.status}) with build version ${this.buildVersion}. `
|
let errorMessage = `Failed to create deployment (status: ${error.status}) with build version ${this.buildVersion}.`
|
||||||
|
if (error.response.headers['x-github-request-id']) {
|
||||||
|
errorMessage += ` Request ID ${error.response.headers['x-github-request-id']}`
|
||||||
|
}
|
||||||
if (error.status === 400) {
|
if (error.status === 400) {
|
||||||
errorMessage += `Responded with: ${error.message}`
|
errorMessage += ` Responded with: ${error.message}`
|
||||||
} else if (error.status === 403) {
|
} else if (error.status === 403) {
|
||||||
errorMessage += 'Ensure GITHUB_TOKEN has permission "pages: write".'
|
errorMessage += ' Ensure GITHUB_TOKEN has permission "pages: write".'
|
||||||
} else if (error.status === 404) {
|
} else if (error.status === 404) {
|
||||||
const pagesSettingsUrl = `${this.githubServerUrl}/${this.repositoryNwo}/settings/pages`
|
const pagesSettingsUrl = `${this.githubServerUrl}/${this.repositoryNwo}/settings/pages`
|
||||||
errorMessage += `Ensure GitHub Pages has been enabled: ${pagesSettingsUrl}`
|
errorMessage += ` Ensure GitHub Pages has been enabled: ${pagesSettingsUrl}`
|
||||||
// If using GHES, add a special note about compatibility
|
// If using GHES, add a special note about compatibility
|
||||||
if (new URL(this.githubServerUrl).hostname.toLowerCase() !== 'github.com') {
|
if (new URL(this.githubServerUrl).hostname.toLowerCase() !== 'github.com') {
|
||||||
errorMessage +=
|
errorMessage +=
|
||||||
@@ -117,7 +116,7 @@ class Deployment {
|
|||||||
}
|
}
|
||||||
} else if (error.status >= 500) {
|
} else if (error.status >= 500) {
|
||||||
errorMessage +=
|
errorMessage +=
|
||||||
'Server error, is githubstatus.com reporting a Pages outage? Please re-run the deployment at a later time.'
|
' Server error, is githubstatus.com reporting a Pages outage? Please re-run the deployment at a later time.'
|
||||||
}
|
}
|
||||||
throw new Error(errorMessage)
|
throw new Error(errorMessage)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user