mirror of
https://github.com/actions/deploy-pages.git
synced 2026-03-28 17:04:53 +00:00
Compare commits
170 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0243b6c10d | ||
|
|
c5b13e825e | ||
|
|
18445d282d | ||
|
|
fdc3607aa5 | ||
|
|
f1b9a1c464 | ||
|
|
90f24e5afb | ||
|
|
193cec853a | ||
|
|
13e4944607 | ||
|
|
f7e8fc9988 | ||
|
|
2029fc10d5 | ||
|
|
ecaf0351ef | ||
|
|
97522131dc | ||
|
|
1ae2543781 | ||
|
|
b32eea76f2 | ||
|
|
8ff204cadf | ||
|
|
e2e88ddce2 | ||
|
|
d6a56fd842 | ||
|
|
96a902c151 | ||
|
|
006c281682 | ||
|
|
0b20a897a9 | ||
|
|
ad08c0c36d | ||
|
|
22d02a6726 | ||
|
|
8a6bc55a7a | ||
|
|
368bf1aa22 | ||
|
|
7fe67672d7 | ||
|
|
cecb121fe2 | ||
|
|
d67909bb68 | ||
|
|
67198a6ece | ||
|
|
e19278d945 | ||
|
|
20a4baa109 | ||
|
|
3ffff52a9c | ||
|
|
af875e2038 | ||
|
|
2ca5e08d58 | ||
|
|
9b6b97b3c8 | ||
|
|
9b641caa4a | ||
|
|
a9645ed88d | ||
|
|
fa8a0ed4a7 | ||
|
|
d23af7369b | ||
|
|
dd5e0e9d1c | ||
|
|
5bc2a71d98 | ||
|
|
69a62cdfa4 | ||
|
|
3cb40c9234 | ||
|
|
75c1124b14 | ||
|
|
766cde6ce5 | ||
|
|
1352fce070 | ||
|
|
12ecc67b1a | ||
|
|
b388ef8bf2 | ||
|
|
818dc836a0 | ||
|
|
60e36109df | ||
|
|
7098b54017 | ||
|
|
539d415250 | ||
|
|
af51f9ed91 | ||
|
|
6e7a81b68f | ||
|
|
6bbc94d747 | ||
|
|
20ece23417 | ||
|
|
503d9f28e7 | ||
|
|
f8491fe25c | ||
|
|
de75c272ff | ||
|
|
5e811dcf4c | ||
|
|
f14d75a58d | ||
|
|
2727d0f5db | ||
|
|
67de43d94c | ||
|
|
1996917397 | ||
|
|
44d4246912 | ||
|
|
5de668770e | ||
|
|
1c52af2b34 | ||
|
|
c2379ec5e7 | ||
|
|
e7d22decca | ||
|
|
9b78820d58 | ||
|
|
dd23652c5c | ||
|
|
ec456f786c | ||
|
|
b68f047ef0 | ||
|
|
791c72a9c0 | ||
|
|
b45768bc0f | ||
|
|
3c12eff351 | ||
|
|
f5fafd81c2 | ||
|
|
f8578825e2 | ||
|
|
d2d7f752d5 | ||
|
|
ad109d8dbd | ||
|
|
3ed1d6d9a8 | ||
|
|
71efac92ad | ||
|
|
b742641b90 | ||
|
|
e4de7aa8e4 | ||
|
|
84346747a3 | ||
|
|
9113cc7efc | ||
|
|
858592354e | ||
|
|
114f9cc1f8 | ||
|
|
0dfe0f0668 | ||
|
|
c7c77bb21c | ||
|
|
369d1aed92 | ||
|
|
4865e84b02 | ||
|
|
b627026553 | ||
|
|
9bd912c0ca | ||
|
|
ed034ea1c3 | ||
|
|
8f9a38d5e7 | ||
|
|
71b1669225 | ||
|
|
a87638c69c | ||
|
|
85d735dc73 | ||
|
|
2e87ed0ac6 | ||
|
|
e490850a64 | ||
|
|
5743579482 | ||
|
|
5fd268dcdd | ||
|
|
fbb46fa661 | ||
|
|
eaaccf9fc5 | ||
|
|
8daa1e0ead | ||
|
|
99f9079292 | ||
|
|
06d025f427 | ||
|
|
7f629c4ce0 | ||
|
|
35e615a00c | ||
|
|
462df77e16 | ||
|
|
9ebae0d26b | ||
|
|
d0b379e44d | ||
|
|
225abf7840 | ||
|
|
1f0422c0df | ||
|
|
85b0d1617e | ||
|
|
3e976523d7 | ||
|
|
38e42fe573 | ||
|
|
44ea2ec0c1 | ||
|
|
b4e423ab11 | ||
|
|
58b7d54130 | ||
|
|
974e2a6ded | ||
|
|
f5d172a561 | ||
|
|
33bba0fd45 | ||
|
|
1f18c7a3ba | ||
|
|
86843fdbb5 | ||
|
|
4d0af465be | ||
|
|
bea9114e88 | ||
|
|
41f0a8ab89 | ||
|
|
b918908973 | ||
|
|
1ae5d2452b | ||
|
|
e2219a89b1 | ||
|
|
72b116b825 | ||
|
|
11a13019c2 | ||
|
|
801d74db09 | ||
|
|
64c69a5fdf | ||
|
|
03d70e4a19 | ||
|
|
64e33b2a0d | ||
|
|
c3d24faf75 | ||
|
|
2b0c6eaf67 | ||
|
|
358b034ef8 | ||
|
|
13ef0cb0a0 | ||
|
|
2bf05927ae | ||
|
|
0745e9700c | ||
|
|
43dced9e8c | ||
|
|
fce105b3ea | ||
|
|
148e2ea9dd | ||
|
|
506f839b97 | ||
|
|
f7a158aceb | ||
|
|
ca23c7917e | ||
|
|
0c60998bd5 | ||
|
|
4154a47b87 | ||
|
|
17fd28439d | ||
|
|
0f19a8f78c | ||
|
|
595c840e2a | ||
|
|
57f2f8bd29 | ||
|
|
68c14dcd2c | ||
|
|
a7af90c328 | ||
|
|
ef910bd895 | ||
|
|
53f4e898cd | ||
|
|
62c650c70d | ||
|
|
eaf36f48c9 | ||
|
|
01f6ae5af2 | ||
|
|
82cb77089c | ||
|
|
ad36b7023a | ||
|
|
32b8b86ff0 | ||
|
|
a598b2af14 | ||
|
|
f511fa4665 | ||
|
|
7a1dc4e394 | ||
|
|
92f6725bee | ||
|
|
e1279a88ef |
@@ -1,2 +0,0 @@
|
||||
node_modules/
|
||||
dist/
|
||||
@@ -1,19 +1,17 @@
|
||||
{
|
||||
"env": {
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"jest": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"globals": {
|
||||
"Atomics": "readonly",
|
||||
"SharedArrayBuffer": "readonly"
|
||||
"es2021": true,
|
||||
"node": true,
|
||||
"jest": true
|
||||
},
|
||||
"plugins": ["github"],
|
||||
"extends": ["eslint:recommended", "prettier", "plugin:github/internal"],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
"ecmaVersion": 12
|
||||
},
|
||||
"rules": {
|
||||
"semi": ["error", "never"]
|
||||
}
|
||||
},
|
||||
"ignorePatterns": ["/dist/", "/pre/"]
|
||||
}
|
||||
2
.github/CODEOWNERS
vendored
Normal file
2
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Default PR reviewers
|
||||
* @actions/pages
|
||||
11
.github/dependabot.yml
vendored
Normal file
11
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: 'github-actions'
|
||||
directory: '/'
|
||||
schedule:
|
||||
interval: 'weekly'
|
||||
|
||||
- package-ecosystem: 'npm'
|
||||
directory: '/'
|
||||
schedule:
|
||||
interval: 'weekly'
|
||||
4
.github/release-drafter.yml
vendored
4
.github/release-drafter.yml
vendored
@@ -3,8 +3,10 @@ name-template: 'v$RESOLVED_VERSION'
|
||||
tag-template: 'v$RESOLVED_VERSION'
|
||||
template: |
|
||||
# Changelog
|
||||
|
||||
$CHANGES
|
||||
See details of [all code changes](https://github.com/actions/jekyll-build-pages/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.
|
||||
categories:
|
||||
- title: '🚀 Features'
|
||||
labels:
|
||||
|
||||
14
.github/workflows/check-dist.yml
vendored
14
.github/workflows/check-dist.yml
vendored
@@ -21,12 +21,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set Node.js 16.x
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
@@ -37,8 +38,13 @@ jobs:
|
||||
- name: Compare the expected and actual dist/ directories
|
||||
run: |
|
||||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
||||
echo "Detected uncommitted changes after build. See status below:"
|
||||
echo "Detected uncommitted changes after build in dist folder. See status below:"
|
||||
git diff
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(git diff --ignore-space-at-eol pre/ | wc -l)" -gt "0" ]; then
|
||||
echo "Detected uncommitted changes after build in pre folder. See status below:"
|
||||
git diff
|
||||
exit 1
|
||||
fi
|
||||
id: diff
|
||||
|
||||
34
.github/workflows/check-formatting.yml
vendored
Normal file
34
.github/workflows/check-formatting.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Checking formatting
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# This allows a subsequently queued workflow run to interrupt previous runs
|
||||
concurrency:
|
||||
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node.JS
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Verify formatting
|
||||
run: npm run format:check
|
||||
34
.github/workflows/check-linter.yml
vendored
Normal file
34
.github/workflows/check-linter.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Check linter
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# This allows a subsequently queued workflow run to interrupt previous runs
|
||||
concurrency:
|
||||
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node.JS
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Verify linter
|
||||
run: npm run lint:check
|
||||
70
.github/workflows/codeql-analysis.yml
vendored
Normal file
70
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: 'CodeQL'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [main]
|
||||
schedule:
|
||||
- cron: '40 0 * * 1'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ['javascript']
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# 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)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
@@ -1,7 +1,7 @@
|
||||
name: Release new action version
|
||||
name: Release
|
||||
on:
|
||||
release:
|
||||
types: [edited]
|
||||
types: [released]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
TAG_NAME:
|
||||
@@ -10,19 +10,21 @@ on:
|
||||
|
||||
env:
|
||||
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update_tag:
|
||||
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
|
||||
environment:
|
||||
name: releaseNewActionVersion
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
# Note: this environment is protected
|
||||
name: Release
|
||||
steps:
|
||||
- name: Update the ${{ env.TAG_NAME }} tag
|
||||
id: update-major-tag
|
||||
uses: actions/publish-action@v0.1.0
|
||||
uses: actions/publish-action@v0.2.2
|
||||
with:
|
||||
source-tag: ${{ env.TAG_NAME }}
|
||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
||||
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@@ -10,12 +10,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set Node.JS
|
||||
uses: actions/setup-node@v2
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 12.x
|
||||
node-version: 16.x
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
node_modules/
|
||||
# Ignore build artifacts
|
||||
/dist/
|
||||
/pre/
|
||||
|
||||
# Ignore all Markdown files
|
||||
*.md
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": false,
|
||||
"arrowParens": "avoid"
|
||||
}
|
||||
10
.prettierrc.yml
Normal file
10
.prettierrc.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
# Prettier (formatter) configuration
|
||||
---
|
||||
printWidth: 120
|
||||
tabWidth: 2
|
||||
useTabs: false
|
||||
semi: false
|
||||
singleQuote: true
|
||||
trailingComma: none
|
||||
bracketSpacing: true
|
||||
arrowParens: avoid
|
||||
1
CODEOWNERS
Normal file
1
CODEOWNERS
Normal file
@@ -0,0 +1 @@
|
||||
* @actions/pages
|
||||
88
README.md
88
README.md
@@ -1,17 +1,89 @@
|
||||
# Deploy-Pages
|
||||
# deploy-pages
|
||||
|
||||
This deploys artifacts to GitHub Pages.
|
||||
This action is used to deploy [Actions artifacts][artifacts] to GitHub Pages.
|
||||
|
||||
# Scope
|
||||
## Scope
|
||||
|
||||
⚠️ Official support for building Pages with Actions is in public beta at the moment. The scope is currently limited to **public repositories only**.
|
||||
⚠️ Official support for building Pages with Actions is in public beta at the moment.
|
||||
|
||||
# Usage
|
||||
## Usage
|
||||
|
||||
See [action.yml](action.yml)
|
||||
See [action.yml](action.yml) for the various `inputs` this action supports.
|
||||
|
||||
<!-- TODO: document custom workflow -->
|
||||
For examples that make use of this action, check out our [starter-workflows][starter-workflows] in a variety of frameworks.
|
||||
|
||||
# License
|
||||
This action expects an artifact named `github-pages` to have been created prior to execution. This is done automatically using [`actions/upload-pages-artifact`][upload-pages-artifact].
|
||||
|
||||
We recommend this action to be used in a dedicated job:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
# Build job
|
||||
build:
|
||||
# <Not provided for brevity>
|
||||
# At a minimum this job should upload artifacts using actions/upload-pages-artifact
|
||||
|
||||
# Deploy job
|
||||
deploy:
|
||||
# Add a dependency to the build job
|
||||
needs: build
|
||||
|
||||
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
|
||||
permissions:
|
||||
pages: write # to deploy to Pages
|
||||
id-token: write # to verify the deployment originates from an appropriate source
|
||||
|
||||
# Deploy to the github-pages environment
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
|
||||
# Specify runner + deployment step
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v1
|
||||
```
|
||||
|
||||
## Security considerations
|
||||
|
||||
There are a few important considerations to be aware of:
|
||||
|
||||
1. The artifact being deployed must have been uploaded in a previous step, either in the same job or a separate job that doesn't execute until the upload is complete.
|
||||
|
||||
2. The job that executes the deployment must at minimum have the following permissions:
|
||||
- `pages: write`
|
||||
- `id-token: write`
|
||||
|
||||
3. The deployment should target the `github-pages` environment (you may use a different environment name if needed, but this is not recommended.)
|
||||
|
||||
4. If your Pages site is using a source branch, the deployment must originate from this source branch unless [your environment is protected][environment-protection] in which case the environment protection rules take precedence over the source branch rule
|
||||
|
||||
5. If your Pages site is using GitHub Actions as the source, while not required we highly recommend you also [protect your environment][environment-protection] (we do it by default for you)
|
||||
|
||||
# Release instructions
|
||||
|
||||
In order to release a new version of this Action:
|
||||
|
||||
1. Locate the semantic version of the [upcoming release][release-list] (a draft is maintained by the [`draft-release` workflow][draft-release]).
|
||||
|
||||
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`.
|
||||
|
||||
⚠️ Environment approval is required. Check the [Release workflow run list][release-workflow-runs].
|
||||
|
||||
## License
|
||||
|
||||
The scripts and documentation in this project are released under the [MIT License](LICENSE).
|
||||
|
||||
<!-- references -->
|
||||
[starter-workflows]: https://github.com/actions/starter-workflows/tree/main/pages
|
||||
[upload-pages-artifact]: https://github.com/actions/upload-pages-artifact
|
||||
[artifacts]: https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts
|
||||
[environment-protection]: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#environment-protection-rules
|
||||
[release-list]: https://github.com/actions/deploy-pages/releases
|
||||
[draft-release]: .github/workflows/draft-release.yml
|
||||
[release]: .github/workflows/release.yml
|
||||
[release-workflow-runs]: https://github.com/actions/deploy-pages/actions/workflows/release.yml
|
||||
|
||||
32
action.yml
32
action.yml
@@ -1,10 +1,18 @@
|
||||
name: 'Deploy to GitHub Pages'
|
||||
description: 'A GitHub Action to deploy an artifact to GitHub Pages'
|
||||
name: 'Deploy GitHub Pages site'
|
||||
description: 'A GitHub Action to deploy an artifact as a GitHub Pages site'
|
||||
author: 'GitHub'
|
||||
runs:
|
||||
using: 'node16'
|
||||
main: 'dist/index.js'
|
||||
pre: 'pre/index.js'
|
||||
inputs:
|
||||
emit_telemetry:
|
||||
deprecationMessage: 'Use of this input causes the action to do nothing. You should remove this build step from your workflow.'
|
||||
description: 'Should this action only emit build telemetry instead of deploying the build artifact?'
|
||||
required: false
|
||||
default: 'false'
|
||||
conclusion:
|
||||
description: 'The status of the previous build.'
|
||||
required: false
|
||||
token:
|
||||
description: 'GitHub token'
|
||||
default: ${{ github.token }}
|
||||
@@ -12,15 +20,23 @@ inputs:
|
||||
timeout:
|
||||
description: 'Time in milliseconds after which to timeout and cancel the deployment (default: 10 minutes)'
|
||||
required: false
|
||||
default: "600000"
|
||||
default: '600000'
|
||||
error_count:
|
||||
description: 'Maximum number of status report errors before cancelling a deployment (default: 10)'
|
||||
required: false
|
||||
default: "10"
|
||||
default: '10'
|
||||
reporting_interval:
|
||||
description: 'Time in milliseconds between two deployment status report (default: 1 second)'
|
||||
description: 'Time in milliseconds between two deployment status report (default: 5 seconds)'
|
||||
required: false
|
||||
default: "5000"
|
||||
default: '5000'
|
||||
artifact_name:
|
||||
description: 'Name of the artifact to deploy'
|
||||
required: false
|
||||
default: 'github-pages'
|
||||
preview:
|
||||
description: '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!)'
|
||||
required: false
|
||||
default: 'false'
|
||||
outputs:
|
||||
page_url:
|
||||
description: 'URL to deployed Github Pages'
|
||||
description: 'URL to deployed GitHub Pages'
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = {presets: ['@babel/preset-env']}
|
||||
11209
dist/index.js
vendored
11209
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
208
dist/licenses.txt
vendored
208
dist/licenses.txt
vendored
@@ -35,35 +35,45 @@ 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.
|
||||
|
||||
|
||||
@babel/runtime
|
||||
asynckit
|
||||
MIT
|
||||
MIT License
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
Copyright (c) 2016 Alex Indigo
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
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.
|
||||
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.
|
||||
|
||||
|
||||
axios
|
||||
MIT
|
||||
Copyright (c) 2014-present Matt Zabriskie
|
||||
# Copyright (c) 2014-present Matt Zabriskie & Collaborators
|
||||
|
||||
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.
|
||||
|
||||
|
||||
combined-stream
|
||||
MIT
|
||||
Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -84,22 +94,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
axios-retry
|
||||
Apache-2.0
|
||||
Copyright 2019 Softonic International S.A.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
debug
|
||||
MIT
|
||||
(The MIT License)
|
||||
@@ -123,6 +117,29 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
|
||||
delayed-stream
|
||||
MIT
|
||||
Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
|
||||
|
||||
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.
|
||||
|
||||
|
||||
follow-redirects
|
||||
MIT
|
||||
Copyright 2014–present Olivier Lalonde <olalonde@gmail.com>, James Talmage <james@talmage.io>, Ruben Verborgh
|
||||
@@ -145,6 +162,29 @@ 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.
|
||||
|
||||
|
||||
form-data
|
||||
MIT
|
||||
Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and 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.
|
||||
|
||||
|
||||
has-flag
|
||||
MIT
|
||||
MIT License
|
||||
@@ -158,18 +198,58 @@ 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.
|
||||
|
||||
|
||||
is-retry-allowed
|
||||
mime-db
|
||||
MIT
|
||||
MIT License
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) Vsevolod Strukchinsky <floatdrop@gmail.com> (github.com/floatdrop)
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2015-2022 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
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.
|
||||
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.
|
||||
|
||||
|
||||
mime-types
|
||||
MIT
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
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.
|
||||
|
||||
|
||||
ms
|
||||
@@ -197,29 +277,28 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
regenerator-runtime
|
||||
proxy-from-env
|
||||
MIT
|
||||
MIT License
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2014-present, Facebook, Inc.
|
||||
Copyright (C) 2016-2018 Rob Wu <rob@robwu.nl>
|
||||
|
||||
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:
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
|
||||
supports-color
|
||||
@@ -258,3 +337,16 @@ 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.
|
||||
|
||||
|
||||
uuid
|
||||
MIT
|
||||
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.
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
transform: {
|
||||
'^.+\\.(js|jsx)$': 'babel-jest'
|
||||
}
|
||||
}
|
||||
7816
package-lock.json
generated
7816
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
37
package.json
37
package.json
@@ -4,34 +4,31 @@
|
||||
"description": "Deploy an actions artifact to GitHub Pages",
|
||||
"main": "./dist/index.js",
|
||||
"dependencies": {
|
||||
"@actions/artifact": "^0.5.2",
|
||||
"@actions/core": "^1.6.0",
|
||||
"@babel/plugin-transform-runtime": "^7.16.0",
|
||||
"axios": "^0.24.0",
|
||||
"regenerator-runtime": "^0.13.9",
|
||||
"axios-retry": "^3.2.4",
|
||||
"tar": "^6.1.11"
|
||||
"@actions/core": "^1.10.0",
|
||||
"axios": "^1.3.0",
|
||||
"axios-retry": "^3.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.16.0",
|
||||
"@github/prettier-config": "0.0.4",
|
||||
"@vercel/ncc": "^0.31.1",
|
||||
"eslint": "^8.2.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint": "^8.33.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-github": "^4.3.4",
|
||||
"jest": "^27.3.1",
|
||||
"jest": "^29.4.1",
|
||||
"nock": "^13.2.0",
|
||||
"prettier": "^2.4.1"
|
||||
"prettier": "^2.8.3"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint src",
|
||||
"prepare": "ncc build src/index.js -o dist --source-map --license licenses.txt && ncc build src/pre.js -o pre --source-map --license licenses.txt",
|
||||
"test": "jest",
|
||||
"all": "npm run lint && npm run prepare && npm run test"
|
||||
"all": "npm run format && npm run lint && npm run prepare && npm run test",
|
||||
"format": "prettier --write .",
|
||||
"format:check": "prettier --check .",
|
||||
"lint": "DEBUG=eslint:cli-engine eslint --fix .",
|
||||
"lint:check": "DEBUG=eslint:cli-engine eslint .",
|
||||
"prepare": "ncc build src/index.js -o dist --source-map --license licenses.txt",
|
||||
"test": "jest"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/paper-spa/deploy-pages.git"
|
||||
"url": "git+https://github.com/actions/deploy-pages.git"
|
||||
},
|
||||
"keywords": [
|
||||
"GitHub",
|
||||
@@ -40,7 +37,7 @@
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/paper-spa/deploy-pages/issues"
|
||||
"url": "https://github.com/actions/deploy-pages/issues"
|
||||
},
|
||||
"homepage": "https://github.com/paper-spa/deploy-pages#readme"
|
||||
"homepage": "https://github.com/actions/deploy-pages#readme"
|
||||
}
|
||||
|
||||
7428
pre/index.js
7428
pre/index.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
260
pre/licenses.txt
260
pre/licenses.txt
@@ -1,260 +0,0 @@
|
||||
@actions/core
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
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:
|
||||
|
||||
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.
|
||||
|
||||
@actions/http-client
|
||||
MIT
|
||||
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.
|
||||
|
||||
|
||||
@babel/runtime
|
||||
MIT
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie 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.
|
||||
|
||||
|
||||
axios
|
||||
MIT
|
||||
Copyright (c) 2014-present Matt Zabriskie
|
||||
|
||||
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.
|
||||
|
||||
|
||||
axios-retry
|
||||
Apache-2.0
|
||||
Copyright 2019 Softonic International S.A.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
debug
|
||||
MIT
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
follow-redirects
|
||||
MIT
|
||||
Copyright 2014–present Olivier Lalonde <olalonde@gmail.com>, James Talmage <james@talmage.io>, Ruben Verborgh
|
||||
|
||||
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.
|
||||
|
||||
|
||||
has-flag
|
||||
MIT
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
|
||||
|
||||
is-retry-allowed
|
||||
MIT
|
||||
MIT License
|
||||
|
||||
Copyright (c) Vsevolod Strukchinsky <floatdrop@gmail.com> (github.com/floatdrop)
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
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.
|
||||
|
||||
|
||||
ms
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 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.
|
||||
|
||||
|
||||
regenerator-runtime
|
||||
MIT
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present, Facebook, 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.
|
||||
|
||||
|
||||
supports-color
|
||||
MIT
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
|
||||
|
||||
tunnel
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012 Koichi Kobayashi
|
||||
|
||||
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.
|
||||
File diff suppressed because one or more lines are too long
@@ -10,7 +10,11 @@ function getRequiredVars() {
|
||||
buildVersion: process.env.GITHUB_SHA,
|
||||
buildActor: process.env.GITHUB_ACTOR,
|
||||
actionsId: process.env.GITHUB_ACTION,
|
||||
githubToken: core.getInput('token')
|
||||
githubToken: core.getInput('token'),
|
||||
githubApiUrl: process.env.GITHUB_API_URL ?? 'https://api.github.com',
|
||||
githubServerUrl: process.env.GITHUB_SERVER_URL ?? 'https://github.com',
|
||||
artifactName: core.getInput('artifact_name') || 'github-pages',
|
||||
isPreview: core.getInput('preview') === 'true'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
require('regenerator-runtime/runtime')
|
||||
|
||||
const core = require('@actions/core')
|
||||
const axios = require('axios')
|
||||
|
||||
@@ -7,9 +5,9 @@ const axios = require('axios')
|
||||
const getContext = require('./context')
|
||||
|
||||
const errorStatus = {
|
||||
'unknown_status' : 'Unable to get deployment status.',
|
||||
'not_found' : 'Deployment not found.',
|
||||
'deployment_attempt_error' : 'Deployment temporarily failed, a retry will be automatically scheduled...'
|
||||
unknown_status: 'Unable to get deployment status.',
|
||||
not_found: 'Deployment not found.',
|
||||
deployment_attempt_error: 'Deployment temporarily failed, a retry will be automatically scheduled...'
|
||||
}
|
||||
|
||||
class Deployment {
|
||||
@@ -25,6 +23,10 @@ class Deployment {
|
||||
this.workflowRun = context.workflowRun
|
||||
this.requestedDeployment = false
|
||||
this.deploymentInfo = null
|
||||
this.githubApiUrl = context.githubApiUrl
|
||||
this.githubServerUrl = context.githubServerUrl
|
||||
this.artifactName = context.artifactName
|
||||
this.isPreview = context.isPreview === true
|
||||
}
|
||||
|
||||
// Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages
|
||||
@@ -33,25 +35,32 @@ class Deployment {
|
||||
try {
|
||||
core.info(`Actor: ${this.buildActor}`)
|
||||
core.info(`Action ID: ${this.actionsId}`)
|
||||
const pagesDeployEndpoint = `https://api.github.com/repos/${this.repositoryNwo}/pages/deployment`
|
||||
const pagesDeployEndpoint = `${this.githubApiUrl}/repos/${this.repositoryNwo}/pages/deployment`
|
||||
const artifactExgUrl = `${this.runTimeUrl}_apis/pipelines/workflows/${this.workflowRun}/artifacts?api-version=6.0-preview`
|
||||
core.info(`Artifact URL: ${artifactExgUrl}`)
|
||||
const {data} = await axios.get(artifactExgUrl, {
|
||||
const { data } = await axios.get(artifactExgUrl, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.runTimeToken}`,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
core.info(JSON.stringify(data))
|
||||
if (data.value.length == 0) {
|
||||
throw new Error('No uploaded artifact was found! Please check if there are any errors at build step.')
|
||||
const artifactRawUrl = data?.value?.find(artifact => artifact.name === this.artifactName)?.url
|
||||
if (!artifactRawUrl) {
|
||||
throw new Error(
|
||||
'No uploaded artifact was found! Please check if there are any errors at build step, or uploaded artifact name is correct.'
|
||||
)
|
||||
}
|
||||
const artifactUrl = `${data.value[0].url}&%24expand=SignedContent`
|
||||
|
||||
const artifactUrl = `${artifactRawUrl}&%24expand=SignedContent`
|
||||
const payload = {
|
||||
artifact_url: artifactUrl,
|
||||
pages_build_version: this.buildVersion,
|
||||
oidc_token: idToken
|
||||
}
|
||||
if (this.isPreview === true) {
|
||||
payload.preview = true
|
||||
}
|
||||
core.info(`Creating deployment with payload:\n${JSON.stringify(payload, null, '\t')}`)
|
||||
const response = await axios.post(pagesDeployEndpoint, payload, {
|
||||
headers: {
|
||||
@@ -62,25 +71,55 @@ class Deployment {
|
||||
})
|
||||
this.requestedDeployment = true
|
||||
core.info(`Created deployment for ${this.buildVersion}`)
|
||||
if (response && response.data) {
|
||||
core.info(JSON.stringify(response.data))
|
||||
this.deploymentInfo = response.data
|
||||
} catch (error) {
|
||||
core.info(`Failed to create deployment for ${this.buildVersion}.`)
|
||||
if (error.response && error.response.data) {
|
||||
core.info(JSON.stringify(error.response.data))
|
||||
}
|
||||
core.setFailed(error)
|
||||
} catch (error) {
|
||||
core.info(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.response.status}) with build version ${this.buildVersion}. `
|
||||
if (error.response.status == 400) {
|
||||
let message = ''
|
||||
if (error.response.data && error.response.data.message) {
|
||||
message = error.response.data.message
|
||||
} else {
|
||||
message = error.response.data
|
||||
}
|
||||
errorMessage += `Responded with: ${message}`
|
||||
} else if (error.response.status == 403) {
|
||||
errorMessage += `Ensure GITHUB_TOKEN has permission "pages: write".`
|
||||
} else if (error.response.status == 404) {
|
||||
const pagesSettingsUrl = `${this.githubServerUrl}/${this.repositoryNwo}/settings/pages`
|
||||
errorMessage += `Ensure GitHub Pages has been enabled: ${pagesSettingsUrl}`
|
||||
} else if (error.response.status >= 500) {
|
||||
errorMessage += `Server error, is githubstatus.com reporting a Pages outage? Please re-run the deployment at a later time.`
|
||||
}
|
||||
throw errorMessage
|
||||
} else {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Poll the deployment endpoint for status
|
||||
async check() {
|
||||
try {
|
||||
const statusUrl = this.deploymentInfo != null ?
|
||||
this.deploymentInfo["status_url"] :
|
||||
`https://api.github.com/repos/${this.repositoryNwo}/pages/deployment/status/${process.env['GITHUB_SHA']}`
|
||||
core.setOutput('page_url', this.deploymentInfo != null ? this.deploymentInfo["page_url"] : "")
|
||||
const statusUrl =
|
||||
this.deploymentInfo != null
|
||||
? this.deploymentInfo['status_url']
|
||||
: `${this.githubApiUrl}/repos/${this.repositoryNwo}/pages/deployment/status/${this.buildVersion}`
|
||||
let pageUrl = this.deploymentInfo != null ? this.deploymentInfo['page_url'] : ''
|
||||
const previewUrl = this.deploymentInfo != null ? this.deploymentInfo['preview_url'] : ''
|
||||
if (this.isPreview && previewUrl) {
|
||||
pageUrl = previewUrl
|
||||
}
|
||||
core.setOutput('page_url', pageUrl)
|
||||
const timeout = Number(core.getInput('timeout'))
|
||||
const reportingInterval = Number(core.getInput('reporting_interval'))
|
||||
const maxErrorCount = Number(core.getInput('error_count'))
|
||||
@@ -110,9 +149,11 @@ class Deployment {
|
||||
// Fall into permanent error, it may be caused by ongoing incident or malicious deployment content or exhausted automatic retry times.
|
||||
core.setFailed('Deployment failed, try again later.')
|
||||
break
|
||||
} else if(res.data.status == 'deployment_content_failed') {
|
||||
} else if (res.data.status == 'deployment_content_failed') {
|
||||
// The uploaded artifact is invalid.
|
||||
core.setFailed('Artifact could not be deployed. Please ensure the content does not contain any hard links, symlinks and total size is less than 10GB.')
|
||||
core.setFailed(
|
||||
'Artifact could not be deployed. Please ensure the content does not contain any hard links, symlinks and total size is less than 10GB.'
|
||||
)
|
||||
break
|
||||
} else if (errorStatus[res.data.status]) {
|
||||
// A temporary error happened, will query the status again
|
||||
@@ -126,7 +167,7 @@ class Deployment {
|
||||
|
||||
// set the Maximum error reporting interval greater than 15 sec but below 30 sec.
|
||||
if (errorReportingInterval < 1000 * 15) {
|
||||
errorReportingInterval = errorReportingInterval << 1 | 1
|
||||
errorReportingInterval = (errorReportingInterval << 1) | 1
|
||||
}
|
||||
} else {
|
||||
// reset the error reporting interval once get the proper status back.
|
||||
@@ -136,13 +177,19 @@ class Deployment {
|
||||
if (errorCount >= maxErrorCount) {
|
||||
core.info('Too many errors, aborting!')
|
||||
core.setFailed('Failed with status code: ' + res.status)
|
||||
break
|
||||
|
||||
// Explicitly cancel the deployment
|
||||
await this.cancel()
|
||||
return
|
||||
}
|
||||
|
||||
// Handle timeout
|
||||
if (Date.now() - startTime >= timeout) {
|
||||
core.info('Timeout reached, aborting!')
|
||||
core.setFailed('Timeout reached, aborting!')
|
||||
|
||||
// Explicitly cancel the deployment
|
||||
await this.cancel()
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -153,5 +200,34 @@ class Deployment {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async cancel() {
|
||||
// Don't attemp to cancel if no deployment was created
|
||||
if (!this.requestedDeployment) {
|
||||
return
|
||||
}
|
||||
module.exports = {Deployment}
|
||||
|
||||
// Cancel the deployment
|
||||
try {
|
||||
const pagesCancelDeployEndpoint = `${this.githubApiUrl}/repos/${this.repositoryNwo}/pages/deployment/cancel/${this.buildVersion}`
|
||||
await axios.put(
|
||||
pagesCancelDeployEndpoint,
|
||||
{},
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
Authorization: `Bearer ${this.githubToken}`,
|
||||
'Content-type': 'application/json'
|
||||
}
|
||||
}
|
||||
)
|
||||
core.info(`Deployment cancelled with ${pagesCancelDeployEndpoint}`)
|
||||
} catch (error) {
|
||||
core.setFailed(error)
|
||||
if (error.response && error.response.data) {
|
||||
core.info(JSON.stringify(error.response.data))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = { Deployment }
|
||||
|
||||
44
src/index.js
44
src/index.js
@@ -1,45 +1,28 @@
|
||||
require('regenerator-runtime/runtime')
|
||||
|
||||
// This package assumes a site has already been built and the files exist in the current workspace
|
||||
// If there's an artifact named `artifact.tar`, it can upload that to actions on its own,
|
||||
// without the user having to do the tar process themselves.
|
||||
|
||||
const core = require('@actions/core')
|
||||
// const github = require('@actions/github'); // TODO: Not used until we publish API endpoint to the @action/github package
|
||||
const axios = require('axios')
|
||||
|
||||
const {Deployment} = require('./deployment')
|
||||
const { Deployment } = require('./deployment')
|
||||
const deployment = new Deployment()
|
||||
|
||||
// TODO: If the artifact hasn't been created, we can create it and upload to artifact storage ourselves
|
||||
// const tar = require('tar')
|
||||
|
||||
async function cancelHandler(evtOrExitCodeOrError) {
|
||||
try {
|
||||
if (deployment.requestedDeployment) {
|
||||
const pagesCancelDeployEndpoint = `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment/cancel/${process.env.GITHUB_SHA}`
|
||||
await axios.put(
|
||||
pagesCancelDeployEndpoint,
|
||||
{},
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
|
||||
'Content-type': 'application/json'
|
||||
}
|
||||
}
|
||||
)
|
||||
core.info(`Deployment cancelled with ${pagesCancelDeployEndpoint}`)
|
||||
}
|
||||
} catch (e) {
|
||||
console.info('Deployment cancellation failed', e)
|
||||
}
|
||||
await deployment.cancel()
|
||||
process.exit(isNaN(+evtOrExitCodeOrError) ? 1 : +evtOrExitCodeOrError)
|
||||
}
|
||||
|
||||
async function main() {
|
||||
let idToken = ''
|
||||
try {
|
||||
idToken = await core.getIDToken()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
core.setFailed(`Ensure GITHUB_TOKEN has permission "id-token: write".`)
|
||||
return
|
||||
}
|
||||
try {
|
||||
const idToken = await core.getIDToken()
|
||||
await deployment.create(idToken)
|
||||
await deployment.check()
|
||||
} catch (error) {
|
||||
@@ -52,4 +35,9 @@ process.on('SIGINT', cancelHandler)
|
||||
process.on('SIGTERM', cancelHandler)
|
||||
|
||||
// Main
|
||||
main().then(() => require('./pre'))
|
||||
const emitTelemetry = core.getInput('emit_telemetry')
|
||||
if (emitTelemetry === 'true') {
|
||||
// For compatibility, treat the use of this deprecated input as a no-op
|
||||
} else {
|
||||
main()
|
||||
}
|
||||
|
||||
@@ -5,16 +5,14 @@ const path = require('path')
|
||||
const nock = require('nock')
|
||||
const axios = require('axios')
|
||||
|
||||
const { expect, jest } = require('@jest/globals')
|
||||
|
||||
const {Deployment} = require('./deployment')
|
||||
const { Deployment } = require('./deployment')
|
||||
|
||||
describe('with all environment variables set', () => {
|
||||
beforeEach(() => {
|
||||
process.env.ACTIONS_RUNTIME_URL = 'my-url'
|
||||
process.env.GITHUB_RUN_ID = '123'
|
||||
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
|
||||
process.env.GITHUB_REPOSITORY = 'paper-spa/is-awesome'
|
||||
process.env.GITHUB_REPOSITORY = 'actions/is-awesome'
|
||||
process.env.GITHUB_TOKEN = 'gha-token'
|
||||
process.env.GITHUB_SHA = '123abc'
|
||||
process.env.GITHUB_ACTOR = 'monalisa'
|
||||
@@ -22,6 +20,11 @@ describe('with all environment variables set', () => {
|
||||
process.env.GITHUB_ACTION_PATH = 'something'
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
// Remove mock for `core.getInput('preview')`
|
||||
delete process.env.INPUT_PREVIEW
|
||||
})
|
||||
|
||||
it('Executes cleanly', done => {
|
||||
const ip = path.join(__dirname, './index.js')
|
||||
cp.exec(`node ${ip}`, { env: process.env }, (err, stdout) => {
|
||||
@@ -35,8 +38,8 @@ describe('with variables missing', () => {
|
||||
it('execution fails if there are missing variables', done => {
|
||||
delete process.env.ACTIONS_RUNTIME_URL
|
||||
const ip = path.join(__dirname, './index.js')
|
||||
cp.exec(`node ${ip}`, {env: process.env}, (err, stdout) => {
|
||||
expect(stdout).toBe("")
|
||||
cp.exec(`node ${ip}`, { env: process.env }, (err, stdout) => {
|
||||
expect(stdout).toBe('')
|
||||
expect(err).toBeTruthy()
|
||||
expect(err.code).toBe(1)
|
||||
done()
|
||||
@@ -49,12 +52,22 @@ describe('create', () => {
|
||||
process.env.ACTIONS_RUNTIME_URL = 'http://my-url/'
|
||||
process.env.GITHUB_RUN_ID = '123'
|
||||
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
|
||||
process.env.GITHUB_REPOSITORY = 'paper-spa/is-awesome'
|
||||
process.env.GITHUB_REPOSITORY = 'actions/is-awesome'
|
||||
process.env.GITHUB_TOKEN = 'gha-token'
|
||||
process.env.GITHUB_SHA = '123abc'
|
||||
process.env.GITHUB_ACTOR = 'monalisa'
|
||||
process.env.GITHUB_ACTION = '__monalisa/octocat'
|
||||
process.env.GITHUB_ACTION_PATH = 'something'
|
||||
jest.spyOn(core, 'getInput').mockImplementation(param => {
|
||||
switch (param) {
|
||||
case 'artifact_name':
|
||||
return 'github-pages'
|
||||
case 'token':
|
||||
return process.env.GITHUB_TOKEN
|
||||
default:
|
||||
return process.env[`INPUT_${param.toUpperCase()}`] || ''
|
||||
}
|
||||
})
|
||||
|
||||
jest.spyOn(core, 'setOutput').mockImplementation(param => {
|
||||
return param
|
||||
@@ -72,10 +85,16 @@ describe('create', () => {
|
||||
|
||||
it('can successfully create a deployment', async () => {
|
||||
process.env.GITHUB_SHA = 'valid-build-version'
|
||||
const fakeJwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiNjllMWIxOC1jOGFiLTRhZGQtOGYxOC03MzVlMzVjZGJhZjAiLCJzdWIiOiJyZXBvOnBhcGVyLXNwYS9taW55aTplbnZpcm9ubWVudDpQcm9kdWN0aW9uIiwiYXVkIjoiaHR0cHM6Ly9naXRodWIuY29tL3BhcGVyLXNwYSIsInJlZiI6InJlZnMvaGVhZHMvbWFpbiIsInNoYSI6ImEyODU1MWJmODdiZDk3NTFiMzdiMmM0YjM3M2MxZjU3NjFmYWM2MjYiLCJyZXBvc2l0b3J5IjoicGFwZXItc3BhL21pbnlpIiwicmVwb3NpdG9yeV9vd25lciI6InBhcGVyLXNwYSIsInJ1bl9pZCI6IjE1NDY0NTkzNjQiLCJydW5fbnVtYmVyIjoiMzQiLCJydW5fYXR0ZW1wdCI6IjIiLCJhY3RvciI6IllpTXlzdHkiLCJ3b3JrZmxvdyI6IkNJIiwiaGVhZF9yZWYiOiIiLCJiYXNlX3JlZiI6IiIsImV2ZW50X25hbWUiOiJwdXNoIiwicmVmX3R5cGUiOiJicmFuY2giLCJlbnZpcm9ubWVudCI6IlByb2R1Y3Rpb24iLCJqb2Jfd29ya2Zsb3dfcmVmIjoicGFwZXItc3BhL21pbnlpLy5naXRodWIvd29ya2Zsb3dzL2JsYW5rLnltbEByZWZzL2hlYWRzL21haW4iLCJpc3MiOiJodHRwczovL3Rva2VuLmFjdGlvbnMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwibmJmIjoxNjM4ODI4MDI4LCJleHAiOjE2Mzg4Mjg5MjgsImlhdCI6MTYzODgyODYyOH0.1wyupfxu1HGoTyIqatYg0hIxy2-0bMO-yVlmLSMuu2w'
|
||||
const fakeJwt =
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiNjllMWIxOC1jOGFiLTRhZGQtOGYxOC03MzVlMzVjZGJhZjAiLCJzdWIiOiJyZXBvOnBhcGVyLXNwYS9taW55aTplbnZpcm9ubWVudDpQcm9kdWN0aW9uIiwiYXVkIjoiaHR0cHM6Ly9naXRodWIuY29tL3BhcGVyLXNwYSIsInJlZiI6InJlZnMvaGVhZHMvbWFpbiIsInNoYSI6ImEyODU1MWJmODdiZDk3NTFiMzdiMmM0YjM3M2MxZjU3NjFmYWM2MjYiLCJyZXBvc2l0b3J5IjoicGFwZXItc3BhL21pbnlpIiwicmVwb3NpdG9yeV9vd25lciI6InBhcGVyLXNwYSIsInJ1bl9pZCI6IjE1NDY0NTkzNjQiLCJydW5fbnVtYmVyIjoiMzQiLCJydW5fYXR0ZW1wdCI6IjIiLCJhY3RvciI6IllpTXlzdHkiLCJ3b3JrZmxvdyI6IkNJIiwiaGVhZF9yZWYiOiIiLCJiYXNlX3JlZiI6IiIsImV2ZW50X25hbWUiOiJwdXNoIiwicmVmX3R5cGUiOiJicmFuY2giLCJlbnZpcm9ubWVudCI6IlByb2R1Y3Rpb24iLCJqb2Jfd29ya2Zsb3dfcmVmIjoicGFwZXItc3BhL21pbnlpLy5naXRodWIvd29ya2Zsb3dzL2JsYW5rLnltbEByZWZzL2hlYWRzL21haW4iLCJpc3MiOiJodHRwczovL3Rva2VuLmFjdGlvbnMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwibmJmIjoxNjM4ODI4MDI4LCJleHAiOjE2Mzg4Mjg5MjgsImlhdCI6MTYzODgyODYyOH0.1wyupfxu1HGoTyIqatYg0hIxy2-0bMO-yVlmLSMuu2w'
|
||||
const scope = nock(`http://my-url`)
|
||||
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
|
||||
.reply(200, { value: [{ url: 'https://fake-artifact.com' }] })
|
||||
.reply(200, {
|
||||
value: [
|
||||
{ url: 'https://another-artifact.com', name: 'another-artifact' },
|
||||
{ url: 'https://fake-artifact.com', name: 'github-pages' }
|
||||
]
|
||||
})
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
axios.post = jest.fn().mockResolvedValue('test')
|
||||
@@ -85,7 +104,7 @@ describe('create', () => {
|
||||
await deployment.create(fakeJwt)
|
||||
|
||||
expect(axios.post).toBeCalledWith(
|
||||
'https://api.github.com/repos/paper-spa/is-awesome/pages/deployment',
|
||||
'https://api.github.com/repos/actions/is-awesome/pages/deployment',
|
||||
{
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: 'valid-build-version',
|
||||
@@ -94,17 +113,61 @@ describe('create', () => {
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
Authorization: 'Bearer ',
|
||||
Authorization: `Bearer gha-token`,
|
||||
'Content-type': 'application/json'
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
expect(core.setFailed).not.toHaveBeenCalled()
|
||||
expect(core.info).toHaveBeenCalledWith(
|
||||
'Created deployment for valid-build-version'
|
||||
expect(core.info).toHaveBeenCalledWith('Created deployment for valid-build-version')
|
||||
|
||||
scope.done()
|
||||
})
|
||||
|
||||
it('can successfully create a preview deployment', async () => {
|
||||
process.env.GITHUB_SHA = 'valid-build-version'
|
||||
const fakeJwt =
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiNjllMWIxOC1jOGFiLTRhZGQtOGYxOC03MzVlMzVjZGJhZjAiLCJzdWIiOiJyZXBvOnBhcGVyLXNwYS9taW55aTplbnZpcm9ubWVudDpQcm9kdWN0aW9uIiwiYXVkIjoiaHR0cHM6Ly9naXRodWIuY29tL3BhcGVyLXNwYSIsInJlZiI6InJlZnMvaGVhZHMvbWFpbiIsInNoYSI6ImEyODU1MWJmODdiZDk3NTFiMzdiMmM0YjM3M2MxZjU3NjFmYWM2MjYiLCJyZXBvc2l0b3J5IjoicGFwZXItc3BhL21pbnlpIiwicmVwb3NpdG9yeV9vd25lciI6InBhcGVyLXNwYSIsInJ1bl9pZCI6IjE1NDY0NTkzNjQiLCJydW5fbnVtYmVyIjoiMzQiLCJydW5fYXR0ZW1wdCI6IjIiLCJhY3RvciI6IllpTXlzdHkiLCJ3b3JrZmxvdyI6IkNJIiwiaGVhZF9yZWYiOiIiLCJiYXNlX3JlZiI6IiIsImV2ZW50X25hbWUiOiJwdXNoIiwicmVmX3R5cGUiOiJicmFuY2giLCJlbnZpcm9ubWVudCI6IlByb2R1Y3Rpb24iLCJqb2Jfd29ya2Zsb3dfcmVmIjoicGFwZXItc3BhL21pbnlpLy5naXRodWIvd29ya2Zsb3dzL2JsYW5rLnltbEByZWZzL2hlYWRzL21haW4iLCJpc3MiOiJodHRwczovL3Rva2VuLmFjdGlvbnMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwibmJmIjoxNjM4ODI4MDI4LCJleHAiOjE2Mzg4Mjg5MjgsImlhdCI6MTYzODgyODYyOH0.1wyupfxu1HGoTyIqatYg0hIxy2-0bMO-yVlmLSMuu2w'
|
||||
const scope = nock(`http://my-url`)
|
||||
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
|
||||
.reply(200, {
|
||||
value: [
|
||||
{ url: 'https://another-artifact.com', name: 'another-artifact' },
|
||||
{ url: 'https://fake-artifact.com', name: 'github-pages' }
|
||||
]
|
||||
})
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
axios.post = jest.fn().mockResolvedValue('test')
|
||||
|
||||
// Return `"true"` for `core.getInput("preview")`
|
||||
process.env.INPUT_PREVIEW = 'true'
|
||||
|
||||
// Create the deployment
|
||||
const deployment = new Deployment()
|
||||
await deployment.create(fakeJwt)
|
||||
|
||||
expect(axios.post).toBeCalledWith(
|
||||
'https://api.github.com/repos/actions/is-awesome/pages/deployment',
|
||||
{
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: 'valid-build-version',
|
||||
oidc_token: fakeJwt,
|
||||
preview: true
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
Authorization: `Bearer gha-token`,
|
||||
'Content-type': 'application/json'
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
expect(core.setFailed).not.toHaveBeenCalled()
|
||||
expect(core.info).toHaveBeenCalledWith('Created deployment for valid-build-version')
|
||||
|
||||
scope.done()
|
||||
})
|
||||
|
||||
@@ -112,7 +175,7 @@ describe('create', () => {
|
||||
process.env.GITHUB_SHA = 'invalid-build-version'
|
||||
const scope = nock(`http://my-url`)
|
||||
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
|
||||
.reply(200, { value: [{ url: 'https://invalid-artifact.com' }] })
|
||||
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] })
|
||||
|
||||
axios.post = jest.fn().mockRejectedValue({
|
||||
status: 400
|
||||
@@ -123,9 +186,8 @@ describe('create', () => {
|
||||
try {
|
||||
deployment.create()
|
||||
} catch (err) {
|
||||
|
||||
expect(axios.post).toBeCalledWith(
|
||||
'https://api.github.com/repos/paper-spa/is-awesome/pages/deployment',
|
||||
'https://api.github.com/repos/actions/is-awesome/pages/deployment',
|
||||
{
|
||||
artifact_url: 'https://invalid-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: 'invalid-build-version'
|
||||
@@ -139,15 +201,12 @@ describe('create', () => {
|
||||
}
|
||||
)
|
||||
|
||||
expect(core.info).toHaveBeenLastCalledWith(
|
||||
'Failed to create deployment for invalid-build-version.'
|
||||
)
|
||||
expect(core.info).toHaveBeenLastCalledWith('Failed to create deployment for invalid-build-version.')
|
||||
expect(core.setFailed).toHaveBeenCalledWith({ status: 400 })
|
||||
|
||||
scope.done()
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
describe('check', () => {
|
||||
@@ -155,12 +214,13 @@ describe('check', () => {
|
||||
process.env.ACTIONS_RUNTIME_URL = 'http://my-url/'
|
||||
process.env.GITHUB_RUN_ID = '123'
|
||||
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
|
||||
process.env.GITHUB_REPOSITORY = 'paper-spa/is-awesome'
|
||||
process.env.GITHUB_REPOSITORY = 'actions/is-awesome'
|
||||
process.env.GITHUB_TOKEN = 'gha-token'
|
||||
process.env.GITHUB_SHA = '123abc'
|
||||
process.env.GITHUB_ACTOR = 'monalisa'
|
||||
process.env.GITHUB_ACTION = '__monalisa/octocat'
|
||||
process.env.GITHUB_ACTION_PATH = 'something'
|
||||
process.env.ARTIFACT_NAME = 'github-pages'
|
||||
|
||||
jest.spyOn(core, 'setOutput').mockImplementation(param => {
|
||||
return param
|
||||
@@ -209,7 +269,7 @@ describe('check', () => {
|
||||
`https://api.github.com/repos/${repositoryNwo}/pages/deployment/status/${buildVersion}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: 'token '
|
||||
Authorization: 'token gha-token'
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
57
src/pre.js
57
src/pre.js
@@ -1,57 +0,0 @@
|
||||
const core = require('@actions/core')
|
||||
const axios = require('axios')
|
||||
const axiosRetry = require('axios-retry')
|
||||
const retryAttempt = 3
|
||||
|
||||
axiosRetry(axios, {
|
||||
retries: retryAttempt,
|
||||
retryDelay: retryCount => {
|
||||
core.info(`retrying to send pages telemetry with attempt: ${retryCount}`)
|
||||
return retryCount * 1000 // time interval between retries, with 1s, 2s, 3s
|
||||
},
|
||||
|
||||
// retry on error greater than 500
|
||||
retryCondition: error => {
|
||||
return error.response.status >= 500
|
||||
}
|
||||
})
|
||||
|
||||
const {Deployment} = require('./deployment')
|
||||
|
||||
async function emitTelemetry() {
|
||||
// All variables we need from the runtime are set in the Deployment constructor
|
||||
const deployment = new Deployment()
|
||||
const telemetryUrl = `https://api.github.com/repos/${deployment.repositoryNwo}/pages/telemetry`
|
||||
core.info(`Sending telemetry for run id ${deployment.workflowRun}`)
|
||||
await axios
|
||||
.post(
|
||||
telemetryUrl,
|
||||
{github_run_id: deployment.workflowRun},
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
Authorization: `Bearer ${deployment.githubToken}`,
|
||||
'Content-type': 'application/json'
|
||||
}
|
||||
}
|
||||
)
|
||||
.catch(err => {
|
||||
if (err.response.status !== 200) {
|
||||
throw new Error(
|
||||
`failed to emit metric with status code: ${err.response.status} after ${retryAttempt} retry attempts`
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
await emitTelemetry()
|
||||
} catch (error) {
|
||||
core.error('failed to emit pages build telemetry')
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
module.exports = {emitTelemetry}
|
||||
@@ -1,64 +0,0 @@
|
||||
const core = require('@actions/core')
|
||||
const process = require('process')
|
||||
const axios = require('axios')
|
||||
|
||||
const {expect, jest} = require('@jest/globals')
|
||||
|
||||
const {emitTelemetry} = require('./pre')
|
||||
|
||||
describe('emitTelemetry', () => {
|
||||
beforeAll(() => {
|
||||
process.env.ACTIONS_RUNTIME_URL = 'my-url'
|
||||
process.env.GITHUB_RUN_ID = '123'
|
||||
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
|
||||
process.env.GITHUB_REPOSITORY = 'paper-spa/is-awesome'
|
||||
process.env.GITHUB_TOKEN = 'gha-token'
|
||||
process.env.GITHUB_SHA = '123abc'
|
||||
process.env.GITHUB_ACTOR = 'monalisa'
|
||||
process.env.GITHUB_ACTION = '__monalisa/octocat'
|
||||
process.env.GITHUB_ACTION_PATH = 'something'
|
||||
|
||||
jest.spyOn(core, 'setOutput').mockImplementation(param => {
|
||||
return param
|
||||
})
|
||||
|
||||
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())
|
||||
})
|
||||
|
||||
it('will send telemetry to github api', done => {
|
||||
process.env.GITHUB_SHA = 'valid-build-version'
|
||||
|
||||
axios.post = jest.fn().mockResolvedValue({
|
||||
status: 200,
|
||||
data: {
|
||||
status: 'succeed'
|
||||
}
|
||||
})
|
||||
|
||||
emitTelemetry()
|
||||
|
||||
expect(axios.post).toBeCalledWith(
|
||||
'https://api.github.com/repos/paper-spa/is-awesome/pages/telemetry',
|
||||
{
|
||||
github_run_id: process.env.GITHUB_RUN_ID
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
Authorization: 'Bearer ',
|
||||
'Content-type': 'application/json'
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
expect(core.setFailed).not.toHaveBeenCalled()
|
||||
done()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user