├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ ├── cleanup.yaml │ ├── pipeline.yaml │ └── publish_v1.yaml ├── .gitignore ├── .static ├── destroyed.png ├── finish.png └── start.png ├── LICENSE ├── Makefile ├── README.md ├── action.yml ├── dist ├── LICENSES ├── index.js ├── index.js.map └── sourcemap-register.js ├── jest.config.js ├── package-lock.json ├── package.json ├── src ├── lib │ ├── context.ts │ ├── deactivate.ts │ ├── delete.ts │ ├── input.ts │ └── log.ts ├── main.ts └── steps │ ├── finish.ts │ ├── index.ts │ └── start.ts └── tsconfig.json /.gitattributes: -------------------------------------------------------------------------------- 1 | dist/* linguist-generated -diff 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Please see the documentation for all configuration options: 2 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 3 | 4 | version: 2 5 | updates: 6 | - package-ecosystem: "npm" 7 | directory: "/" 8 | schedule: 9 | interval: "monthly" 10 | commit-message: 11 | prefix: "deps" 12 | -------------------------------------------------------------------------------- /.github/workflows/cleanup.yaml: -------------------------------------------------------------------------------- 1 | name: cleanup 2 | 3 | on: 4 | pull_request: 5 | types: [ closed ] 6 | 7 | jobs: 8 | delete-env: 9 | runs-on: ubuntu-latest 10 | strategy: 11 | matrix: 12 | scenario: [ 'success', 'failure' ] 13 | steps: 14 | - uses: actions/checkout@v3 15 | - uses: actions/setup-node@v3 16 | with: 17 | node-version: '18' 18 | 19 | # Dependencies 20 | # https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action 21 | - name: Cache node modules 22 | uses: actions/cache@v2 23 | env: 24 | cache-name: cache-node-modules 25 | with: 26 | path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS 27 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} 28 | restore-keys: | 29 | ${{ runner.os }}-build-${{ env.cache-name }}- 30 | ${{ runner.os }}-build- 31 | ${{ runner.os }}- 32 | - run: npm install 33 | - run: npm run build 34 | 35 | - name: extract branch name 36 | id: get_branch 37 | shell: bash 38 | env: 39 | PR_HEAD: ${{ github.head_ref }} 40 | run: echo "##[set-output name=branch;]$(echo ${PR_HEAD#refs/heads/} | tr / -)" 41 | 42 | - name: delete environment 43 | uses: ./ 44 | with: 45 | step: delete-env 46 | token: ${{ secrets.GITHUB_TOKEN }} 47 | env: integration-test-${{ steps.get_branch.outputs.branch }}-${{ matrix.scenario }} 48 | debug: true 49 | -------------------------------------------------------------------------------- /.github/workflows/pipeline.yaml: -------------------------------------------------------------------------------- 1 | name: pipeline 2 | 3 | on: 4 | push: 5 | branches: 6 | - '**' 7 | pull_request: {} 8 | 9 | jobs: 10 | checks: 11 | runs-on: ubuntu-latest 12 | steps: 13 | # Environment 14 | - uses: actions/checkout@v3 15 | - uses: actions/setup-node@v3 16 | with: 17 | node-version: '18' 18 | 19 | # Dependencies 20 | # https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action 21 | - name: Cache node modules 22 | uses: actions/cache@v2 23 | env: 24 | cache-name: cache-node-modules 25 | with: 26 | path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS 27 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} 28 | restore-keys: | 29 | ${{ runner.os }}-build-${{ env.cache-name }}- 30 | ${{ runner.os }}-build- 31 | ${{ runner.os }}- 32 | - run: npm install 33 | 34 | # Checks 35 | - run: npm run prettier:check 36 | - run: npm run build:check 37 | 38 | integration-tests: 39 | runs-on: ubuntu-latest 40 | needs: checks 41 | strategy: 42 | matrix: 43 | scenario: [ 'success', 'failure' ] 44 | include: 45 | - scenario: 'success' 46 | exit_code: 0 47 | - scenario: 'failure' 48 | exit_code: 1 49 | fail-fast: false 50 | steps: 51 | - uses: actions/checkout@v3 52 | - uses: actions/setup-node@v3 53 | with: 54 | node-version: '18' 55 | 56 | # Dependencies 57 | # https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action 58 | - name: Cache node modules 59 | uses: actions/cache@v2 60 | env: 61 | cache-name: cache-node-modules 62 | with: 63 | path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS 64 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} 65 | restore-keys: | 66 | ${{ runner.os }}-build-${{ env.cache-name }}- 67 | ${{ runner.os }}-build- 68 | ${{ runner.os }}- 69 | - run: npm install 70 | - run: npm run build 71 | 72 | - name: extract branch name 73 | id: get_branch 74 | shell: bash 75 | run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/} | tr / -)" 76 | 77 | - name: start deployment 78 | uses: ./ 79 | id: deployment 80 | with: 81 | step: start 82 | token: ${{ secrets.GITHUB_TOKEN }} 83 | env: integration-test-${{ steps.get_branch.outputs.branch }}-${{ matrix.scenario }} 84 | desc: 'Deployment starting!' 85 | debug: true 86 | 87 | - name: parse repo name and owner 88 | id: parse_repo 89 | shell: bash 90 | # outputs: owner, name 91 | run: | 92 | echo "owner=$(cut -d "/" -f 1 <<<"${{ github.repository }}")" >> $GITHUB_OUTPUT 93 | echo "name=$(cut -d "/" -f 2 <<<"${{ github.repository }}")" >> $GITHUB_OUTPUT 94 | 95 | 96 | - name: assert deployment in progress 97 | uses: actions/github-script@v6 98 | env: 99 | deployment_id: ${{ steps.deployment.outputs.deployment_id }} 100 | status_id: ${{ steps.deployment.outputs.status_id }} 101 | with: 102 | script: | 103 | const { deployment_id, status_id } = process.env; 104 | if (!deployment_id) { 105 | throw new Error("deployment_id not set"); 106 | } 107 | if (!status_id) { 108 | throw new Error("status_id not set"); 109 | } 110 | const res = await github.rest.repos.getDeploymentStatus({ 111 | owner: "${{ steps.parse_repo.outputs.owner }}", 112 | repo: "${{ steps.parse_repo.outputs.name }}", 113 | deployment_id: parseInt(deployment_id, 10), 114 | status_id: parseInt(status_id, 10), 115 | }); 116 | console.log(res) 117 | if (res.data.state !== "in_progress") { 118 | throw new Error(`unexpected status ${res.data.state}`); 119 | } 120 | 121 | - name: set deployment status to ${{ matrix.scenario }} 122 | uses: ./ 123 | id: finish 124 | with: 125 | step: finish 126 | token: ${{ secrets.GITHUB_TOKEN }} 127 | status: ${{ matrix.scenario }} 128 | deployment_id: ${{ steps.deployment.outputs.deployment_id }} 129 | env: ${{ steps.deployment.outputs.env }} 130 | desc: 'Deployment complete' 131 | debug: true 132 | 133 | - name: assert deployment complete 134 | uses: actions/github-script@v6 135 | env: 136 | deployment_id: ${{ steps.deployment.outputs.deployment_id }} 137 | status_id: ${{ steps.finish.outputs.status_id }} 138 | expected_state: ${{ matrix.scenario }} 139 | with: 140 | script: | 141 | const { deployment_id, status_id, expected_state } = process.env; 142 | if (!deployment_id) { 143 | throw new Error("deployment_id not set"); 144 | } 145 | if (!status_id) { 146 | throw new Error("status_id not set"); 147 | } 148 | const res = await github.rest.repos.getDeploymentStatus({ 149 | owner: "${{ steps.parse_repo.outputs.owner }}", 150 | repo: "${{ steps.parse_repo.outputs.name }}", 151 | deployment_id: parseInt(deployment_id, 10), 152 | status_id: parseInt(status_id, 10), 153 | }); 154 | console.log(res) 155 | if (res.data.state !== expected_state) { 156 | throw new Error(`unexpected status ${res.data.state}`); 157 | } 158 | 159 | - name: mark environment as deactivated 160 | uses: ./ 161 | with: 162 | step: deactivate-env 163 | token: ${{ secrets.GITHUB_TOKEN }} 164 | env: ${{ steps.deployment.outputs.env }} 165 | desc: Environment was pruned 166 | debug: true 167 | -------------------------------------------------------------------------------- /.github/workflows/publish_v1.yaml: -------------------------------------------------------------------------------- 1 | name: publish@v1 2 | 3 | on: 4 | push: 5 | tags: [ 'v1.*' ] 6 | 7 | jobs: 8 | publish: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: checkout 12 | uses: actions/checkout@v2 13 | - name: update tag 14 | run: | 15 | git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" 16 | git config --global user.name "${GITHUB_ACTOR}" 17 | git tag -fa v1 -m "update v1 tag" 18 | git push origin v1 --force 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.static/destroyed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobheadxi/deployments/648679e8e4915b27893bd7dbc35cb504dc915bc8/.static/destroyed.png -------------------------------------------------------------------------------- /.static/finish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobheadxi/deployments/648679e8e4915b27893bd7dbc35cb504dc915bc8/.static/finish.png -------------------------------------------------------------------------------- /.static/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobheadxi/deployments/648679e8e4915b27893bd7dbc35cb504dc915bc8/.static/start.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2018 GitHub, Inc. and contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | npm run build 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Deployments [![View Action](https://img.shields.io/badge/view-github%20action-yellow.svg)](https://bobheadxi.dev/r/deployments/) [![pipeline](https://github.com/bobheadxi/deployments/actions/workflows/pipeline.yaml/badge.svg)](https://github.com/bobheadxi/deployments/actions/workflows/pipeline.yaml) 2 | 3 | `bobheadxi/deployments` is a [GitHub Action](https://github.com/features/actions) for working painlessly with [GitHub deployment statuses](https://docs.github.com/en/rest/reference/deployments). 4 | Instead of exposing convoluted Action configuration that mirrors that of the [GitHub API](https://developer.github.com/v3/repos/deployments/) like some of the other available Actions do, this Action simply exposes a number of configurable, easy-to-use "steps" common to most deployment lifecycles. 5 | 6 | > 📢 This project is in need of additional maintainers - if you are interested in helping out please [let me know](https://github.com/bobheadxi/deployments/discussions/103)! 7 | 8 | - [Configuration](#configuration) 9 | - [`step: start`](#step-start) 10 | - [`step: finish`](#step-finish) 11 | - [`step: deactivate-env`](#step-deactivate-env) 12 | - [`step: delete-env`](#step-delete-env) 13 | - [Debugging](#debugging) 14 | - [Migrating to v1](#migrating-to-v1) 15 | 16 | A simple example: 17 | 18 | ```yml 19 | on: 20 | push: 21 | branches: 22 | - main 23 | 24 | jobs: 25 | deploy: 26 | runs-on: ubuntu-latest 27 | steps: 28 | - name: start deployment 29 | uses: bobheadxi/deployments@v1 30 | id: deployment 31 | with: 32 | step: start 33 | token: ${{ secrets.GITHUB_TOKEN }} 34 | env: release 35 | 36 | - name: do my deploy 37 | # ... 38 | 39 | - name: update deployment status 40 | uses: bobheadxi/deployments@v1 41 | if: always() 42 | with: 43 | step: finish 44 | token: ${{ secrets.GITHUB_TOKEN }} 45 | status: ${{ job.status }} 46 | env: ${{ steps.deployment.outputs.env }} 47 | deployment_id: ${{ steps.deployment.outputs.deployment_id }} 48 | ``` 49 | 50 | You can also refer to other projects that also use this action - you can find [more usages of this action on Sourcegraph](https://sourcegraph.com/search?q=context:global+uses:+bobheadxi/deployments%40.*+file:%5E%5C.github/workflows+-repo:bobheadxi+count:all&patternType=regexp), or check out the following examples: 51 | 52 | - [`github/super-linter`](https://sourcegraph.com/search?q=context:global+repo:%5Egithub%5C.com/github/super-linter%24+file:%5E%5C.github/workflows+bobheadxi/deployments&patternType=literal) [![GitHub Repo stars](https://img.shields.io/github/stars/github/super-linter?style=social)](https://github.com/github/super-linter) - [GitHub's all-in-one linter Action](https://github.blog/2020-06-18-introducing-github-super-linter-one-linter-to-rule-them-all/) 53 | - [`mxcl/PromiseKit`](https://sourcegraph.com/search?q=context:global+repo:%5Egithub%5C.com/mxcl/PromiseKit%24+file:%5E%5C.github/workflows+bobheadxi/deployments&patternType=literal) [![GitHub Repo stars](https://img.shields.io/github/stars/mxcl/PromiseKit?style=social)](https://github.com/mxcl/PromiseKit) - promises for Swift and Objective-C 54 | - [`saleor/saleor`](https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/saleor/saleor%24+bobheadxi/deployments\&patternType=literal) [![GitHub Repo stars](https://img.shields.io/github/stars/saleor/saleor?style=social)](https://github.com/saleor/saleor) - modular, high performance, headless e-commerce storefront 55 | - [`sharetribe/sharetribe`](https://sourcegraph.com/search?q=context:global+repo:%5Egithub%5C.com/sharetribe/sharetribe%24+file:%5E%5C.github/workflows+bobheadxi/deployments&patternType=literal) [![GitHub Repo stars](https://img.shields.io/github/stars/sharetribe/sharetribe?style=social)](https://github.com/sharetribe/sharetribe) - marketplace software 56 | - [`skylines-project/skylines`](https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/skylines-project/skylines%24+bobheadxi/deployments\&patternType=literal) [![GitHub Repo stars](https://img.shields.io/github/stars/skylines-project/skylines?style=social)](https://github.com/skylines-project/skylines) - live tracking, flight database and competition web platform 57 | 58 | Also feel free to chime in on the [show and tell discussion](https://github.com/bobheadxi/deployments/discussions/84) to share your usages of this Action! 59 | 60 | Check out [this blog post](https://dev.to/bobheadxi/branch-previews-with-google-app-engine-and-github-actions-3pco) for a bit of background on the origins of this project. 61 | 62 | ## Configuration 63 | 64 | The following [`inputs`](https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepswith) configuration options are for *all steps*: 65 | 66 | | Variable | Default | Purpose | 67 | | ------------ | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | 68 | | `step` | | One of [`start`](#step-start), [`finish`](#step-finish), [`deactivate-env`](#step-deactivate-env), or [`delete-env`](#step-delete-env) | 69 | | `token` | `${{ github.token }}` | provide your `${{ github.token }}` or `${{ secrets.GITHUB_TOKEN }}` for API access | 70 | | `env` | | identifier for environment to deploy to (e.g. `staging`, `prod`, `main`) | 71 | | `repository` | Current repository | target a specific repository for updates, e.g. `owner/repo` | 72 | | `logs` | URL to GitHub commit checks | URL of your deployment logs | 73 | | `desc` | GitHub-generated description | description for this deployment | 74 | | `ref` | `github.ref` | Specify a particular git ref to use, (e.g. `${{ github.head_ref }}`) | 75 | 76 | ### `step: start` 77 | 78 | This is best used on the `push: { branches: [ ... ] }` event, but you can also have `release: { types: [ published ] }` trigger this event. 79 | `start` should be followed by whatever deployment tasks you want to do, and it creates and marks a deployment as "started": 80 | 81 | ![deploy started](.static/start.png) 82 | 83 | In addition to the [core configuration](#configuration), the following [`inputs`](https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepswith) are available: 84 | 85 | | Variable | Default | Purpose | 86 | | --------------- | ------- | --------------------------------------------------------------------------------------------------- | 87 | | `deployment_id` | | Use an existing deployment instead of creating a new one (e.g. `${{ github.event.deployment.id }}`) | 88 | | `override` | `false` | whether to mark existing deployments of this environment as inactive | 89 | | `payload` | | JSON-formatted dictionary with extra information about the deployment | 90 | | `task` | `'deploy'` | change the task associated with this deployment, can be any string 91 | 92 | 93 | The following [`outputs`](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#steps-context) are available: 94 | 95 | | Variable | Purpose | 96 | | --------------- | -------------------------------------- | 97 | | `deployment_id` | ID of created GitHub deployment | 98 | | `status_id` | ID of created GitHub deployment status | 99 | | `env` | name of configured environment | 100 | 101 |
102 | Simple Push Example 103 |

104 | 105 | ```yml 106 | on: 107 | push: 108 | branches: 109 | - main 110 | 111 | jobs: 112 | deploy: 113 | steps: 114 | - name: start deployment 115 | uses: bobheadxi/deployments@v1 116 | id: deployment 117 | with: 118 | step: start 119 | env: release 120 | 121 | - name: do my deploy 122 | # ... 123 | ``` 124 | 125 |

126 |
127 | 128 |
129 | 130 |
131 | Simple Pull Request Example 132 |

133 | 134 | ```yml 135 | on: 136 | pull_request: 137 | 138 | jobs: 139 | deploy: 140 | runs-on: ubuntu-latest 141 | steps: 142 | - name: start deployment 143 | uses: bobheadxi/deployments@v1 144 | id: deployment 145 | with: 146 | step: start 147 | env: integration 148 | 149 | - name: do my deploy 150 | # ... 151 | ``` 152 | 153 |

154 |
155 | 156 |
157 | 158 | ### `step: finish` 159 | 160 | This is best used after `step: start` and should follow whatever deployment tasks you want to do in the same workflow. 161 | `finish` marks an in-progress deployment as complete: 162 | 163 | ![deploy finished](.static/finish.png) 164 | 165 | In addition to the [core configuration](#configuration), the following [`inputs`](https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepswith) are available: 166 | 167 | | Variable | Default | Purpose | 168 | | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 169 | | `status` | | provide the current deployment job status `${{ job.status }}` | 170 | | `deployment_id` | | identifier for deployment to update (see outputs of [`step: start`](#step-start)) | 171 | | `env_url` | | URL to view deployed environment | 172 | | `override` | `true` | whether to manually mark existing deployments of this environment as inactive | 173 | | `auto_inactive` | `false` | whether to let GitHub handle marking existing deployments of this environment as inactive ([if and only if a new deployment succeeds](https://docs.github.com/en/rest/reference/deployments#inactive-deployments)). | 174 | 175 |
176 | Simple Example 177 |

178 | 179 | ```yml 180 | # ... 181 | 182 | jobs: 183 | deploy: 184 | steps: 185 | - name: start deployment 186 | # ... see previous example 187 | 188 | - name: do my deploy 189 | # ... 190 | 191 | - name: update deployment status 192 | uses: bobheadxi/deployments@v1 193 | if: always() 194 | with: 195 | step: finish 196 | token: ${{ secrets.GITHUB_TOKEN }} 197 | status: ${{ job.status }} 198 | env: ${{ steps.deployment.outputs.env }} 199 | deployment_id: ${{ steps.deployment.outputs.deployment_id }} 200 | ``` 201 | 202 |

203 |
204 | 205 |
206 | 207 | ### `step: deactivate-env` 208 | 209 | This is best used on the `pull_request: { types: [ closed ] }` event, since GitHub does not seem to provide a event to detect when branches are deleted. 210 | This step can be used to automatically shut down deployments you create on pull requests and mark environments as destroyed: 211 | 212 | ![env destroyed](.static/destroyed.png) 213 | 214 | Refer to the [core configuration](#configuration) for available [`inputs`](https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepswith). 215 | 216 |
217 | Simple Example 218 |

219 | 220 | ```yml 221 | on: 222 | pull_request: 223 | types: [ closed ] 224 | 225 | jobs: 226 | prune: 227 | steps: 228 | # see https://dev.to/bobheadxi/branch-previews-with-google-app-engine-and-github-actions-3pco 229 | - name: extract branch name 230 | id: get_branch 231 | shell: bash 232 | env: 233 | PR_HEAD: ${{ github.head_ref }} 234 | run: echo "##[set-output name=branch;]$(echo ${PR_HEAD#refs/heads/} | tr / -)" 235 | 236 | - name: do my deployment shutdown 237 | # ... 238 | 239 | - name: mark environment as deactivated 240 | uses: bobheadxi/deployments@v1 241 | with: 242 | step: deactivate-env 243 | token: ${{ secrets.GITHUB_TOKEN }} 244 | env: ${{ steps.get_branch.outputs.branch }} 245 | desc: Environment was pruned 246 | ``` 247 | 248 |

249 |
250 | 251 | ### `step: delete-env` 252 | 253 | This is the same as `deactivate-env`, except deletes the environment entirely. See [`step: deactivate-env`](#step-deactivate-env) for more details. 254 | 255 | Note that the default `GITHUB_TOKEN` does not allow environment deletion - you have to set a personal access token with `deployments:write` and `administration:write` permissions and provide it in the `token` input. 256 | 257 | Refer to the [core configuration](#configuration) for available [`inputs`](https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepswith). 258 | 259 |
260 | 261 | ## Debugging 262 | 263 | The argument `debug: true` can be provided to print arguments used by `deployments` and log debug information. 264 | 265 | If you run into an problems or have any questions, feel free to open an [issue](https://github.com/bobheadxi/deployments/issues) or [discussion](https://github.com/bobheadxi/deployments/discussions)! 266 | 267 |
268 | 269 | ## Migrating to v1 270 | 271 | `bobheadxi/deployments@v1` makes the following breaking changes from `v0.6.x`: 272 | 273 | - **CHANGED: `no_override` is now `override`**, and the default behaviour is `override: true` in `step: finish` (`step: start` behaviour remains unchanged, but you can now set `override: true` on it now as well). 274 | - **CHANGED: `log_args` is now `debug`**, but does the same thing as before. 275 | - **CHANGED: `env` is now always required**. You can use `env: ${{ steps.deployment.outputs.env }}` to avoid repeating your env configuration. 276 | - **REMOVED: `transient`** - all deployments created by this action are `transient` by default, with removals handled by `override`, `auto_inactive`, or `step: deactivate-env`. 277 | - **ADDED: `step: delete-env`** deletes an environment entirely. 278 | 279 | Then you can change your workflow to target the `v1` tag, and automatically receive updates going forward: 280 | 281 | ```diff 282 | - uses: bobheadxi/deployments@v0.6.2 283 | + uses: bobheadxi/deployments@v1 284 | ``` 285 | 286 | ## Migrating to v1.2.0 287 | 288 | The `token` configuration variable now has a default value so if you are happy with the default (`${{ github.secret }}`) you can simplify the action configuration by removing this from your actions. 289 | 290 |
291 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: GitHub Deployments 2 | description: GitHub action for working painlessly with deployment statuses. 3 | author: bobheadxi 4 | branding: 5 | icon: bookmark 6 | color: yellow 7 | runs: 8 | using: node20 9 | main: dist/index.js 10 | 11 | inputs: 12 | step: 13 | required: true 14 | description: One of 'start', 'finish', 'deactivate-env', or 'delete-env' 15 | token: 16 | required: true 17 | description: GitHub access token 18 | default: ${{ github.token }} 19 | env: 20 | required: true 21 | description: The name of the deployment environment in GitHub to create statuses in. 22 | repository: 23 | required: false 24 | description: Set status for a different repository, using the format `$owner/$repository` (optional, defaults to the current repository) 25 | logs: 26 | required: false 27 | description: URL to logs 28 | desc: 29 | required: false 30 | description: Description to set in status 31 | ref: 32 | required: false 33 | description: The git ref to use for the deploy, defaults to `github.ref` 34 | task: 35 | required: false 36 | description: The task to assign to the deployment, defaults to 'deploy' 37 | 38 | debug: 39 | required: false 40 | description: Print arguments used by this action and other debug information. 41 | default: 'false' 42 | 43 | deployment_id: 44 | required: false 45 | description: The deployment ID to update (if specified during `start`, the deployment will be updated instead of creating a new one) 46 | env_url: 47 | required: false 48 | description: The environment URL (for `finish` only) 49 | status: 50 | required: false 51 | description: The deployment status (for `finish` only) 52 | override: 53 | required: false 54 | description: Whether to manually mark existing deployments of this environment as inactive (for `start` and `finish` only) 55 | auto_inactive: 56 | required: false 57 | description: Whether to mark existing deployments as inactive if a deployment succeeds (for `finish` only) 58 | default: 'false' 59 | payload: 60 | required: false 61 | description: JSON-formatted dictionary with extra information about the deployment (for `start` only) 62 | -------------------------------------------------------------------------------- /dist/LICENSES: -------------------------------------------------------------------------------- 1 | @actions/core 2 | MIT 3 | The MIT License (MIT) 4 | 5 | Copyright 2019 GitHub 6 | 7 | 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: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | 11 | 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. 12 | 13 | @actions/github 14 | MIT 15 | The MIT License (MIT) 16 | 17 | Copyright 2019 GitHub 18 | 19 | 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: 20 | 21 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 22 | 23 | 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. 24 | 25 | @actions/http-client 26 | MIT 27 | Actions Http Client for Node.js 28 | 29 | Copyright (c) GitHub, Inc. 30 | 31 | All rights reserved. 32 | 33 | MIT License 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 36 | associated documentation files (the "Software"), to deal in the Software without restriction, 37 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 38 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 39 | subject to the following conditions: 40 | 41 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 42 | 43 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 44 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 45 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 46 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 47 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 48 | 49 | 50 | @octokit/auth-token 51 | MIT 52 | The MIT License 53 | 54 | Copyright (c) 2019 Octokit contributors 55 | 56 | Permission is hereby granted, free of charge, to any person obtaining a copy 57 | of this software and associated documentation files (the "Software"), to deal 58 | in the Software without restriction, including without limitation the rights 59 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 60 | copies of the Software, and to permit persons to whom the Software is 61 | furnished to do so, subject to the following conditions: 62 | 63 | The above copyright notice and this permission notice shall be included in 64 | all copies or substantial portions of the Software. 65 | 66 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 67 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 68 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 69 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 70 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 71 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 72 | THE SOFTWARE. 73 | 74 | 75 | @octokit/core 76 | MIT 77 | The MIT License 78 | 79 | Copyright (c) 2019 Octokit contributors 80 | 81 | Permission is hereby granted, free of charge, to any person obtaining a copy 82 | of this software and associated documentation files (the "Software"), to deal 83 | in the Software without restriction, including without limitation the rights 84 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 85 | copies of the Software, and to permit persons to whom the Software is 86 | furnished to do so, subject to the following conditions: 87 | 88 | The above copyright notice and this permission notice shall be included in 89 | all copies or substantial portions of the Software. 90 | 91 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 92 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 93 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 94 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 95 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 96 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 97 | THE SOFTWARE. 98 | 99 | 100 | @octokit/endpoint 101 | MIT 102 | The MIT License 103 | 104 | Copyright (c) 2018 Octokit contributors 105 | 106 | Permission is hereby granted, free of charge, to any person obtaining a copy 107 | of this software and associated documentation files (the "Software"), to deal 108 | in the Software without restriction, including without limitation the rights 109 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 110 | copies of the Software, and to permit persons to whom the Software is 111 | furnished to do so, subject to the following conditions: 112 | 113 | The above copyright notice and this permission notice shall be included in 114 | all copies or substantial portions of the Software. 115 | 116 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 117 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 118 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 119 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 120 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 121 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 122 | THE SOFTWARE. 123 | 124 | 125 | @octokit/graphql 126 | MIT 127 | The MIT License 128 | 129 | Copyright (c) 2018 Octokit contributors 130 | 131 | Permission is hereby granted, free of charge, to any person obtaining a copy 132 | of this software and associated documentation files (the "Software"), to deal 133 | in the Software without restriction, including without limitation the rights 134 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 135 | copies of the Software, and to permit persons to whom the Software is 136 | furnished to do so, subject to the following conditions: 137 | 138 | The above copyright notice and this permission notice shall be included in 139 | all copies or substantial portions of the Software. 140 | 141 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 142 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 143 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 144 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 145 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 146 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 147 | THE SOFTWARE. 148 | 149 | 150 | @octokit/plugin-paginate-rest 151 | MIT 152 | MIT License Copyright (c) 2019 Octokit contributors 153 | 154 | 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: 155 | 156 | The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. 157 | 158 | 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. 159 | 160 | 161 | @octokit/plugin-rest-endpoint-methods 162 | MIT 163 | MIT License Copyright (c) 2019 Octokit contributors 164 | 165 | 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: 166 | 167 | The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. 168 | 169 | 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. 170 | 171 | 172 | @octokit/request 173 | MIT 174 | The MIT License 175 | 176 | Copyright (c) 2018 Octokit contributors 177 | 178 | Permission is hereby granted, free of charge, to any person obtaining a copy 179 | of this software and associated documentation files (the "Software"), to deal 180 | in the Software without restriction, including without limitation the rights 181 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 182 | copies of the Software, and to permit persons to whom the Software is 183 | furnished to do so, subject to the following conditions: 184 | 185 | The above copyright notice and this permission notice shall be included in 186 | all copies or substantial portions of the Software. 187 | 188 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 189 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 190 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 191 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 192 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 193 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 194 | THE SOFTWARE. 195 | 196 | 197 | @octokit/request-error 198 | MIT 199 | The MIT License 200 | 201 | Copyright (c) 2019 Octokit contributors 202 | 203 | Permission is hereby granted, free of charge, to any person obtaining a copy 204 | of this software and associated documentation files (the "Software"), to deal 205 | in the Software without restriction, including without limitation the rights 206 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 207 | copies of the Software, and to permit persons to whom the Software is 208 | furnished to do so, subject to the following conditions: 209 | 210 | The above copyright notice and this permission notice shall be included in 211 | all copies or substantial portions of the Software. 212 | 213 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 214 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 215 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 216 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 217 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 218 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 219 | THE SOFTWARE. 220 | 221 | 222 | @vercel/ncc 223 | MIT 224 | Copyright 2018 ZEIT, Inc. 225 | 226 | 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: 227 | 228 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 229 | 230 | 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. 231 | 232 | before-after-hook 233 | Apache-2.0 234 | Apache License 235 | Version 2.0, January 2004 236 | http://www.apache.org/licenses/ 237 | 238 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 239 | 240 | 1. Definitions. 241 | 242 | "License" shall mean the terms and conditions for use, reproduction, 243 | and distribution as defined by Sections 1 through 9 of this document. 244 | 245 | "Licensor" shall mean the copyright owner or entity authorized by 246 | the copyright owner that is granting the License. 247 | 248 | "Legal Entity" shall mean the union of the acting entity and all 249 | other entities that control, are controlled by, or are under common 250 | control with that entity. For the purposes of this definition, 251 | "control" means (i) the power, direct or indirect, to cause the 252 | direction or management of such entity, whether by contract or 253 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 254 | outstanding shares, or (iii) beneficial ownership of such entity. 255 | 256 | "You" (or "Your") shall mean an individual or Legal Entity 257 | exercising permissions granted by this License. 258 | 259 | "Source" form shall mean the preferred form for making modifications, 260 | including but not limited to software source code, documentation 261 | source, and configuration files. 262 | 263 | "Object" form shall mean any form resulting from mechanical 264 | transformation or translation of a Source form, including but 265 | not limited to compiled object code, generated documentation, 266 | and conversions to other media types. 267 | 268 | "Work" shall mean the work of authorship, whether in Source or 269 | Object form, made available under the License, as indicated by a 270 | copyright notice that is included in or attached to the work 271 | (an example is provided in the Appendix below). 272 | 273 | "Derivative Works" shall mean any work, whether in Source or Object 274 | form, that is based on (or derived from) the Work and for which the 275 | editorial revisions, annotations, elaborations, or other modifications 276 | represent, as a whole, an original work of authorship. For the purposes 277 | of this License, Derivative Works shall not include works that remain 278 | separable from, or merely link (or bind by name) to the interfaces of, 279 | the Work and Derivative Works thereof. 280 | 281 | "Contribution" shall mean any work of authorship, including 282 | the original version of the Work and any modifications or additions 283 | to that Work or Derivative Works thereof, that is intentionally 284 | submitted to Licensor for inclusion in the Work by the copyright owner 285 | or by an individual or Legal Entity authorized to submit on behalf of 286 | the copyright owner. For the purposes of this definition, "submitted" 287 | means any form of electronic, verbal, or written communication sent 288 | to the Licensor or its representatives, including but not limited to 289 | communication on electronic mailing lists, source code control systems, 290 | and issue tracking systems that are managed by, or on behalf of, the 291 | Licensor for the purpose of discussing and improving the Work, but 292 | excluding communication that is conspicuously marked or otherwise 293 | designated in writing by the copyright owner as "Not a Contribution." 294 | 295 | "Contributor" shall mean Licensor and any individual or Legal Entity 296 | on behalf of whom a Contribution has been received by Licensor and 297 | subsequently incorporated within the Work. 298 | 299 | 2. Grant of Copyright License. Subject to the terms and conditions of 300 | this License, each Contributor hereby grants to You a perpetual, 301 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 302 | copyright license to reproduce, prepare Derivative Works of, 303 | publicly display, publicly perform, sublicense, and distribute the 304 | Work and such Derivative Works in Source or Object form. 305 | 306 | 3. Grant of Patent License. Subject to the terms and conditions of 307 | this License, each Contributor hereby grants to You a perpetual, 308 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 309 | (except as stated in this section) patent license to make, have made, 310 | use, offer to sell, sell, import, and otherwise transfer the Work, 311 | where such license applies only to those patent claims licensable 312 | by such Contributor that are necessarily infringed by their 313 | Contribution(s) alone or by combination of their Contribution(s) 314 | with the Work to which such Contribution(s) was submitted. If You 315 | institute patent litigation against any entity (including a 316 | cross-claim or counterclaim in a lawsuit) alleging that the Work 317 | or a Contribution incorporated within the Work constitutes direct 318 | or contributory patent infringement, then any patent licenses 319 | granted to You under this License for that Work shall terminate 320 | as of the date such litigation is filed. 321 | 322 | 4. Redistribution. You may reproduce and distribute copies of the 323 | Work or Derivative Works thereof in any medium, with or without 324 | modifications, and in Source or Object form, provided that You 325 | meet the following conditions: 326 | 327 | (a) You must give any other recipients of the Work or 328 | Derivative Works a copy of this License; and 329 | 330 | (b) You must cause any modified files to carry prominent notices 331 | stating that You changed the files; and 332 | 333 | (c) You must retain, in the Source form of any Derivative Works 334 | that You distribute, all copyright, patent, trademark, and 335 | attribution notices from the Source form of the Work, 336 | excluding those notices that do not pertain to any part of 337 | the Derivative Works; and 338 | 339 | (d) If the Work includes a "NOTICE" text file as part of its 340 | distribution, then any Derivative Works that You distribute must 341 | include a readable copy of the attribution notices contained 342 | within such NOTICE file, excluding those notices that do not 343 | pertain to any part of the Derivative Works, in at least one 344 | of the following places: within a NOTICE text file distributed 345 | as part of the Derivative Works; within the Source form or 346 | documentation, if provided along with the Derivative Works; or, 347 | within a display generated by the Derivative Works, if and 348 | wherever such third-party notices normally appear. The contents 349 | of the NOTICE file are for informational purposes only and 350 | do not modify the License. You may add Your own attribution 351 | notices within Derivative Works that You distribute, alongside 352 | or as an addendum to the NOTICE text from the Work, provided 353 | that such additional attribution notices cannot be construed 354 | as modifying the License. 355 | 356 | You may add Your own copyright statement to Your modifications and 357 | may provide additional or different license terms and conditions 358 | for use, reproduction, or distribution of Your modifications, or 359 | for any such Derivative Works as a whole, provided Your use, 360 | reproduction, and distribution of the Work otherwise complies with 361 | the conditions stated in this License. 362 | 363 | 5. Submission of Contributions. Unless You explicitly state otherwise, 364 | any Contribution intentionally submitted for inclusion in the Work 365 | by You to the Licensor shall be under the terms and conditions of 366 | this License, without any additional terms or conditions. 367 | Notwithstanding the above, nothing herein shall supersede or modify 368 | the terms of any separate license agreement you may have executed 369 | with Licensor regarding such Contributions. 370 | 371 | 6. Trademarks. This License does not grant permission to use the trade 372 | names, trademarks, service marks, or product names of the Licensor, 373 | except as required for reasonable and customary use in describing the 374 | origin of the Work and reproducing the content of the NOTICE file. 375 | 376 | 7. Disclaimer of Warranty. Unless required by applicable law or 377 | agreed to in writing, Licensor provides the Work (and each 378 | Contributor provides its Contributions) on an "AS IS" BASIS, 379 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 380 | implied, including, without limitation, any warranties or conditions 381 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 382 | PARTICULAR PURPOSE. You are solely responsible for determining the 383 | appropriateness of using or redistributing the Work and assume any 384 | risks associated with Your exercise of permissions under this License. 385 | 386 | 8. Limitation of Liability. In no event and under no legal theory, 387 | whether in tort (including negligence), contract, or otherwise, 388 | unless required by applicable law (such as deliberate and grossly 389 | negligent acts) or agreed to in writing, shall any Contributor be 390 | liable to You for damages, including any direct, indirect, special, 391 | incidental, or consequential damages of any character arising as a 392 | result of this License or out of the use or inability to use the 393 | Work (including but not limited to damages for loss of goodwill, 394 | work stoppage, computer failure or malfunction, or any and all 395 | other commercial damages or losses), even if such Contributor 396 | has been advised of the possibility of such damages. 397 | 398 | 9. Accepting Warranty or Additional Liability. While redistributing 399 | the Work or Derivative Works thereof, You may choose to offer, 400 | and charge a fee for, acceptance of support, warranty, indemnity, 401 | or other liability obligations and/or rights consistent with this 402 | License. However, in accepting such obligations, You may act only 403 | on Your own behalf and on Your sole responsibility, not on behalf 404 | of any other Contributor, and only if You agree to indemnify, 405 | defend, and hold each Contributor harmless for any liability 406 | incurred by, or claims asserted against, such Contributor by reason 407 | of your accepting any such warranty or additional liability. 408 | 409 | END OF TERMS AND CONDITIONS 410 | 411 | APPENDIX: How to apply the Apache License to your work. 412 | 413 | To apply the Apache License to your work, attach the following 414 | boilerplate notice, with the fields enclosed by brackets "{}" 415 | replaced with your own identifying information. (Don't include 416 | the brackets!) The text should be enclosed in the appropriate 417 | comment syntax for the file format. We also recommend that a 418 | file or class name and description of purpose be included on the 419 | same "printed page" as the copyright notice for easier 420 | identification within third-party archives. 421 | 422 | Copyright 2018 Gregor Martynus and other contributors. 423 | 424 | Licensed under the Apache License, Version 2.0 (the "License"); 425 | you may not use this file except in compliance with the License. 426 | You may obtain a copy of the License at 427 | 428 | http://www.apache.org/licenses/LICENSE-2.0 429 | 430 | Unless required by applicable law or agreed to in writing, software 431 | distributed under the License is distributed on an "AS IS" BASIS, 432 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 433 | See the License for the specific language governing permissions and 434 | limitations under the License. 435 | 436 | 437 | deprecation 438 | ISC 439 | The ISC License 440 | 441 | Copyright (c) Gregor Martynus and contributors 442 | 443 | Permission to use, copy, modify, and/or distribute this software for any 444 | purpose with or without fee is hereby granted, provided that the above 445 | copyright notice and this permission notice appear in all copies. 446 | 447 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 448 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 449 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 450 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 451 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 452 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 453 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 454 | 455 | 456 | is-plain-object 457 | MIT 458 | The MIT License (MIT) 459 | 460 | Copyright (c) 2014-2017, Jon Schlinkert. 461 | 462 | Permission is hereby granted, free of charge, to any person obtaining a copy 463 | of this software and associated documentation files (the "Software"), to deal 464 | in the Software without restriction, including without limitation the rights 465 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 466 | copies of the Software, and to permit persons to whom the Software is 467 | furnished to do so, subject to the following conditions: 468 | 469 | The above copyright notice and this permission notice shall be included in 470 | all copies or substantial portions of the Software. 471 | 472 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 473 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 474 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 475 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 476 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 477 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 478 | THE SOFTWARE. 479 | 480 | 481 | node-fetch 482 | MIT 483 | The MIT License (MIT) 484 | 485 | Copyright (c) 2016 David Frank 486 | 487 | Permission is hereby granted, free of charge, to any person obtaining a copy 488 | of this software and associated documentation files (the "Software"), to deal 489 | in the Software without restriction, including without limitation the rights 490 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 491 | copies of the Software, and to permit persons to whom the Software is 492 | furnished to do so, subject to the following conditions: 493 | 494 | The above copyright notice and this permission notice shall be included in all 495 | copies or substantial portions of the Software. 496 | 497 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 498 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 499 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 500 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 501 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 502 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 503 | SOFTWARE. 504 | 505 | 506 | 507 | once 508 | ISC 509 | The ISC License 510 | 511 | Copyright (c) Isaac Z. Schlueter and Contributors 512 | 513 | Permission to use, copy, modify, and/or distribute this software for any 514 | purpose with or without fee is hereby granted, provided that the above 515 | copyright notice and this permission notice appear in all copies. 516 | 517 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 518 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 519 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 520 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 521 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 522 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 523 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 524 | 525 | 526 | tr46 527 | MIT 528 | 529 | tunnel 530 | MIT 531 | The MIT License (MIT) 532 | 533 | Copyright (c) 2012 Koichi Kobayashi 534 | 535 | Permission is hereby granted, free of charge, to any person obtaining a copy 536 | of this software and associated documentation files (the "Software"), to deal 537 | in the Software without restriction, including without limitation the rights 538 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 539 | copies of the Software, and to permit persons to whom the Software is 540 | furnished to do so, subject to the following conditions: 541 | 542 | The above copyright notice and this permission notice shall be included in 543 | all copies or substantial portions of the Software. 544 | 545 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 546 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 547 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 548 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 549 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 550 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 551 | THE SOFTWARE. 552 | 553 | 554 | universal-user-agent 555 | ISC 556 | # [ISC License](https://spdx.org/licenses/ISC) 557 | 558 | Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m) 559 | 560 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 561 | 562 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 563 | 564 | 565 | uuid 566 | MIT 567 | The MIT License (MIT) 568 | 569 | Copyright (c) 2010-2020 Robert Kieffer and other contributors 570 | 571 | 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: 572 | 573 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 574 | 575 | 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. 576 | 577 | 578 | webidl-conversions 579 | BSD-2-Clause 580 | # The BSD 2-Clause License 581 | 582 | Copyright (c) 2014, Domenic Denicola 583 | All rights reserved. 584 | 585 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 586 | 587 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 588 | 589 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 590 | 591 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 592 | 593 | 594 | whatwg-url 595 | MIT 596 | The MIT License (MIT) 597 | 598 | Copyright (c) 2015–2016 Sebastian Mayr 599 | 600 | Permission is hereby granted, free of charge, to any person obtaining a copy 601 | of this software and associated documentation files (the "Software"), to deal 602 | in the Software without restriction, including without limitation the rights 603 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 604 | copies of the Software, and to permit persons to whom the Software is 605 | furnished to do so, subject to the following conditions: 606 | 607 | The above copyright notice and this permission notice shall be included in 608 | all copies or substantial portions of the Software. 609 | 610 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 611 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 612 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 613 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 614 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 615 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 616 | THE SOFTWARE. 617 | 618 | 619 | wrappy 620 | ISC 621 | The ISC License 622 | 623 | Copyright (c) Isaac Z. Schlueter and Contributors 624 | 625 | Permission to use, copy, modify, and/or distribute this software for any 626 | purpose with or without fee is hereby granted, provided that the above 627 | copyright notice and this permission notice appear in all copies. 628 | 629 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 630 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 631 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 632 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 633 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 634 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 635 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 636 | -------------------------------------------------------------------------------- /dist/sourcemap-register.js: -------------------------------------------------------------------------------- 1 | (()=>{var e={650:e=>{var r=Object.prototype.toString;var n=typeof Buffer.alloc==="function"&&typeof Buffer.allocUnsafe==="function"&&typeof Buffer.from==="function";function isArrayBuffer(e){return r.call(e).slice(8,-1)==="ArrayBuffer"}function fromArrayBuffer(e,r,t){r>>>=0;var o=e.byteLength-r;if(o<0){throw new RangeError("'offset' is out of bounds")}if(t===undefined){t=o}else{t>>>=0;if(t>o){throw new RangeError("'length' is out of bounds")}}return n?Buffer.from(e.slice(r,r+t)):new Buffer(new Uint8Array(e.slice(r,r+t)))}function fromString(e,r){if(typeof r!=="string"||r===""){r="utf8"}if(!Buffer.isEncoding(r)){throw new TypeError('"encoding" must be a valid string encoding')}return n?Buffer.from(e,r):new Buffer(e,r)}function bufferFrom(e,r,t){if(typeof e==="number"){throw new TypeError('"value" argument must not be a number')}if(isArrayBuffer(e)){return fromArrayBuffer(e,r,t)}if(typeof e==="string"){return fromString(e,r)}return n?Buffer.from(e):new Buffer(e)}e.exports=bufferFrom},274:(e,r,n)=>{var t=n(339);var o=Object.prototype.hasOwnProperty;var i=typeof Map!=="undefined";function ArraySet(){this._array=[];this._set=i?new Map:Object.create(null)}ArraySet.fromArray=function ArraySet_fromArray(e,r){var n=new ArraySet;for(var t=0,o=e.length;t=0){return r}}else{var n=t.toSetString(e);if(o.call(this._set,n)){return this._set[n]}}throw new Error('"'+e+'" is not in the set.')};ArraySet.prototype.at=function ArraySet_at(e){if(e>=0&&e{var t=n(190);var o=5;var i=1<>1;return r?-n:n}r.encode=function base64VLQ_encode(e){var r="";var n;var i=toVLQSigned(e);do{n=i&a;i>>>=o;if(i>0){n|=u}r+=t.encode(n)}while(i>0);return r};r.decode=function base64VLQ_decode(e,r,n){var i=e.length;var s=0;var l=0;var c,p;do{if(r>=i){throw new Error("Expected more digits in base 64 VLQ value.")}p=t.decode(e.charCodeAt(r++));if(p===-1){throw new Error("Invalid base64 digit: "+e.charAt(r-1))}c=!!(p&u);p&=a;s=s+(p<{var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");r.encode=function(e){if(0<=e&&e{r.GREATEST_LOWER_BOUND=1;r.LEAST_UPPER_BOUND=2;function recursiveSearch(e,n,t,o,i,a){var u=Math.floor((n-e)/2)+e;var s=i(t,o[u],true);if(s===0){return u}else if(s>0){if(n-u>1){return recursiveSearch(u,n,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){return n1){return recursiveSearch(e,u,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){return u}else{return e<0?-1:e}}}r.search=function search(e,n,t,o){if(n.length===0){return-1}var i=recursiveSearch(-1,n.length,e,n,t,o||r.GREATEST_LOWER_BOUND);if(i<0){return-1}while(i-1>=0){if(t(n[i],n[i-1],true)!==0){break}--i}return i}},680:(e,r,n)=>{var t=n(339);function generatedPositionAfter(e,r){var n=e.generatedLine;var o=r.generatedLine;var i=e.generatedColumn;var a=r.generatedColumn;return o>n||o==n&&a>=i||t.compareByGeneratedPositionsInflated(e,r)<=0}function MappingList(){this._array=[];this._sorted=true;this._last={generatedLine:-1,generatedColumn:0}}MappingList.prototype.unsortedForEach=function MappingList_forEach(e,r){this._array.forEach(e,r)};MappingList.prototype.add=function MappingList_add(e){if(generatedPositionAfter(this._last,e)){this._last=e;this._array.push(e)}else{this._sorted=false;this._array.push(e)}};MappingList.prototype.toArray=function MappingList_toArray(){if(!this._sorted){this._array.sort(t.compareByGeneratedPositionsInflated);this._sorted=true}return this._array};r.H=MappingList},758:(e,r)=>{function swap(e,r,n){var t=e[r];e[r]=e[n];e[n]=t}function randomIntInRange(e,r){return Math.round(e+Math.random()*(r-e))}function doQuickSort(e,r,n,t){if(n{var t;var o=n(339);var i=n(345);var a=n(274).I;var u=n(449);var s=n(758).U;function SourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}return n.sections!=null?new IndexedSourceMapConsumer(n,r):new BasicSourceMapConsumer(n,r)}SourceMapConsumer.fromSourceMap=function(e,r){return BasicSourceMapConsumer.fromSourceMap(e,r)};SourceMapConsumer.prototype._version=3;SourceMapConsumer.prototype.__generatedMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_generatedMappings",{configurable:true,enumerable:true,get:function(){if(!this.__generatedMappings){this._parseMappings(this._mappings,this.sourceRoot)}return this.__generatedMappings}});SourceMapConsumer.prototype.__originalMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_originalMappings",{configurable:true,enumerable:true,get:function(){if(!this.__originalMappings){this._parseMappings(this._mappings,this.sourceRoot)}return this.__originalMappings}});SourceMapConsumer.prototype._charIsMappingSeparator=function SourceMapConsumer_charIsMappingSeparator(e,r){var n=e.charAt(r);return n===";"||n===","};SourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(e,r){throw new Error("Subclasses must implement _parseMappings")};SourceMapConsumer.GENERATED_ORDER=1;SourceMapConsumer.ORIGINAL_ORDER=2;SourceMapConsumer.GREATEST_LOWER_BOUND=1;SourceMapConsumer.LEAST_UPPER_BOUND=2;SourceMapConsumer.prototype.eachMapping=function SourceMapConsumer_eachMapping(e,r,n){var t=r||null;var i=n||SourceMapConsumer.GENERATED_ORDER;var a;switch(i){case SourceMapConsumer.GENERATED_ORDER:a=this._generatedMappings;break;case SourceMapConsumer.ORIGINAL_ORDER:a=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var u=this.sourceRoot;a.map((function(e){var r=e.source===null?null:this._sources.at(e.source);r=o.computeSourceURL(u,r,this._sourceMapURL);return{source:r,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:e.name===null?null:this._names.at(e.name)}}),this).forEach(e,t)};SourceMapConsumer.prototype.allGeneratedPositionsFor=function SourceMapConsumer_allGeneratedPositionsFor(e){var r=o.getArg(e,"line");var n={source:o.getArg(e,"source"),originalLine:r,originalColumn:o.getArg(e,"column",0)};n.source=this._findSourceIndex(n.source);if(n.source<0){return[]}var t=[];var a=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,i.LEAST_UPPER_BOUND);if(a>=0){var u=this._originalMappings[a];if(e.column===undefined){var s=u.originalLine;while(u&&u.originalLine===s){t.push({line:o.getArg(u,"generatedLine",null),column:o.getArg(u,"generatedColumn",null),lastColumn:o.getArg(u,"lastGeneratedColumn",null)});u=this._originalMappings[++a]}}else{var l=u.originalColumn;while(u&&u.originalLine===r&&u.originalColumn==l){t.push({line:o.getArg(u,"generatedLine",null),column:o.getArg(u,"generatedColumn",null),lastColumn:o.getArg(u,"lastGeneratedColumn",null)});u=this._originalMappings[++a]}}}return t};r.SourceMapConsumer=SourceMapConsumer;function BasicSourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}var t=o.getArg(n,"version");var i=o.getArg(n,"sources");var u=o.getArg(n,"names",[]);var s=o.getArg(n,"sourceRoot",null);var l=o.getArg(n,"sourcesContent",null);var c=o.getArg(n,"mappings");var p=o.getArg(n,"file",null);if(t!=this._version){throw new Error("Unsupported version: "+t)}if(s){s=o.normalize(s)}i=i.map(String).map(o.normalize).map((function(e){return s&&o.isAbsolute(s)&&o.isAbsolute(e)?o.relative(s,e):e}));this._names=a.fromArray(u.map(String),true);this._sources=a.fromArray(i,true);this._absoluteSources=this._sources.toArray().map((function(e){return o.computeSourceURL(s,e,r)}));this.sourceRoot=s;this.sourcesContent=l;this._mappings=c;this._sourceMapURL=r;this.file=p}BasicSourceMapConsumer.prototype=Object.create(SourceMapConsumer.prototype);BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer;BasicSourceMapConsumer.prototype._findSourceIndex=function(e){var r=e;if(this.sourceRoot!=null){r=o.relative(this.sourceRoot,r)}if(this._sources.has(r)){return this._sources.indexOf(r)}var n;for(n=0;n1){v.source=l+_[1];l+=_[1];v.originalLine=i+_[2];i=v.originalLine;v.originalLine+=1;v.originalColumn=a+_[3];a=v.originalColumn;if(_.length>4){v.name=c+_[4];c+=_[4]}}m.push(v);if(typeof v.originalLine==="number"){d.push(v)}}}s(m,o.compareByGeneratedPositionsDeflated);this.__generatedMappings=m;s(d,o.compareByOriginalPositions);this.__originalMappings=d};BasicSourceMapConsumer.prototype._findMapping=function SourceMapConsumer_findMapping(e,r,n,t,o,a){if(e[n]<=0){throw new TypeError("Line must be greater than or equal to 1, got "+e[n])}if(e[t]<0){throw new TypeError("Column must be greater than or equal to 0, got "+e[t])}return i.search(e,r,o,a)};BasicSourceMapConsumer.prototype.computeColumnSpans=function SourceMapConsumer_computeColumnSpans(){for(var e=0;e=0){var t=this._generatedMappings[n];if(t.generatedLine===r.generatedLine){var i=o.getArg(t,"source",null);if(i!==null){i=this._sources.at(i);i=o.computeSourceURL(this.sourceRoot,i,this._sourceMapURL)}var a=o.getArg(t,"name",null);if(a!==null){a=this._names.at(a)}return{source:i,line:o.getArg(t,"originalLine",null),column:o.getArg(t,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}};BasicSourceMapConsumer.prototype.hasContentsOfAllSources=function BasicSourceMapConsumer_hasContentsOfAllSources(){if(!this.sourcesContent){return false}return this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return e==null}))};BasicSourceMapConsumer.prototype.sourceContentFor=function SourceMapConsumer_sourceContentFor(e,r){if(!this.sourcesContent){return null}var n=this._findSourceIndex(e);if(n>=0){return this.sourcesContent[n]}var t=e;if(this.sourceRoot!=null){t=o.relative(this.sourceRoot,t)}var i;if(this.sourceRoot!=null&&(i=o.urlParse(this.sourceRoot))){var a=t.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(a)){return this.sourcesContent[this._sources.indexOf(a)]}if((!i.path||i.path=="/")&&this._sources.has("/"+t)){return this.sourcesContent[this._sources.indexOf("/"+t)]}}if(r){return null}else{throw new Error('"'+t+'" is not in the SourceMap.')}};BasicSourceMapConsumer.prototype.generatedPositionFor=function SourceMapConsumer_generatedPositionFor(e){var r=o.getArg(e,"source");r=this._findSourceIndex(r);if(r<0){return{line:null,column:null,lastColumn:null}}var n={source:r,originalLine:o.getArg(e,"line"),originalColumn:o.getArg(e,"column")};var t=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,o.getArg(e,"bias",SourceMapConsumer.GREATEST_LOWER_BOUND));if(t>=0){var i=this._originalMappings[t];if(i.source===n.source){return{line:o.getArg(i,"generatedLine",null),column:o.getArg(i,"generatedColumn",null),lastColumn:o.getArg(i,"lastGeneratedColumn",null)}}}return{line:null,column:null,lastColumn:null}};t=BasicSourceMapConsumer;function IndexedSourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}var t=o.getArg(n,"version");var i=o.getArg(n,"sections");if(t!=this._version){throw new Error("Unsupported version: "+t)}this._sources=new a;this._names=new a;var u={line:-1,column:0};this._sections=i.map((function(e){if(e.url){throw new Error("Support for url field in sections not implemented.")}var n=o.getArg(e,"offset");var t=o.getArg(n,"line");var i=o.getArg(n,"column");if(t{var t=n(449);var o=n(339);var i=n(274).I;var a=n(680).H;function SourceMapGenerator(e){if(!e){e={}}this._file=o.getArg(e,"file",null);this._sourceRoot=o.getArg(e,"sourceRoot",null);this._skipValidation=o.getArg(e,"skipValidation",false);this._sources=new i;this._names=new i;this._mappings=new a;this._sourcesContents=null}SourceMapGenerator.prototype._version=3;SourceMapGenerator.fromSourceMap=function SourceMapGenerator_fromSourceMap(e){var r=e.sourceRoot;var n=new SourceMapGenerator({file:e.file,sourceRoot:r});e.eachMapping((function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};if(e.source!=null){t.source=e.source;if(r!=null){t.source=o.relative(r,t.source)}t.original={line:e.originalLine,column:e.originalColumn};if(e.name!=null){t.name=e.name}}n.addMapping(t)}));e.sources.forEach((function(t){var i=t;if(r!==null){i=o.relative(r,t)}if(!n._sources.has(i)){n._sources.add(i)}var a=e.sourceContentFor(t);if(a!=null){n.setSourceContent(t,a)}}));return n};SourceMapGenerator.prototype.addMapping=function SourceMapGenerator_addMapping(e){var r=o.getArg(e,"generated");var n=o.getArg(e,"original",null);var t=o.getArg(e,"source",null);var i=o.getArg(e,"name",null);if(!this._skipValidation){this._validateMapping(r,n,t,i)}if(t!=null){t=String(t);if(!this._sources.has(t)){this._sources.add(t)}}if(i!=null){i=String(i);if(!this._names.has(i)){this._names.add(i)}}this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:t,name:i})};SourceMapGenerator.prototype.setSourceContent=function SourceMapGenerator_setSourceContent(e,r){var n=e;if(this._sourceRoot!=null){n=o.relative(this._sourceRoot,n)}if(r!=null){if(!this._sourcesContents){this._sourcesContents=Object.create(null)}this._sourcesContents[o.toSetString(n)]=r}else if(this._sourcesContents){delete this._sourcesContents[o.toSetString(n)];if(Object.keys(this._sourcesContents).length===0){this._sourcesContents=null}}};SourceMapGenerator.prototype.applySourceMap=function SourceMapGenerator_applySourceMap(e,r,n){var t=r;if(r==null){if(e.file==null){throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, "+'or the source map\'s "file" property. Both were omitted.')}t=e.file}var a=this._sourceRoot;if(a!=null){t=o.relative(a,t)}var u=new i;var s=new i;this._mappings.unsortedForEach((function(r){if(r.source===t&&r.originalLine!=null){var i=e.originalPositionFor({line:r.originalLine,column:r.originalColumn});if(i.source!=null){r.source=i.source;if(n!=null){r.source=o.join(n,r.source)}if(a!=null){r.source=o.relative(a,r.source)}r.originalLine=i.line;r.originalColumn=i.column;if(i.name!=null){r.name=i.name}}}var l=r.source;if(l!=null&&!u.has(l)){u.add(l)}var c=r.name;if(c!=null&&!s.has(c)){s.add(c)}}),this);this._sources=u;this._names=s;e.sources.forEach((function(r){var t=e.sourceContentFor(r);if(t!=null){if(n!=null){r=o.join(n,r)}if(a!=null){r=o.relative(a,r)}this.setSourceContent(r,t)}}),this)};SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(e,r,n,t){if(r&&typeof r.line!=="number"&&typeof r.column!=="number"){throw new Error("original.line and original.column are not numbers -- you probably meant to omit "+"the original mapping entirely and only map the generated position. If so, pass "+"null for the original mapping instead of an object with empty or null values.")}if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!r&&!n&&!t){return}else if(e&&"line"in e&&"column"in e&&r&&"line"in r&&"column"in r&&e.line>0&&e.column>=0&&r.line>0&&r.column>=0&&n){return}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:r,name:t}))}};SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){var e=0;var r=1;var n=0;var i=0;var a=0;var u=0;var s="";var l;var c;var p;var f;var g=this._mappings.toArray();for(var h=0,d=g.length;h0){if(!o.compareByGeneratedPositionsInflated(c,g[h-1])){continue}l+=","}}l+=t.encode(c.generatedColumn-e);e=c.generatedColumn;if(c.source!=null){f=this._sources.indexOf(c.source);l+=t.encode(f-u);u=f;l+=t.encode(c.originalLine-1-i);i=c.originalLine-1;l+=t.encode(c.originalColumn-n);n=c.originalColumn;if(c.name!=null){p=this._names.indexOf(c.name);l+=t.encode(p-a);a=p}}s+=l}return s};SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(e,r){return e.map((function(e){if(!this._sourcesContents){return null}if(r!=null){e=o.relative(r,e)}var n=o.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null}),this)};SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){e.file=this._file}if(this._sourceRoot!=null){e.sourceRoot=this._sourceRoot}if(this._sourcesContents){e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)}return e};SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this.toJSON())};r.h=SourceMapGenerator},351:(e,r,n)=>{var t;var o=n(591).h;var i=n(339);var a=/(\r?\n)/;var u=10;var s="$$$isSourceNode$$$";function SourceNode(e,r,n,t,o){this.children=[];this.sourceContents={};this.line=e==null?null:e;this.column=r==null?null:r;this.source=n==null?null:n;this.name=o==null?null:o;this[s]=true;if(t!=null)this.add(t)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(e,r,n){var t=new SourceNode;var o=e.split(a);var u=0;var shiftNextLine=function(){var e=getNextLine();var r=getNextLine()||"";return e+r;function getNextLine(){return u=0;r--){this.prepend(e[r])}}else if(e[s]||typeof e==="string"){this.children.unshift(e)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e)}return this};SourceNode.prototype.walk=function SourceNode_walk(e){var r;for(var n=0,t=this.children.length;n0){r=[];for(n=0;n{function getArg(e,r,n){if(r in e){return e[r]}else if(arguments.length===3){return n}else{throw new Error('"'+r+'" is a required argument.')}}r.getArg=getArg;var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;var t=/^data:.+\,.+$/;function urlParse(e){var r=e.match(n);if(!r){return null}return{scheme:r[1],auth:r[2],host:r[3],port:r[4],path:r[5]}}r.urlParse=urlParse;function urlGenerate(e){var r="";if(e.scheme){r+=e.scheme+":"}r+="//";if(e.auth){r+=e.auth+"@"}if(e.host){r+=e.host}if(e.port){r+=":"+e.port}if(e.path){r+=e.path}return r}r.urlGenerate=urlGenerate;function normalize(e){var n=e;var t=urlParse(e);if(t){if(!t.path){return e}n=t.path}var o=r.isAbsolute(n);var i=n.split(/\/+/);for(var a,u=0,s=i.length-1;s>=0;s--){a=i[s];if(a==="."){i.splice(s,1)}else if(a===".."){u++}else if(u>0){if(a===""){i.splice(s+1,u);u=0}else{i.splice(s,2);u--}}}n=i.join("/");if(n===""){n=o?"/":"."}if(t){t.path=n;return urlGenerate(t)}return n}r.normalize=normalize;function join(e,r){if(e===""){e="."}if(r===""){r="."}var n=urlParse(r);var o=urlParse(e);if(o){e=o.path||"/"}if(n&&!n.scheme){if(o){n.scheme=o.scheme}return urlGenerate(n)}if(n||r.match(t)){return r}if(o&&!o.host&&!o.path){o.host=r;return urlGenerate(o)}var i=r.charAt(0)==="/"?r:normalize(e.replace(/\/+$/,"")+"/"+r);if(o){o.path=i;return urlGenerate(o)}return i}r.join=join;r.isAbsolute=function(e){return e.charAt(0)==="/"||n.test(e)};function relative(e,r){if(e===""){e="."}e=e.replace(/\/$/,"");var n=0;while(r.indexOf(e+"/")!==0){var t=e.lastIndexOf("/");if(t<0){return r}e=e.slice(0,t);if(e.match(/^([^\/]+:\/)?\/*$/)){return r}++n}return Array(n+1).join("../")+r.substr(e.length+1)}r.relative=relative;var o=function(){var e=Object.create(null);return!("__proto__"in e)}();function identity(e){return e}function toSetString(e){if(isProtoString(e)){return"$"+e}return e}r.toSetString=o?identity:toSetString;function fromSetString(e){if(isProtoString(e)){return e.slice(1)}return e}r.fromSetString=o?identity:fromSetString;function isProtoString(e){if(!e){return false}var r=e.length;if(r<9){return false}if(e.charCodeAt(r-1)!==95||e.charCodeAt(r-2)!==95||e.charCodeAt(r-3)!==111||e.charCodeAt(r-4)!==116||e.charCodeAt(r-5)!==111||e.charCodeAt(r-6)!==114||e.charCodeAt(r-7)!==112||e.charCodeAt(r-8)!==95||e.charCodeAt(r-9)!==95){return false}for(var n=r-10;n>=0;n--){if(e.charCodeAt(n)!==36){return false}}return true}function compareByOriginalPositions(e,r,n){var t=strcmp(e.source,r.source);if(t!==0){return t}t=e.originalLine-r.originalLine;if(t!==0){return t}t=e.originalColumn-r.originalColumn;if(t!==0||n){return t}t=e.generatedColumn-r.generatedColumn;if(t!==0){return t}t=e.generatedLine-r.generatedLine;if(t!==0){return t}return strcmp(e.name,r.name)}r.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositionsDeflated(e,r,n){var t=e.generatedLine-r.generatedLine;if(t!==0){return t}t=e.generatedColumn-r.generatedColumn;if(t!==0||n){return t}t=strcmp(e.source,r.source);if(t!==0){return t}t=e.originalLine-r.originalLine;if(t!==0){return t}t=e.originalColumn-r.originalColumn;if(t!==0){return t}return strcmp(e.name,r.name)}r.compareByGeneratedPositionsDeflated=compareByGeneratedPositionsDeflated;function strcmp(e,r){if(e===r){return 0}if(e===null){return 1}if(r===null){return-1}if(e>r){return 1}return-1}function compareByGeneratedPositionsInflated(e,r){var n=e.generatedLine-r.generatedLine;if(n!==0){return n}n=e.generatedColumn-r.generatedColumn;if(n!==0){return n}n=strcmp(e.source,r.source);if(n!==0){return n}n=e.originalLine-r.originalLine;if(n!==0){return n}n=e.originalColumn-r.originalColumn;if(n!==0){return n}return strcmp(e.name,r.name)}r.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}r.parseSourceMapInput=parseSourceMapInput;function computeSourceURL(e,r,n){r=r||"";if(e){if(e[e.length-1]!=="/"&&r[0]!=="/"){e+="/"}r=e+r}if(n){var t=urlParse(n);if(!t){throw new Error("sourceMapURL could not be parsed")}if(t.path){var o=t.path.lastIndexOf("/");if(o>=0){t.path=t.path.substring(0,o+1)}}r=join(urlGenerate(t),r)}return normalize(r)}r.computeSourceURL=computeSourceURL},997:(e,r,n)=>{n(591).h;r.SourceMapConsumer=n(952).SourceMapConsumer;n(351)},284:(e,r,n)=>{e=n.nmd(e);var t=n(997).SourceMapConsumer;var o=n(17);var i;try{i=n(147);if(!i.existsSync||!i.readFileSync){i=null}}catch(e){}var a=n(650);function dynamicRequire(e,r){return e.require(r)}var u=false;var s=false;var l=false;var c="auto";var p={};var f={};var g=/^data:application\/json[^,]+base64,/;var h=[];var d=[];function isInBrowser(){if(c==="browser")return true;if(c==="node")return false;return typeof window!=="undefined"&&typeof XMLHttpRequest==="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function hasGlobalProcessEventEmitter(){return typeof process==="object"&&process!==null&&typeof process.on==="function"}function globalProcessVersion(){if(typeof process==="object"&&process!==null){return process.version}else{return""}}function globalProcessStderr(){if(typeof process==="object"&&process!==null){return process.stderr}}function globalProcessExit(e){if(typeof process==="object"&&process!==null&&typeof process.exit==="function"){return process.exit(e)}}function handlerExec(e){return function(r){for(var n=0;n"}var n=this.getLineNumber();if(n!=null){r+=":"+n;var t=this.getColumnNumber();if(t){r+=":"+t}}}var o="";var i=this.getFunctionName();var a=true;var u=this.isConstructor();var s=!(this.isToplevel()||u);if(s){var l=this.getTypeName();if(l==="[object Object]"){l="null"}var c=this.getMethodName();if(i){if(l&&i.indexOf(l)!=0){o+=l+"."}o+=i;if(c&&i.indexOf("."+c)!=i.length-c.length-1){o+=" [as "+c+"]"}}else{o+=l+"."+(c||"")}}else if(u){o+="new "+(i||"")}else if(i){o+=i}else{o+=r;a=false}if(a){o+=" ("+r+")"}return o}function cloneCallSite(e){var r={};Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(n){r[n]=/^(?:is|get)/.test(n)?function(){return e[n].call(e)}:e[n]}));r.toString=CallSiteToString;return r}function wrapCallSite(e,r){if(r===undefined){r={nextPosition:null,curPosition:null}}if(e.isNative()){r.curPosition=null;return e}var n=e.getFileName()||e.getScriptNameOrSourceURL();if(n){var t=e.getLineNumber();var o=e.getColumnNumber()-1;var i=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;var a=i.test(globalProcessVersion())?0:62;if(t===1&&o>a&&!isInBrowser()&&!e.isEval()){o-=a}var u=mapSourcePosition({source:n,line:t,column:o});r.curPosition=u;e=cloneCallSite(e);var s=e.getFunctionName;e.getFunctionName=function(){if(r.nextPosition==null){return s()}return r.nextPosition.name||s()};e.getFileName=function(){return u.source};e.getLineNumber=function(){return u.line};e.getColumnNumber=function(){return u.column+1};e.getScriptNameOrSourceURL=function(){return u.source};return e}var l=e.isEval()&&e.getEvalOrigin();if(l){l=mapEvalOrigin(l);e=cloneCallSite(e);e.getEvalOrigin=function(){return l};return e}return e}function prepareStackTrace(e,r){if(l){p={};f={}}var n=e.name||"Error";var t=e.message||"";var o=n+": "+t;var i={nextPosition:null,curPosition:null};var a=[];for(var u=r.length-1;u>=0;u--){a.push("\n at "+wrapCallSite(r[u],i));i.nextPosition=i.curPosition}i.curPosition=i.nextPosition=null;return o+a.reverse().join("")}function getErrorSource(e){var r=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack);if(r){var n=r[1];var t=+r[2];var o=+r[3];var a=p[n];if(!a&&i&&i.existsSync(n)){try{a=i.readFileSync(n,"utf8")}catch(e){a=""}}if(a){var u=a.split(/(?:\r\n|\r|\n)/)[t-1];if(u){return n+":"+t+"\n"+u+"\n"+new Array(o).join(" ")+"^"}}}return null}function printErrorAndExit(e){var r=getErrorSource(e);var n=globalProcessStderr();if(n&&n._handle&&n._handle.setBlocking){n._handle.setBlocking(true)}if(r){console.error();console.error(r)}console.error(e.stack);globalProcessExit(1)}function shimEmitUncaughtException(){var e=process.emit;process.emit=function(r){if(r==="uncaughtException"){var n=arguments[1]&&arguments[1].stack;var t=this.listeners(r).length>0;if(n&&!t){return printErrorAndExit(arguments[1])}}return e.apply(this,arguments)}}var S=h.slice(0);var _=d.slice(0);r.wrapCallSite=wrapCallSite;r.getErrorSource=getErrorSource;r.mapSourcePosition=mapSourcePosition;r.retrieveSourceMap=v;r.install=function(r){r=r||{};if(r.environment){c=r.environment;if(["node","browser","auto"].indexOf(c)===-1){throw new Error("environment "+c+" was unknown. Available options are {auto, browser, node}")}}if(r.retrieveFile){if(r.overrideRetrieveFile){h.length=0}h.unshift(r.retrieveFile)}if(r.retrieveSourceMap){if(r.overrideRetrieveSourceMap){d.length=0}d.unshift(r.retrieveSourceMap)}if(r.hookRequire&&!isInBrowser()){var n=dynamicRequire(e,"module");var t=n.prototype._compile;if(!t.__sourceMapSupport){n.prototype._compile=function(e,r){p[r]=e;f[r]=undefined;return t.call(this,e,r)};n.prototype._compile.__sourceMapSupport=true}}if(!l){l="emptyCacheBetweenOperations"in r?r.emptyCacheBetweenOperations:false}if(!u){u=true;Error.prepareStackTrace=prepareStackTrace}if(!s){var o="handleUncaughtExceptions"in r?r.handleUncaughtExceptions:true;try{var i=dynamicRequire(e,"worker_threads");if(i.isMainThread===false){o=false}}catch(e){}if(o&&hasGlobalProcessEventEmitter()){s=true;shimEmitUncaughtException()}}};r.resetRetrieveHandlers=function(){h.length=0;d.length=0;h=S.slice(0);d=_.slice(0);v=handlerExec(d);m=handlerExec(h)}},147:e=>{"use strict";e.exports=require("fs")},17:e=>{"use strict";e.exports=require("path")}};var r={};function __webpack_require__(n){var t=r[n];if(t!==undefined){return t.exports}var o=r[n]={id:n,loaded:false,exports:{}};var i=true;try{e[n](o,o.exports,__webpack_require__);i=false}finally{if(i)delete r[n]}o.loaded=true;return o.exports}(()=>{__webpack_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __webpack_require__!=="undefined")__webpack_require__.ab=__dirname+"/";var n={};(()=>{__webpack_require__(284).install()})();module.exports=n})(); -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | clearMocks: true, 3 | moduleFileExtensions: ['js', 'ts'], 4 | testEnvironment: 'node', 5 | testMatch: ['**/*.test.ts'], 6 | testRunner: 'jest-circus/runner', 7 | transform: { 8 | '^.+\\.ts$': 'ts-jest' 9 | }, 10 | verbose: true 11 | } -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@bobheadxi/deployments", 3 | "version": "0.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "@bobheadxi/deployments", 9 | "version": "0.0.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@actions/core": "1.10.0", 13 | "@actions/github": "5.1.0" 14 | }, 15 | "devDependencies": { 16 | "@types/js-yaml": "4.0.5", 17 | "@types/node": "18.11.18", 18 | "@vercel/ncc": "0.36.0", 19 | "prettier": "2.8.3", 20 | "typescript": "4.9.4" 21 | } 22 | }, 23 | "node_modules/@actions/core": { 24 | "version": "1.10.0", 25 | "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", 26 | "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", 27 | "dependencies": { 28 | "@actions/http-client": "^2.0.1", 29 | "uuid": "^8.3.2" 30 | } 31 | }, 32 | "node_modules/@actions/github": { 33 | "version": "5.1.0", 34 | "resolved": "https://registry.npmjs.org/@actions/github/-/github-5.1.0.tgz", 35 | "integrity": "sha512-tuI80F7JQIhg77ZTTgUAPpVD7ZnP9oHSPN8xw7LOwtA4vEMbAjWJNbmLBfV7xua7r016GyjzWLuec5cs8f/a8A==", 36 | "dependencies": { 37 | "@actions/http-client": "^2.0.1", 38 | "@octokit/core": "^3.6.0", 39 | "@octokit/plugin-paginate-rest": "^2.17.0", 40 | "@octokit/plugin-rest-endpoint-methods": "^5.13.0" 41 | } 42 | }, 43 | "node_modules/@actions/http-client": { 44 | "version": "2.0.1", 45 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", 46 | "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", 47 | "dependencies": { 48 | "tunnel": "^0.0.6" 49 | } 50 | }, 51 | "node_modules/@octokit/auth-token": { 52 | "version": "2.5.0", 53 | "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.5.0.tgz", 54 | "integrity": "sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==", 55 | "dependencies": { 56 | "@octokit/types": "^6.0.3" 57 | } 58 | }, 59 | "node_modules/@octokit/core": { 60 | "version": "3.6.0", 61 | "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.6.0.tgz", 62 | "integrity": "sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q==", 63 | "dependencies": { 64 | "@octokit/auth-token": "^2.4.4", 65 | "@octokit/graphql": "^4.5.8", 66 | "@octokit/request": "^5.6.3", 67 | "@octokit/request-error": "^2.0.5", 68 | "@octokit/types": "^6.0.3", 69 | "before-after-hook": "^2.2.0", 70 | "universal-user-agent": "^6.0.0" 71 | } 72 | }, 73 | "node_modules/@octokit/endpoint": { 74 | "version": "6.0.12", 75 | "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz", 76 | "integrity": "sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA==", 77 | "dependencies": { 78 | "@octokit/types": "^6.0.3", 79 | "is-plain-object": "^5.0.0", 80 | "universal-user-agent": "^6.0.0" 81 | } 82 | }, 83 | "node_modules/@octokit/graphql": { 84 | "version": "4.8.0", 85 | "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz", 86 | "integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==", 87 | "dependencies": { 88 | "@octokit/request": "^5.6.0", 89 | "@octokit/types": "^6.0.3", 90 | "universal-user-agent": "^6.0.0" 91 | } 92 | }, 93 | "node_modules/@octokit/openapi-types": { 94 | "version": "12.11.0", 95 | "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.11.0.tgz", 96 | "integrity": "sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ==" 97 | }, 98 | "node_modules/@octokit/plugin-paginate-rest": { 99 | "version": "2.21.3", 100 | "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.21.3.tgz", 101 | "integrity": "sha512-aCZTEf0y2h3OLbrgKkrfFdjRL6eSOo8komneVQJnYecAxIej7Bafor2xhuDJOIFau4pk0i/P28/XgtbyPF0ZHw==", 102 | "dependencies": { 103 | "@octokit/types": "^6.40.0" 104 | }, 105 | "peerDependencies": { 106 | "@octokit/core": ">=2" 107 | } 108 | }, 109 | "node_modules/@octokit/plugin-rest-endpoint-methods": { 110 | "version": "5.16.2", 111 | "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz", 112 | "integrity": "sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw==", 113 | "dependencies": { 114 | "@octokit/types": "^6.39.0", 115 | "deprecation": "^2.3.1" 116 | }, 117 | "peerDependencies": { 118 | "@octokit/core": ">=3" 119 | } 120 | }, 121 | "node_modules/@octokit/request": { 122 | "version": "5.6.3", 123 | "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz", 124 | "integrity": "sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==", 125 | "dependencies": { 126 | "@octokit/endpoint": "^6.0.1", 127 | "@octokit/request-error": "^2.1.0", 128 | "@octokit/types": "^6.16.1", 129 | "is-plain-object": "^5.0.0", 130 | "node-fetch": "^2.6.7", 131 | "universal-user-agent": "^6.0.0" 132 | } 133 | }, 134 | "node_modules/@octokit/request-error": { 135 | "version": "2.1.0", 136 | "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz", 137 | "integrity": "sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==", 138 | "dependencies": { 139 | "@octokit/types": "^6.0.3", 140 | "deprecation": "^2.0.0", 141 | "once": "^1.4.0" 142 | } 143 | }, 144 | "node_modules/@octokit/types": { 145 | "version": "6.41.0", 146 | "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.41.0.tgz", 147 | "integrity": "sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg==", 148 | "dependencies": { 149 | "@octokit/openapi-types": "^12.11.0" 150 | } 151 | }, 152 | "node_modules/@types/js-yaml": { 153 | "version": "4.0.5", 154 | "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz", 155 | "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==", 156 | "dev": true 157 | }, 158 | "node_modules/@types/node": { 159 | "version": "18.11.18", 160 | "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", 161 | "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", 162 | "dev": true 163 | }, 164 | "node_modules/@vercel/ncc": { 165 | "version": "0.36.0", 166 | "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.0.tgz", 167 | "integrity": "sha512-/ZTUJ/ZkRt694k7KJNimgmHjtQcRuVwsST2Z6XfYveQIuBbHR+EqkTc1jfgPkQmMyk/vtpxo3nVxe8CNuau86A==", 168 | "dev": true, 169 | "bin": { 170 | "ncc": "dist/ncc/cli.js" 171 | } 172 | }, 173 | "node_modules/before-after-hook": { 174 | "version": "2.2.3", 175 | "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", 176 | "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==" 177 | }, 178 | "node_modules/deprecation": { 179 | "version": "2.3.1", 180 | "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", 181 | "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" 182 | }, 183 | "node_modules/is-plain-object": { 184 | "version": "5.0.0", 185 | "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", 186 | "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", 187 | "engines": { 188 | "node": ">=0.10.0" 189 | } 190 | }, 191 | "node_modules/node-fetch": { 192 | "version": "2.6.8", 193 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.8.tgz", 194 | "integrity": "sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg==", 195 | "dependencies": { 196 | "whatwg-url": "^5.0.0" 197 | }, 198 | "engines": { 199 | "node": "4.x || >=6.0.0" 200 | }, 201 | "peerDependencies": { 202 | "encoding": "^0.1.0" 203 | }, 204 | "peerDependenciesMeta": { 205 | "encoding": { 206 | "optional": true 207 | } 208 | } 209 | }, 210 | "node_modules/once": { 211 | "version": "1.4.0", 212 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 213 | "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", 214 | "dependencies": { 215 | "wrappy": "1" 216 | } 217 | }, 218 | "node_modules/prettier": { 219 | "version": "2.8.3", 220 | "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.3.tgz", 221 | "integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==", 222 | "dev": true, 223 | "bin": { 224 | "prettier": "bin-prettier.js" 225 | }, 226 | "engines": { 227 | "node": ">=10.13.0" 228 | }, 229 | "funding": { 230 | "url": "https://github.com/prettier/prettier?sponsor=1" 231 | } 232 | }, 233 | "node_modules/tr46": { 234 | "version": "0.0.3", 235 | "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", 236 | "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" 237 | }, 238 | "node_modules/tunnel": { 239 | "version": "0.0.6", 240 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 241 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", 242 | "engines": { 243 | "node": ">=0.6.11 <=0.7.0 || >=0.7.3" 244 | } 245 | }, 246 | "node_modules/typescript": { 247 | "version": "4.9.4", 248 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", 249 | "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", 250 | "dev": true, 251 | "bin": { 252 | "tsc": "bin/tsc", 253 | "tsserver": "bin/tsserver" 254 | }, 255 | "engines": { 256 | "node": ">=4.2.0" 257 | } 258 | }, 259 | "node_modules/universal-user-agent": { 260 | "version": "6.0.0", 261 | "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", 262 | "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" 263 | }, 264 | "node_modules/uuid": { 265 | "version": "8.3.2", 266 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", 267 | "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", 268 | "bin": { 269 | "uuid": "dist/bin/uuid" 270 | } 271 | }, 272 | "node_modules/webidl-conversions": { 273 | "version": "3.0.1", 274 | "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", 275 | "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" 276 | }, 277 | "node_modules/whatwg-url": { 278 | "version": "5.0.0", 279 | "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", 280 | "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", 281 | "dependencies": { 282 | "tr46": "~0.0.3", 283 | "webidl-conversions": "^3.0.0" 284 | } 285 | }, 286 | "node_modules/wrappy": { 287 | "version": "1.0.2", 288 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 289 | "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" 290 | } 291 | }, 292 | "dependencies": { 293 | "@actions/core": { 294 | "version": "1.10.0", 295 | "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", 296 | "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", 297 | "requires": { 298 | "@actions/http-client": "^2.0.1", 299 | "uuid": "^8.3.2" 300 | } 301 | }, 302 | "@actions/github": { 303 | "version": "5.1.0", 304 | "resolved": "https://registry.npmjs.org/@actions/github/-/github-5.1.0.tgz", 305 | "integrity": "sha512-tuI80F7JQIhg77ZTTgUAPpVD7ZnP9oHSPN8xw7LOwtA4vEMbAjWJNbmLBfV7xua7r016GyjzWLuec5cs8f/a8A==", 306 | "requires": { 307 | "@actions/http-client": "^2.0.1", 308 | "@octokit/core": "^3.6.0", 309 | "@octokit/plugin-paginate-rest": "^2.17.0", 310 | "@octokit/plugin-rest-endpoint-methods": "^5.13.0" 311 | } 312 | }, 313 | "@actions/http-client": { 314 | "version": "2.0.1", 315 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", 316 | "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", 317 | "requires": { 318 | "tunnel": "^0.0.6" 319 | } 320 | }, 321 | "@octokit/auth-token": { 322 | "version": "2.5.0", 323 | "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.5.0.tgz", 324 | "integrity": "sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==", 325 | "requires": { 326 | "@octokit/types": "^6.0.3" 327 | } 328 | }, 329 | "@octokit/core": { 330 | "version": "3.6.0", 331 | "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.6.0.tgz", 332 | "integrity": "sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q==", 333 | "requires": { 334 | "@octokit/auth-token": "^2.4.4", 335 | "@octokit/graphql": "^4.5.8", 336 | "@octokit/request": "^5.6.3", 337 | "@octokit/request-error": "^2.0.5", 338 | "@octokit/types": "^6.0.3", 339 | "before-after-hook": "^2.2.0", 340 | "universal-user-agent": "^6.0.0" 341 | } 342 | }, 343 | "@octokit/endpoint": { 344 | "version": "6.0.12", 345 | "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz", 346 | "integrity": "sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA==", 347 | "requires": { 348 | "@octokit/types": "^6.0.3", 349 | "is-plain-object": "^5.0.0", 350 | "universal-user-agent": "^6.0.0" 351 | } 352 | }, 353 | "@octokit/graphql": { 354 | "version": "4.8.0", 355 | "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz", 356 | "integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==", 357 | "requires": { 358 | "@octokit/request": "^5.6.0", 359 | "@octokit/types": "^6.0.3", 360 | "universal-user-agent": "^6.0.0" 361 | } 362 | }, 363 | "@octokit/openapi-types": { 364 | "version": "12.11.0", 365 | "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.11.0.tgz", 366 | "integrity": "sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ==" 367 | }, 368 | "@octokit/plugin-paginate-rest": { 369 | "version": "2.21.3", 370 | "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.21.3.tgz", 371 | "integrity": "sha512-aCZTEf0y2h3OLbrgKkrfFdjRL6eSOo8komneVQJnYecAxIej7Bafor2xhuDJOIFau4pk0i/P28/XgtbyPF0ZHw==", 372 | "requires": { 373 | "@octokit/types": "^6.40.0" 374 | } 375 | }, 376 | "@octokit/plugin-rest-endpoint-methods": { 377 | "version": "5.16.2", 378 | "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz", 379 | "integrity": "sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw==", 380 | "requires": { 381 | "@octokit/types": "^6.39.0", 382 | "deprecation": "^2.3.1" 383 | } 384 | }, 385 | "@octokit/request": { 386 | "version": "5.6.3", 387 | "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz", 388 | "integrity": "sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==", 389 | "requires": { 390 | "@octokit/endpoint": "^6.0.1", 391 | "@octokit/request-error": "^2.1.0", 392 | "@octokit/types": "^6.16.1", 393 | "is-plain-object": "^5.0.0", 394 | "node-fetch": "^2.6.7", 395 | "universal-user-agent": "^6.0.0" 396 | } 397 | }, 398 | "@octokit/request-error": { 399 | "version": "2.1.0", 400 | "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz", 401 | "integrity": "sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==", 402 | "requires": { 403 | "@octokit/types": "^6.0.3", 404 | "deprecation": "^2.0.0", 405 | "once": "^1.4.0" 406 | } 407 | }, 408 | "@octokit/types": { 409 | "version": "6.41.0", 410 | "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.41.0.tgz", 411 | "integrity": "sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg==", 412 | "requires": { 413 | "@octokit/openapi-types": "^12.11.0" 414 | } 415 | }, 416 | "@types/js-yaml": { 417 | "version": "4.0.5", 418 | "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz", 419 | "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==", 420 | "dev": true 421 | }, 422 | "@types/node": { 423 | "version": "18.11.18", 424 | "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", 425 | "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", 426 | "dev": true 427 | }, 428 | "@vercel/ncc": { 429 | "version": "0.36.0", 430 | "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.0.tgz", 431 | "integrity": "sha512-/ZTUJ/ZkRt694k7KJNimgmHjtQcRuVwsST2Z6XfYveQIuBbHR+EqkTc1jfgPkQmMyk/vtpxo3nVxe8CNuau86A==", 432 | "dev": true 433 | }, 434 | "before-after-hook": { 435 | "version": "2.2.3", 436 | "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", 437 | "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==" 438 | }, 439 | "deprecation": { 440 | "version": "2.3.1", 441 | "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", 442 | "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" 443 | }, 444 | "is-plain-object": { 445 | "version": "5.0.0", 446 | "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", 447 | "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" 448 | }, 449 | "node-fetch": { 450 | "version": "2.6.8", 451 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.8.tgz", 452 | "integrity": "sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg==", 453 | "requires": { 454 | "whatwg-url": "^5.0.0" 455 | } 456 | }, 457 | "once": { 458 | "version": "1.4.0", 459 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 460 | "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", 461 | "requires": { 462 | "wrappy": "1" 463 | } 464 | }, 465 | "prettier": { 466 | "version": "2.8.3", 467 | "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.3.tgz", 468 | "integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==", 469 | "dev": true 470 | }, 471 | "tr46": { 472 | "version": "0.0.3", 473 | "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", 474 | "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" 475 | }, 476 | "tunnel": { 477 | "version": "0.0.6", 478 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 479 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" 480 | }, 481 | "typescript": { 482 | "version": "4.9.4", 483 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", 484 | "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", 485 | "dev": true 486 | }, 487 | "universal-user-agent": { 488 | "version": "6.0.0", 489 | "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", 490 | "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" 491 | }, 492 | "uuid": { 493 | "version": "8.3.2", 494 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", 495 | "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" 496 | }, 497 | "webidl-conversions": { 498 | "version": "3.0.1", 499 | "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", 500 | "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" 501 | }, 502 | "whatwg-url": { 503 | "version": "5.0.0", 504 | "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", 505 | "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", 506 | "requires": { 507 | "tr46": "~0.0.3", 508 | "webidl-conversions": "^3.0.0" 509 | } 510 | }, 511 | "wrappy": { 512 | "version": "1.0.2", 513 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 514 | "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" 515 | } 516 | } 517 | } 518 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@bobheadxi/deployments", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "GitHub Action for working painlessly with deployment statuses", 6 | "main": "dist/index.js", 7 | "scripts": { 8 | "prettier": "prettier src --write", 9 | "prettier:check": "prettier src --check", 10 | "build": "ncc build src/main.ts --out dist --minify --source-map --license LICENSES", 11 | "build:check": "npm run build && git diff --quiet dist", 12 | "test": "npm run prettier:check & npm run build:check" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/bobheadxi/deployments.git" 17 | }, 18 | "author": "bobheadxi", 19 | "license": "MIT", 20 | "dependencies": { 21 | "@actions/core": "1.10.0", 22 | "@actions/github": "5.1.0" 23 | }, 24 | "devDependencies": { 25 | "@vercel/ncc": "0.36.0", 26 | "@types/js-yaml": "4.0.5", 27 | "@types/node": "18.11.18", 28 | "prettier": "2.8.3", 29 | "typescript": "4.9.4" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/lib/context.ts: -------------------------------------------------------------------------------- 1 | import { context } from "@actions/github"; 2 | import { getBooleanInput, getOptionalInput, getRequiredInput } from "./input"; 3 | import Logger from "./log"; 4 | 5 | export interface DeploymentContext { 6 | ref: string; 7 | sha: string; 8 | owner: string; 9 | repo: string; 10 | log: Logger; 11 | task: string | undefined; 12 | 13 | coreArgs: { 14 | description?: string; 15 | environment: string; 16 | logsURL: string; 17 | }; 18 | } 19 | 20 | /** 21 | * Generates configuration for this action run. 22 | */ 23 | export function collectDeploymentContext(): DeploymentContext { 24 | const { ref, sha } = context; 25 | 26 | const customRepository = getOptionalInput("repository"); 27 | 28 | const [owner, repo] = customRepository 29 | ? customRepository.split("/") 30 | : [context.repo.owner, context.repo.repo]; 31 | if (!owner || !repo) { 32 | throw new Error(`invalid target repository: ${owner}/${repo}`); 33 | } 34 | 35 | return { 36 | ref: getOptionalInput("ref") || ref, 37 | sha, 38 | owner, 39 | repo, 40 | task: getOptionalInput("task"), 41 | log: new Logger({ debug: getBooleanInput("debug", false) }), 42 | coreArgs: { 43 | environment: getRequiredInput("env"), 44 | description: getOptionalInput("desc"), 45 | logsURL: 46 | getOptionalInput("logs") || 47 | `https://github.com/${owner}/${repo}/commit/${sha}/checks`, 48 | }, 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /src/lib/deactivate.ts: -------------------------------------------------------------------------------- 1 | import { GitHub } from "@actions/github/lib/utils"; 2 | 3 | import { DeploymentContext } from "./context"; 4 | 5 | /** 6 | * Mark all deployments within this environment as `inactive`. 7 | */ 8 | async function deactivateEnvironment( 9 | github: InstanceType, 10 | { log, owner, repo, coreArgs: { environment } }: DeploymentContext 11 | ) { 12 | const deployments = await github.rest.repos.listDeployments({ 13 | owner, 14 | repo, 15 | environment, 16 | per_page: 100, 17 | }); 18 | const existing = deployments.data.length; 19 | if (existing === 0) { 20 | log.info(`found no existing deployments for env ${environment}`); 21 | return; 22 | } 23 | 24 | const deactivatedState = "inactive"; 25 | log.info(`${environment}: found ${existing} existing deployments for env`); 26 | for (let i = 0; i < existing; i++) { 27 | const deployment = deployments.data[i]; 28 | log.info( 29 | `${environment}.${deployment.id}: setting deployment (${deployment.sha}) state to "${deactivatedState}"` 30 | ); 31 | 32 | // Check existing status, to avoid setting it to the already current value. 33 | // See https://github.com/bobheadxi/deployments/issues/92. 34 | const getStatusRes = await github.rest.repos.listDeploymentStatuses({ 35 | owner, 36 | repo, 37 | deployment_id: deployment.id, 38 | per_page: 1, // we only need the latest status 39 | }); 40 | 41 | // If a previous status exists, and it is inactive, then we don't need to update it. 42 | if ( 43 | getStatusRes.data.length === 1 && 44 | getStatusRes.data[0].state === deactivatedState 45 | ) { 46 | log.debug( 47 | `${environment}.${deployment.id} is already ${deactivatedState}; skipping.` 48 | ); 49 | continue; 50 | } 51 | 52 | // Otherwise, set the deployment to "inactive". 53 | const createStatusRes = await github.rest.repos.createDeploymentStatus({ 54 | owner, 55 | repo, 56 | deployment_id: deployment.id, 57 | state: deactivatedState, 58 | }); 59 | log.debug(`${environment}.${deployment.id} updated`, { 60 | state: createStatusRes.data.state, 61 | url: createStatusRes.data.url, 62 | }); 63 | } 64 | 65 | log.info(`${environment}: ${existing} deployments updated`); 66 | return deployments; 67 | } 68 | 69 | export default deactivateEnvironment; 70 | -------------------------------------------------------------------------------- /src/lib/delete.ts: -------------------------------------------------------------------------------- 1 | import { GitHub } from "@actions/github/lib/utils"; 2 | 3 | import { DeploymentContext } from "./context"; 4 | import deactivateEnvironment from "./deactivate"; 5 | 6 | /** 7 | * Delete all deployments within this environment. 8 | */ 9 | async function deleteEnvironment( 10 | github: InstanceType, 11 | context: DeploymentContext 12 | ) { 13 | const { 14 | log, 15 | owner, 16 | repo, 17 | coreArgs: { environment }, 18 | } = context; 19 | const deployments = await deactivateEnvironment(github, context); 20 | 21 | if (deployments) { 22 | const existing = deployments.data.length; 23 | for (let i = 0; i < existing; i++) { 24 | const deployment = deployments.data[i]; 25 | log.info( 26 | `${environment}.${deployment.id}: deleting deployment (${deployment.sha})"` 27 | ); 28 | await github.rest.repos.deleteDeployment({ 29 | owner, 30 | repo, 31 | deployment_id: deployment.id, 32 | }); 33 | log.debug(`${environment}.${deployment.id} deleted`); 34 | } 35 | 36 | log.info(`${environment}: ${existing} deployments deleted`); 37 | } 38 | 39 | log.info(`deleting environment: "${environment}"`); 40 | try { 41 | await github.rest.repos.deleteAnEnvironment({ 42 | owner: context.owner, 43 | repo: context.repo, 44 | environment_name: environment, 45 | }); 46 | log.info(`${environment}: environment deleted`); 47 | } catch (error: any) { 48 | if ("status" in error && error.status == 404) { 49 | log.fail( 50 | `got a 404 deleting ${environment}, check that your PAT has repo scope and that the pat user is an admin` 51 | ); 52 | } else { 53 | log.fail(`error while deleting ${environment}: ${error}`); 54 | log.debug(error); 55 | } 56 | } 57 | } 58 | 59 | export default deleteEnvironment; 60 | -------------------------------------------------------------------------------- /src/lib/input.ts: -------------------------------------------------------------------------------- 1 | import { getInput } from "@actions/core"; 2 | 3 | /** 4 | * Alternative to @actions/core.getBooleanInput that supports default values 5 | */ 6 | export function getBooleanInput(key: string, defaultTrue: boolean) { 7 | if (defaultTrue) { 8 | // unless 'false', always true 9 | return getInput(key, { trimWhitespace: true }) !== "false"; 10 | } 11 | // unless 'true', always false 12 | return getInput(key, { trimWhitespace: true }) === "true"; 13 | } 14 | 15 | export function getRequiredInput(key: string): string { 16 | return getInput(key, { required: true, trimWhitespace: true }); 17 | } 18 | 19 | export function getOptionalInput(key: string): string | undefined { 20 | return getInput(key, { required: false, trimWhitespace: true }) || undefined; 21 | } 22 | -------------------------------------------------------------------------------- /src/lib/log.ts: -------------------------------------------------------------------------------- 1 | import { setFailed } from "@actions/core"; 2 | 3 | export default class Logger { 4 | private debugLogs: boolean; 5 | 6 | constructor(options: { debug: boolean }) { 7 | this.debugLogs = options.debug; 8 | } 9 | 10 | info(message, ...optionals) { 11 | console.log(message, ...optionals); 12 | } 13 | 14 | debug(message, ...optionals) { 15 | if (this.debugLogs) { 16 | console.warn(message, ...optionals); 17 | } 18 | } 19 | 20 | fail(message, ...optionals) { 21 | console.error(message, ...optionals); 22 | setFailed(`${message} - see logs for more information`); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { getOctokit } from "@actions/github"; 2 | 3 | import { collectDeploymentContext } from "./lib/context"; 4 | import { getRequiredInput } from "./lib/input"; 5 | 6 | import { run, Step } from "./steps"; 7 | 8 | const context = collectDeploymentContext(); 9 | console.log(`targeting ${context.owner}/${context.repo}`); 10 | 11 | const token = getRequiredInput("token"); 12 | const github = getOctokit(token, { 13 | previews: ["ant-man-preview", "flash-preview"], 14 | }); 15 | 16 | const step = getRequiredInput("step") as Step; 17 | run(step, github, context); 18 | -------------------------------------------------------------------------------- /src/steps/finish.ts: -------------------------------------------------------------------------------- 1 | import { GitHub } from "@actions/github/lib/utils"; 2 | 3 | import { DeploymentContext } from "../lib/context"; 4 | import deactivateEnvironment from "../lib/deactivate"; 5 | 6 | export type FinishArgs = { 7 | deploymentID: string; 8 | override: boolean; 9 | status: string; 10 | envURL?: string; 11 | autoInactive: boolean; 12 | }; 13 | 14 | async function createFinish( 15 | github: InstanceType, 16 | context: DeploymentContext, 17 | stepArgs: FinishArgs 18 | ) { 19 | const { 20 | log, 21 | coreArgs: { description, logsURL }, 22 | } = context; 23 | if (stepArgs.override) { 24 | await deactivateEnvironment(github, context); 25 | } 26 | 27 | // we must do this to validate the argument to get type checking 28 | if ( 29 | stepArgs.status !== "success" && 30 | stepArgs.status !== "failure" && 31 | stepArgs.status !== "cancelled" && 32 | stepArgs.status !== "error" && 33 | stepArgs.status !== "inactive" && 34 | stepArgs.status !== "in_progress" && 35 | stepArgs.status !== "queued" && 36 | stepArgs.status !== "pending" 37 | ) { 38 | log.fail(`unexpected status ${stepArgs.status}`); 39 | return; 40 | } 41 | log.info( 42 | `finishing deployment for ${stepArgs.deploymentID} with status ${stepArgs.status}` 43 | ); 44 | 45 | // Set cancelled jobs to inactive environment 46 | const newStatus = 47 | stepArgs.status === "cancelled" ? "inactive" : stepArgs.status; 48 | const { 49 | data: { id: statusID }, 50 | } = await github.rest.repos.createDeploymentStatus({ 51 | owner: context.owner, 52 | repo: context.repo, 53 | deployment_id: parseInt(stepArgs.deploymentID, 10), 54 | state: newStatus, 55 | description: description, 56 | ref: context.ref, 57 | 58 | // only set environment_url if deployment worked 59 | environment_url: newStatus === "success" ? stepArgs.envURL : "", 60 | // set log_url to action by default 61 | log_url: logsURL, 62 | // if we are overriding previous deployments, let GitHub deactivate past 63 | // deployments for us as a fallback, or see if a user explicitly wants to 64 | // use this feature. 65 | auto_inactive: stepArgs.override || stepArgs.autoInactive, 66 | }); 67 | 68 | log.info(`${stepArgs.deploymentID} status set to ${newStatus}`, { 69 | statusID: statusID, 70 | }); 71 | 72 | return { statusID }; 73 | } 74 | 75 | export default createFinish; 76 | -------------------------------------------------------------------------------- /src/steps/index.ts: -------------------------------------------------------------------------------- 1 | import { setOutput, error } from "@actions/core"; 2 | import { GitHub } from "@actions/github/lib/utils"; 3 | 4 | import { DeploymentContext } from "../lib/context"; 5 | import deactivateEnvironment from "../lib/deactivate"; 6 | import deleteEnvironment from "../lib/delete"; 7 | import { 8 | getBooleanInput, 9 | getOptionalInput, 10 | getRequiredInput, 11 | } from "../lib/input"; 12 | 13 | import createStart, { StartArgs } from "./start"; 14 | import createFinish, { FinishArgs } from "./finish"; 15 | 16 | export enum Step { 17 | Start = "start", 18 | Finish = "finish", 19 | DeactivateEnv = "deactivate-env", 20 | DeleteEnv = "delete-env", 21 | } 22 | 23 | export async function run( 24 | step: Step, 25 | github: InstanceType, 26 | context: DeploymentContext 27 | ) { 28 | const { log, coreArgs } = context; 29 | 30 | try { 31 | switch (step) { 32 | case Step.Start: 33 | { 34 | const rawPayload = getOptionalInput("payload"); 35 | let payload: { [key: string]: any } | undefined = undefined; 36 | if (rawPayload) { 37 | payload = JSON.parse(rawPayload); 38 | } 39 | const stepArgs: StartArgs = { 40 | deploymentID: getOptionalInput("deployment_id"), 41 | override: getBooleanInput("override", false), // default to false on start 42 | payload, 43 | }; 44 | log.debug(`'${step}' arguments`, { 45 | stepArgs, 46 | coreArgs, 47 | }); 48 | const { deploymentID, statusID } = await createStart( 49 | github, 50 | context, 51 | stepArgs 52 | ); 53 | setOutput("deployment_id", deploymentID); 54 | setOutput("status_id", statusID); 55 | // set for ease of reference 56 | setOutput("env", coreArgs.environment); 57 | } 58 | break; 59 | 60 | case Step.Finish: 61 | { 62 | const stepArgs: FinishArgs = { 63 | status: getRequiredInput("status").toLowerCase(), 64 | deploymentID: getRequiredInput("deployment_id"), 65 | envURL: getOptionalInput("env_url"), 66 | override: getBooleanInput("override", true), // default to true on finish 67 | autoInactive: getBooleanInput("auto_inactive", false), 68 | }; 69 | log.debug(`'${step}' arguments`, { 70 | stepArgs, 71 | coreArgs, 72 | }); 73 | const { statusID } = (await createFinish( 74 | github, 75 | context, 76 | stepArgs 77 | )) || { statusID: -1 }; 78 | setOutput("status_id", statusID); 79 | } 80 | break; 81 | 82 | case Step.DeactivateEnv: 83 | { 84 | log.debug(`'${step}' arguments`, { coreArgs }); 85 | 86 | await deactivateEnvironment(github, context); 87 | } 88 | break; 89 | 90 | case Step.DeleteEnv: 91 | { 92 | log.debug(`'${step}' arguments`, { coreArgs }); 93 | 94 | await deleteEnvironment(github, context); 95 | } 96 | break; 97 | 98 | default: 99 | log.fail(`unknown step type ${step}`); 100 | } 101 | } catch (error) { 102 | log.fail(`unexpected error encountered: ${error}`); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/steps/start.ts: -------------------------------------------------------------------------------- 1 | import { GitHub } from "@actions/github/lib/utils"; 2 | 3 | import { DeploymentContext } from "../lib/context"; 4 | import deactivateEnvironment from "../lib/deactivate"; 5 | 6 | export type StartArgs = { 7 | deploymentID?: string; 8 | override: boolean; 9 | payload?: { [key: string]: any }; 10 | }; 11 | 12 | async function createStart( 13 | github: InstanceType, 14 | context: DeploymentContext, 15 | stepArgs: StartArgs 16 | ) { 17 | if (stepArgs.override) { 18 | await deactivateEnvironment(github, context); 19 | } 20 | 21 | const { 22 | log, 23 | owner, 24 | repo, 25 | ref, 26 | task, 27 | coreArgs: { environment, description, logsURL }, 28 | } = context; 29 | 30 | let deploymentID = -1; 31 | if (!stepArgs.deploymentID) { 32 | log.info(`initializing new deployment for ${environment} @ ${ref}`); 33 | const deployment = await github.rest.repos.createDeployment({ 34 | owner: owner, 35 | repo: repo, 36 | ref: ref, 37 | task: task, 38 | required_contexts: [], 39 | environment: environment, 40 | description: description, 41 | auto_merge: false, 42 | transient_environment: true, 43 | payload: stepArgs.payload, 44 | }); 45 | if (deployment.status == 201) { 46 | deploymentID = deployment.data.id; 47 | } else { 48 | log.fail(`unexpected ${deployment.status} on deployment creation`, { 49 | response: deployment, 50 | }); 51 | } 52 | } else { 53 | deploymentID = parseInt(stepArgs.deploymentID, 10); 54 | log.info( 55 | `initializing deployment ${deploymentID} for ${environment} @ ${ref}` 56 | ); 57 | } 58 | log.info(`created deployment ${deploymentID} for ${environment} @ ${ref}`); 59 | 60 | const { 61 | data: { id: statusID }, 62 | } = await github.rest.repos.createDeploymentStatus({ 63 | owner: owner, 64 | repo: repo, 65 | deployment_id: deploymentID, 66 | state: "in_progress", 67 | log_url: logsURL, 68 | description: description, 69 | ref: ref, 70 | }); 71 | log.info(`created deployment status ${statusID} with status "in_progress"`); 72 | 73 | return { 74 | deploymentID, 75 | statusID, 76 | }; 77 | } 78 | 79 | export default createStart; 80 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Basic Options */ 4 | // "incremental": true, /* Enable incremental compilation */ 5 | "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ 6 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ 7 | // "allowJs": true, /* Allow javascript files to be compiled. */ 8 | // "checkJs": true, /* Report errors in .js files. */ 9 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 10 | // "declaration": true, /* Generates corresponding '.d.ts' file. */ 11 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 12 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 13 | // "outFile": "./", /* Concatenate and emit output to single file. */ 14 | "outDir": "dist", /* Redirect output structure to the directory. */ 15 | "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 16 | // "composite": true, /* Enable project compilation */ 17 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 18 | // "removeComments": true, /* Do not emit comments to output. */ 19 | // "noEmit": true, /* Do not emit outputs. */ 20 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 21 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 22 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 23 | 24 | /* Strict Type-Checking Options */ 25 | "strict": true, /* Enable all strict type-checking options. */ 26 | "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */ 27 | // "strictNullChecks": true, /* Enable strict null checks. */ 28 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */ 29 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 30 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 31 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 32 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 33 | 34 | /* Additional Checks */ 35 | // "noUnusedLocals": true, /* Report errors on unused locals. */ 36 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 37 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 38 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 39 | 40 | /* Module Resolution Options */ 41 | "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 42 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 43 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 44 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 45 | // "typeRoots": [], /* List of folders to include type definitions from. */ 46 | // "types": [], /* Type declaration files to be included in compilation. */ 47 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 48 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 49 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 50 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 51 | 52 | /* Source Map Options */ 53 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 54 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 55 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 56 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 57 | 58 | /* Experimental Options */ 59 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 60 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 61 | }, 62 | "exclude": ["node_modules", "**/*.test.ts"] 63 | } 64 | --------------------------------------------------------------------------------