├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ └── bug_report.md └── workflows │ ├── dryrun-deploy.yml │ └── test-report.yml ├── .gitignore ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── action.yml ├── dist └── index.js ├── images ├── web-deploy-logo-full.png └── web-deploy-logo-small.png ├── package-lock.json ├── package.json ├── src ├── main.test.ts ├── main.ts └── types.ts └── tsconfig.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Bug Description** 11 | A clear and concise description of what the bug is. 12 | 13 | **My Action Config** 14 | ```yaml 15 | on: 16 | push: 17 | # !!!!!!! TODO Fill Out !!!!!!! 18 | ``` 19 | 20 | **My Action Log** 21 | ``` 22 | # Paste Log here 23 | ``` 24 | -------------------------------------------------------------------------------- /.github/workflows/dryrun-deploy.yml: -------------------------------------------------------------------------------- 1 | name: Publish Website 2 | on: 3 | push: 4 | jobs: 5 | web-deploy: 6 | name: 🚀 Deploy Website Every Commit 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: 🚚 Get Latest Code 10 | uses: actions/checkout@v3 11 | 12 | - name: 📂 Sync Files 13 | uses: SamKirkland/web-deploy@v1 14 | with: 15 | target-server: mi3-sr24.supercp.com 16 | remote-user: samkirkland 17 | private-ssh-key: ${{ secrets.SSH_KEY }} 18 | ssh-port: 7822 19 | destination-path: ~/ 20 | rsync-options: --dry-run --archive --verbose --compress --delete-after --human-readable --exclude=.git* --exclude=.git/ --exclude=README.md --exclude=readme.md --exclude=.gitignore 21 | -------------------------------------------------------------------------------- /.github/workflows/test-report.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | on: 3 | pull_request: 4 | push: 5 | jobs: 6 | build-test: 7 | name: Build & Test 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v3 11 | - uses: actions/setup-node@v3 12 | with: 13 | node-version: 18 14 | cache: "npm" 15 | - run: npm ci 16 | - run: npm run test-ci 17 | 18 | - name: Test Report 19 | uses: dorny/test-reporter@v1 20 | if: success() || failure() 21 | with: 22 | name: JEST Tests 23 | path: reports/jest-*.xml 24 | reporter: jest-junit 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __tests__/runner/* 2 | reports/ 3 | 4 | # comment out in distribution branches 5 | node_modules/ 6 | 7 | # Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore 8 | # Logs 9 | logs 10 | *.log 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | lerna-debug.log* 15 | 16 | # Diagnostic reports (https://nodejs.org/api/report.html) 17 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 18 | 19 | # Runtime data 20 | pids 21 | *.pid 22 | *.seed 23 | *.pid.lock 24 | 25 | # Directory for instrumented libs generated by jscoverage/JSCover 26 | lib-cov 27 | 28 | # Coverage directory used by tools like istanbul 29 | coverage 30 | *.lcov 31 | 32 | # nyc test coverage 33 | .nyc_output 34 | 35 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 36 | .grunt 37 | 38 | # Bower dependency directory (https://bower.io/) 39 | bower_components 40 | 41 | # node-waf configuration 42 | .lock-wscript 43 | 44 | # Compiled binary addons (https://nodejs.org/api/addons.html) 45 | build/Release 46 | 47 | # Dependency directories 48 | jspm_packages/ 49 | 50 | # TypeScript v1 declaration files 51 | typings/ 52 | 53 | # TypeScript cache 54 | *.tsbuildinfo 55 | 56 | # Optional npm cache directory 57 | .npm 58 | 59 | # Optional eslint cache 60 | .eslintcache 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # next.js build output 79 | .next 80 | 81 | # nuxt.js build output 82 | .nuxt 83 | 84 | # vuepress build output 85 | .vuepress/dist 86 | 87 | # Serverless directories 88 | .serverless/ 89 | 90 | # FuseBox cache 91 | .fusebox/ 92 | 93 | # DynamoDB Local files 94 | .dynamodb/ 95 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "**/node_modules": true 4 | } 5 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Sam Kirkland 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | web deploy - Continuous integration for everyone 3 |

4 | 5 | Automate deploying websites and more with this GitHub action. **It's free!** 6 | 7 | [![tests](https://github.com/SamKirkland/web-deploy/actions/workflows/test-report.yml/badge.svg)](https://github.com/SamKirkland/web-deploy/actions/workflows/test-report.yml) 8 | 9 | --- 10 | 11 | ### Usage Example 12 | Place the following in `Your_Project/.github/workflows/main.yml` 13 | ```yml 14 | on: push 15 | name: Publish Website 16 | jobs: 17 | web-deploy: 18 | name: 🚀 Deploy Website Every Commit 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: 🚚 Get Latest Code 22 | uses: actions/checkout@v3 23 | 24 | - name: 📂 Sync Files 25 | uses: SamKirkland/web-deploy@v1 26 | with: 27 | target-server: example.com 28 | remote-user: username 29 | private-ssh-key: ${{ secrets.SSH_KEY }} 30 | destination-path: ~/destinationFolder/ 31 | ``` 32 | 33 | --- 34 | 35 | ### Requirements 36 | - You must have shell access to your server, please read you webite hosts documentation 37 | - **You CANNOT use a FTP account - they are not the same!** 38 | - If you don't have SSH access but have ftp access use [FTP-Deploy-Action](https://github.com/SamKirkland/FTP-Deploy-Action) instead 39 | - You will need to create a **SSH** user to deploy. Normally this is your cpanel or hosting providers username and password 40 | - Most web hosts change the default port (22), check with your host for your port number 41 | 42 | --- 43 | 44 | ### Setup Steps 45 | 1. Select the repository you want to add the action to 46 | 2. Select the `Actions` tab 47 | 3. Select `Blank workflow file` or `Set up a workflow yourself`, if you don't see these options manually create a yaml file `Your_Project/.github/workflows/main.yml` 48 | 4. Paste the example above into your yaml file and save 49 | 5. Now you need to add a key to the `secrets` section in your project. To add a `secret` go to the `Settings` tab in your project then select `Secrets`. Add a new `Secret` for `private-ssh-key` 50 | 6. Update your yaml file settings 51 | 52 | --- 53 | 54 | ### Settings 55 | Keys can be added directly to your .yml config file or referenced from your project `Secrets` storage. 56 | 57 | To add a `secret` go to the `Settings` tab in your project then select `Secrets`. 58 | I strongly recommend you store your `private-ssh-key` as a secret. 59 | 60 | | Key Name | Required? | Example | Default | Description | 61 | |--------------------|-----------|------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| 62 | | `target-server` | Yes | `example.com` | | Destination server to deploy to | 63 | | `destination-path` | Yes | `~/folderOnServerThatAlreadyExists/` | | Path on the server to deploy to. Must already exist. | 64 | | `remote-user` | Yes | `username` | | SSH user to login as | 65 | | `private-ssh-key` | Yes | `-----BEGIN RSA PRIVATE KEY----- ......` | | SSH Private key. Must be specified as a secret. | 66 | | `source-path` | No | `./myFolderToPublish/` | `./` | Path to upload to on the server, must end with trailing slash `/` | 67 | | `ssh-port` | No | `12345` | `22` | SSH port to use. Most hosts change this from the default. This is NOT your websites port. | 68 | | `rsync-options` | No | See `rsync-options` section below | `--archive --verbose --compress --human-readable --progress --delete-after --exclude=.git* --exclude=.git/ --exclude=README.md --exclude=readme.md --exclude=.gitignore` | Note: If customizing you should re-specify defaults (assuming you want them). Custom rsync arguments, this field is passed through directly into the rsync script. | 69 | 70 | #### Advanced options using `rsync-options` 71 | Custom arguments, this field is passed through directly into the rsync script. See [rsync's manual](https://linux.die.net/man/1/rsync) for all options. 72 | You can use as many arguments as you want, seperate them with a space 73 | 74 | Below is an incomplete list of commonly used args: 75 | 76 | | Option | Description | 77 | |------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| 78 | | `--archive` | A quick way of saying you want recursion and want to preserve almost everything | 79 | | `--dry-run` | Does not upload or delete anything, but tells you what it would upload/delete if this was a real deploy | 80 | | `--stats` | Print verbose statistics on the file transfer, allowing you to tell how effective rsync’s delta-transfer algorithm is for your data | 81 | | `--links` | When symlinks are encountered, recreate the symlink on the destination | 82 | | `--compress` | Compresses the file data as it is sent to the destination machine, which reduces the amount of data being transmitted | 83 | | `--human-readable` | Output bytes in a more human-readable format (K, M, G) | 84 | | `--itemize-changes` | itemized list of the changes that are being made to each file, including attribute changes | 85 | | `--delete-after` | When you delete a file on github it will also be deleted on the server. Files are deleted at the end of a deployment to minimize downtime. | 86 | | `--max-size '200K'` | Ignore syncing files over this limit. Value is a number followed by "K", "M", or "G" | 87 | | `--exclude 'file.txt'` | Excludes file(s) from the deployment. Supports glob pattterns (ex: `*.jpg`). You can have multiple excludes! | 88 | | `--include 'file.txt'` | Includes file(s) even if it was excluded. Supports glob pattterns (ex: `*.jpg`). You can have multiple includes! | 89 | 90 | See [rsync's manual](https://linux.die.net/man/1/rsync) for all options 91 | 92 | # Common Examples 93 | #### Build and Publish React/Angular/Vue Website 94 | Make sure you have an npm script named 'build'. This config should work for most node built websites. 95 | 96 | ```yml 97 | on: push 98 | name: Publish Website 99 | jobs: 100 | web-deploy: 101 | name: 🚀 Deploy Website Every Commit 102 | runs-on: ubuntu-latest 103 | steps: 104 | - name: 🚚 Get Latest Code 105 | uses: actions/checkout@v3 106 | 107 | - name: 📦 Install Packages 108 | - uses: actions/setup-node@v3 109 | with: 110 | node-version: 18 111 | cache: "npm" 112 | - run: npm ci 113 | 114 | - name: 🔨 Build 115 | run: npm run build 116 | 117 | - name: 📂 Sync Files 118 | uses: SamKirkland/web-deploy@v1 119 | with: 120 | target-server: example.com 121 | remote-user: username 122 | private-ssh-key: ${{ secrets.SSH_KEY }} 123 | destination-path: ~/destinationFolder/ 124 | ``` 125 | 126 | #### Log only dry run: Use this mode for testing 127 | Ouputs a list of files that will be created/modified to sync your source without making any actual changes 128 | ```yml 129 | on: push 130 | name: Publish Website Dry Run 131 | jobs: 132 | web-deploy: 133 | name: 🚀 Deploy Website Every Commit 134 | runs-on: ubuntu-latest 135 | steps: 136 | - name: 🚚 Get Latest Code 137 | uses: actions/checkout@v3 138 | 139 | - name: 📂 Sync Files 140 | uses: SamKirkland/web-deploy@v1 141 | with: 142 | target-server: example.com 143 | remote-user: username 144 | private-ssh-key: ${{ secrets.SSH_KEY }} 145 | ssh-port: 22 146 | destination-path: ~/destinationFolder/ 147 | rsync-options: --dry-run --archive --verbose --compress --delete-after --human-readable --exclude=.git* --exclude=.git/ --exclude=README.md --exclude=readme.md --exclude=.gitignore 148 | ``` 149 | 150 | _Want another example? Let me know by creating a [github issue](https://github.com/SamKirkland/web-deploy/issues/new)_ 151 | 152 | --- 153 | 154 | ## Badge 155 | 156 | If you appreciate this github action give it a :star: or show off with one of the badges below. Feel free to edit the text or color. 157 | 158 | [Deployed with web deploy](https://github.com/SamKirkland/web-deploy) 159 | 160 | ```md 161 | [Deployed with web deploy](https://github.com/SamKirkland/web-deploy) 162 | ``` 163 | 164 | [Deployed with web deploy](https://github.com/SamKirkland/web-deploy) 165 | 166 | ```md 167 | [Deployed with web deploy](https://github.com/SamKirkland/web-deploy) 168 | ``` 169 | 170 | [Deployed with web deploy](https://github.com/SamKirkland/web-deploy) 171 | 172 | ```md 173 | [Deployed with web deploy](https://github.com/SamKirkland/web-deploy) 174 | ``` 175 | 176 | --- 177 | 178 | [Website Deployed for Free with web deploy](https://github.com/SamKirkland/web-deploy) 179 | 180 | ```md 181 | [Website Deployed for Free with web deploy](https://github.com/SamKirkland/web-deploy) 182 | ``` 183 | 184 | [Website Deployed for Free with web deploy](https://github.com/SamKirkland/web-deploy) 185 | 186 | ```md 187 | [Website Deployed for Free with web deploy](https://github.com/SamKirkland/web-deploy) 188 | ``` 189 | 190 | [Website Deployed for Free with web deploy](https://github.com/SamKirkland/web-deploy) 191 | 192 | ```md 193 | [Website Deployed for Free with web deploy](https://github.com/SamKirkland/web-deploy) 194 | ``` 195 | 196 | ## FAQ 197 |
198 | How to exclude .git files from the publish 199 | 200 | Git files are excluded by default 201 | 202 | If have customized `rsync-options` you will need to re-add the default exclude options using `--exclude=.git* --exclude=.git/ --exclude=README.md --exclude=readme.md --exclude=.gitignore` 203 |
204 | 205 |
206 | How to exclude a specific file or folder 207 | 208 | You can use `rsync-options` and pass in as many `--exclude` options as you want. By default this action excludes github files. If you choose to customize `rsync-options` make sure you copy over the defaults. 209 | 210 | 211 | Example excluding all `.jpg` files: 212 | 213 | `rsync-options: --exclude "*.jpg"` 214 | 215 | 216 | Example excluding a specific folder: 217 | 218 | `rsync-options: --exclude "wp-content/themes/"` 219 |
220 | 221 | --- 222 | 223 | ## Common Errors 224 |
225 | rsync not found. Please see https://github.com/SamKirkland/web-deploy#rsync-not-installed 226 | 227 | 228 | This library uses `rsync` to sync files. The script was not able to detect `rsync` on the machine running the action. 229 | If you are using `runs-on: ubuntu-latest` you will always have `rsync`. 230 | 231 | If you are using `windows-latest`, `windows-XXXX`, `macos-latest`, `macos-12` or a [self-hosted](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners) runner you will need to install rsync before the `web-deploy` step. 232 | 233 | This is pretty easy to do! 234 | 235 | On `windows` runners run your windows specific steps, then use a `ubuntu-latest` step to deploy. 236 | 237 | On self-hosted runners install rsync **before** the `web-deploy` step. 238 | ```yaml 239 | runs-on: [self-hosted, linux, my-self-hosted-runner-label] 240 | steps: 241 | - name: Install rsync 242 | run: | 243 | sudo apt-get update 244 | sudo apt-get install rsync 245 | ``` 246 | 247 | On `macos` runners install rsync **before** the `web-deploy` step. 248 | ```yaml 249 | runs-on: macos-latest 250 | steps: 251 | - name: Install rsync 252 | run: | 253 | brew update 254 | brew install rsync 255 | ``` 256 | 257 | [Read more about customizing runners](https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners) 258 | 259 | 260 | 261 | https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners 262 |
263 | 264 | --- 265 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: "web deploy anything" 2 | description: "Deploy websites via sftp/ssh/rsync" 3 | author: "Sam Kirkland" 4 | inputs: 5 | target-server: 6 | description: "Deployment destination server. Formatted as domain.com:port. Port is optional and is your websites port, not your SSH port" 7 | required: true 8 | remote-user: 9 | description: "SSH account username" 10 | required: true 11 | private-ssh-key: 12 | description: "Private SSH key" 13 | required: true 14 | source-path: 15 | description: "Path to upload to on the server, must end with trailing slash /" 16 | required: true 17 | destination-path: 18 | description: "Folder to upload from, must end with trailing slash /" 19 | required: true 20 | ssh-port: 21 | description: "Port for SSH" 22 | default: "22" 23 | required: false 24 | rsync-options: 25 | description: "Passes through options into rsync" 26 | default: "--archive --verbose --compress --human-readable --progress --delete-after --exclude=.git* --exclude=.git/ --exclude=README.md --exclude=readme.md --exclude=.gitignore" 27 | required: false 28 | runs: 29 | using: "node16" 30 | main: "dist/index.js" 31 | branding: 32 | icon: "upload-cloud" 33 | color: "green" 34 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __create = Object.create; 3 | var __defProp = Object.defineProperty; 4 | var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 5 | var __getOwnPropNames = Object.getOwnPropertyNames; 6 | var __getProtoOf = Object.getPrototypeOf; 7 | var __hasOwnProp = Object.prototype.hasOwnProperty; 8 | var __commonJS = (cb, mod) => function __require() { 9 | return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 10 | }; 11 | var __export = (target, all) => { 12 | for (var name in all) 13 | __defProp(target, name, { get: all[name], enumerable: true }); 14 | }; 15 | var __copyProps = (to, from, except, desc) => { 16 | if (from && typeof from === "object" || typeof from === "function") { 17 | for (let key of __getOwnPropNames(from)) 18 | if (!__hasOwnProp.call(to, key) && key !== except) 19 | __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 20 | } 21 | return to; 22 | }; 23 | var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 24 | isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 25 | mod 26 | )); 27 | var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 28 | 29 | // node_modules/@actions/core/lib/utils.js 30 | var require_utils = __commonJS({ 31 | "node_modules/@actions/core/lib/utils.js"(exports) { 32 | "use strict"; 33 | Object.defineProperty(exports, "__esModule", { value: true }); 34 | exports.toCommandProperties = exports.toCommandValue = void 0; 35 | function toCommandValue(input) { 36 | if (input === null || input === void 0) { 37 | return ""; 38 | } else if (typeof input === "string" || input instanceof String) { 39 | return input; 40 | } 41 | return JSON.stringify(input); 42 | } 43 | exports.toCommandValue = toCommandValue; 44 | function toCommandProperties(annotationProperties) { 45 | if (!Object.keys(annotationProperties).length) { 46 | return {}; 47 | } 48 | return { 49 | title: annotationProperties.title, 50 | file: annotationProperties.file, 51 | line: annotationProperties.startLine, 52 | endLine: annotationProperties.endLine, 53 | col: annotationProperties.startColumn, 54 | endColumn: annotationProperties.endColumn 55 | }; 56 | } 57 | exports.toCommandProperties = toCommandProperties; 58 | } 59 | }); 60 | 61 | // node_modules/@actions/core/lib/command.js 62 | var require_command = __commonJS({ 63 | "node_modules/@actions/core/lib/command.js"(exports) { 64 | "use strict"; 65 | var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { 66 | if (k2 === void 0) 67 | k2 = k; 68 | Object.defineProperty(o, k2, { enumerable: true, get: function() { 69 | return m[k]; 70 | } }); 71 | } : function(o, m, k, k2) { 72 | if (k2 === void 0) 73 | k2 = k; 74 | o[k2] = m[k]; 75 | }); 76 | var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { 77 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 78 | } : function(o, v) { 79 | o["default"] = v; 80 | }); 81 | var __importStar = exports && exports.__importStar || function(mod) { 82 | if (mod && mod.__esModule) 83 | return mod; 84 | var result = {}; 85 | if (mod != null) { 86 | for (var k in mod) 87 | if (k !== "default" && Object.hasOwnProperty.call(mod, k)) 88 | __createBinding(result, mod, k); 89 | } 90 | __setModuleDefault(result, mod); 91 | return result; 92 | }; 93 | Object.defineProperty(exports, "__esModule", { value: true }); 94 | exports.issue = exports.issueCommand = void 0; 95 | var os = __importStar(require("os")); 96 | var utils_1 = require_utils(); 97 | function issueCommand(command, properties, message) { 98 | const cmd = new Command(command, properties, message); 99 | process.stdout.write(cmd.toString() + os.EOL); 100 | } 101 | exports.issueCommand = issueCommand; 102 | function issue(name, message = "") { 103 | issueCommand(name, {}, message); 104 | } 105 | exports.issue = issue; 106 | var CMD_STRING = "::"; 107 | var Command = class { 108 | constructor(command, properties, message) { 109 | if (!command) { 110 | command = "missing.command"; 111 | } 112 | this.command = command; 113 | this.properties = properties; 114 | this.message = message; 115 | } 116 | toString() { 117 | let cmdStr = CMD_STRING + this.command; 118 | if (this.properties && Object.keys(this.properties).length > 0) { 119 | cmdStr += " "; 120 | let first = true; 121 | for (const key in this.properties) { 122 | if (this.properties.hasOwnProperty(key)) { 123 | const val = this.properties[key]; 124 | if (val) { 125 | if (first) { 126 | first = false; 127 | } else { 128 | cmdStr += ","; 129 | } 130 | cmdStr += `${key}=${escapeProperty(val)}`; 131 | } 132 | } 133 | } 134 | } 135 | cmdStr += `${CMD_STRING}${escapeData(this.message)}`; 136 | return cmdStr; 137 | } 138 | }; 139 | function escapeData(s) { 140 | return utils_1.toCommandValue(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A"); 141 | } 142 | function escapeProperty(s) { 143 | return utils_1.toCommandValue(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C"); 144 | } 145 | } 146 | }); 147 | 148 | // node_modules/@actions/core/lib/file-command.js 149 | var require_file_command = __commonJS({ 150 | "node_modules/@actions/core/lib/file-command.js"(exports) { 151 | "use strict"; 152 | var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { 153 | if (k2 === void 0) 154 | k2 = k; 155 | Object.defineProperty(o, k2, { enumerable: true, get: function() { 156 | return m[k]; 157 | } }); 158 | } : function(o, m, k, k2) { 159 | if (k2 === void 0) 160 | k2 = k; 161 | o[k2] = m[k]; 162 | }); 163 | var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { 164 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 165 | } : function(o, v) { 166 | o["default"] = v; 167 | }); 168 | var __importStar = exports && exports.__importStar || function(mod) { 169 | if (mod && mod.__esModule) 170 | return mod; 171 | var result = {}; 172 | if (mod != null) { 173 | for (var k in mod) 174 | if (k !== "default" && Object.hasOwnProperty.call(mod, k)) 175 | __createBinding(result, mod, k); 176 | } 177 | __setModuleDefault(result, mod); 178 | return result; 179 | }; 180 | Object.defineProperty(exports, "__esModule", { value: true }); 181 | exports.issueCommand = void 0; 182 | var fs = __importStar(require("fs")); 183 | var os = __importStar(require("os")); 184 | var utils_1 = require_utils(); 185 | function issueCommand(command, message) { 186 | const filePath = process.env[`GITHUB_${command}`]; 187 | if (!filePath) { 188 | throw new Error(`Unable to find environment variable for file command ${command}`); 189 | } 190 | if (!fs.existsSync(filePath)) { 191 | throw new Error(`Missing file at path: ${filePath}`); 192 | } 193 | fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { 194 | encoding: "utf8" 195 | }); 196 | } 197 | exports.issueCommand = issueCommand; 198 | } 199 | }); 200 | 201 | // node_modules/uuid/dist/rng.js 202 | var require_rng = __commonJS({ 203 | "node_modules/uuid/dist/rng.js"(exports) { 204 | "use strict"; 205 | Object.defineProperty(exports, "__esModule", { 206 | value: true 207 | }); 208 | exports.default = rng; 209 | var _crypto = _interopRequireDefault(require("crypto")); 210 | function _interopRequireDefault(obj) { 211 | return obj && obj.__esModule ? obj : { default: obj }; 212 | } 213 | var rnds8Pool = new Uint8Array(256); 214 | var poolPtr = rnds8Pool.length; 215 | function rng() { 216 | if (poolPtr > rnds8Pool.length - 16) { 217 | _crypto.default.randomFillSync(rnds8Pool); 218 | poolPtr = 0; 219 | } 220 | return rnds8Pool.slice(poolPtr, poolPtr += 16); 221 | } 222 | } 223 | }); 224 | 225 | // node_modules/uuid/dist/regex.js 226 | var require_regex = __commonJS({ 227 | "node_modules/uuid/dist/regex.js"(exports) { 228 | "use strict"; 229 | Object.defineProperty(exports, "__esModule", { 230 | value: true 231 | }); 232 | exports.default = void 0; 233 | var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; 234 | exports.default = _default; 235 | } 236 | }); 237 | 238 | // node_modules/uuid/dist/validate.js 239 | var require_validate = __commonJS({ 240 | "node_modules/uuid/dist/validate.js"(exports) { 241 | "use strict"; 242 | Object.defineProperty(exports, "__esModule", { 243 | value: true 244 | }); 245 | exports.default = void 0; 246 | var _regex = _interopRequireDefault(require_regex()); 247 | function _interopRequireDefault(obj) { 248 | return obj && obj.__esModule ? obj : { default: obj }; 249 | } 250 | function validate(uuid) { 251 | return typeof uuid === "string" && _regex.default.test(uuid); 252 | } 253 | var _default = validate; 254 | exports.default = _default; 255 | } 256 | }); 257 | 258 | // node_modules/uuid/dist/stringify.js 259 | var require_stringify = __commonJS({ 260 | "node_modules/uuid/dist/stringify.js"(exports) { 261 | "use strict"; 262 | Object.defineProperty(exports, "__esModule", { 263 | value: true 264 | }); 265 | exports.default = void 0; 266 | var _validate = _interopRequireDefault(require_validate()); 267 | function _interopRequireDefault(obj) { 268 | return obj && obj.__esModule ? obj : { default: obj }; 269 | } 270 | var byteToHex = []; 271 | for (let i = 0; i < 256; ++i) { 272 | byteToHex.push((i + 256).toString(16).substr(1)); 273 | } 274 | function stringify(arr, offset = 0) { 275 | const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); 276 | if (!(0, _validate.default)(uuid)) { 277 | throw TypeError("Stringified UUID is invalid"); 278 | } 279 | return uuid; 280 | } 281 | var _default = stringify; 282 | exports.default = _default; 283 | } 284 | }); 285 | 286 | // node_modules/uuid/dist/v1.js 287 | var require_v1 = __commonJS({ 288 | "node_modules/uuid/dist/v1.js"(exports) { 289 | "use strict"; 290 | Object.defineProperty(exports, "__esModule", { 291 | value: true 292 | }); 293 | exports.default = void 0; 294 | var _rng = _interopRequireDefault(require_rng()); 295 | var _stringify = _interopRequireDefault(require_stringify()); 296 | function _interopRequireDefault(obj) { 297 | return obj && obj.__esModule ? obj : { default: obj }; 298 | } 299 | var _nodeId; 300 | var _clockseq; 301 | var _lastMSecs = 0; 302 | var _lastNSecs = 0; 303 | function v1(options, buf, offset) { 304 | let i = buf && offset || 0; 305 | const b = buf || new Array(16); 306 | options = options || {}; 307 | let node = options.node || _nodeId; 308 | let clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq; 309 | if (node == null || clockseq == null) { 310 | const seedBytes = options.random || (options.rng || _rng.default)(); 311 | if (node == null) { 312 | node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; 313 | } 314 | if (clockseq == null) { 315 | clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383; 316 | } 317 | } 318 | let msecs = options.msecs !== void 0 ? options.msecs : Date.now(); 319 | let nsecs = options.nsecs !== void 0 ? options.nsecs : _lastNSecs + 1; 320 | const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4; 321 | if (dt < 0 && options.clockseq === void 0) { 322 | clockseq = clockseq + 1 & 16383; 323 | } 324 | if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === void 0) { 325 | nsecs = 0; 326 | } 327 | if (nsecs >= 1e4) { 328 | throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); 329 | } 330 | _lastMSecs = msecs; 331 | _lastNSecs = nsecs; 332 | _clockseq = clockseq; 333 | msecs += 122192928e5; 334 | const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296; 335 | b[i++] = tl >>> 24 & 255; 336 | b[i++] = tl >>> 16 & 255; 337 | b[i++] = tl >>> 8 & 255; 338 | b[i++] = tl & 255; 339 | const tmh = msecs / 4294967296 * 1e4 & 268435455; 340 | b[i++] = tmh >>> 8 & 255; 341 | b[i++] = tmh & 255; 342 | b[i++] = tmh >>> 24 & 15 | 16; 343 | b[i++] = tmh >>> 16 & 255; 344 | b[i++] = clockseq >>> 8 | 128; 345 | b[i++] = clockseq & 255; 346 | for (let n = 0; n < 6; ++n) { 347 | b[i + n] = node[n]; 348 | } 349 | return buf || (0, _stringify.default)(b); 350 | } 351 | var _default = v1; 352 | exports.default = _default; 353 | } 354 | }); 355 | 356 | // node_modules/uuid/dist/parse.js 357 | var require_parse = __commonJS({ 358 | "node_modules/uuid/dist/parse.js"(exports) { 359 | "use strict"; 360 | Object.defineProperty(exports, "__esModule", { 361 | value: true 362 | }); 363 | exports.default = void 0; 364 | var _validate = _interopRequireDefault(require_validate()); 365 | function _interopRequireDefault(obj) { 366 | return obj && obj.__esModule ? obj : { default: obj }; 367 | } 368 | function parse(uuid) { 369 | if (!(0, _validate.default)(uuid)) { 370 | throw TypeError("Invalid UUID"); 371 | } 372 | let v; 373 | const arr = new Uint8Array(16); 374 | arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; 375 | arr[1] = v >>> 16 & 255; 376 | arr[2] = v >>> 8 & 255; 377 | arr[3] = v & 255; 378 | arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; 379 | arr[5] = v & 255; 380 | arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; 381 | arr[7] = v & 255; 382 | arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; 383 | arr[9] = v & 255; 384 | arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255; 385 | arr[11] = v / 4294967296 & 255; 386 | arr[12] = v >>> 24 & 255; 387 | arr[13] = v >>> 16 & 255; 388 | arr[14] = v >>> 8 & 255; 389 | arr[15] = v & 255; 390 | return arr; 391 | } 392 | var _default = parse; 393 | exports.default = _default; 394 | } 395 | }); 396 | 397 | // node_modules/uuid/dist/v35.js 398 | var require_v35 = __commonJS({ 399 | "node_modules/uuid/dist/v35.js"(exports) { 400 | "use strict"; 401 | Object.defineProperty(exports, "__esModule", { 402 | value: true 403 | }); 404 | exports.default = _default; 405 | exports.URL = exports.DNS = void 0; 406 | var _stringify = _interopRequireDefault(require_stringify()); 407 | var _parse = _interopRequireDefault(require_parse()); 408 | function _interopRequireDefault(obj) { 409 | return obj && obj.__esModule ? obj : { default: obj }; 410 | } 411 | function stringToBytes(str) { 412 | str = unescape(encodeURIComponent(str)); 413 | const bytes = []; 414 | for (let i = 0; i < str.length; ++i) { 415 | bytes.push(str.charCodeAt(i)); 416 | } 417 | return bytes; 418 | } 419 | var DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; 420 | exports.DNS = DNS; 421 | var URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"; 422 | exports.URL = URL2; 423 | function _default(name, version, hashfunc) { 424 | function generateUUID(value, namespace, buf, offset) { 425 | if (typeof value === "string") { 426 | value = stringToBytes(value); 427 | } 428 | if (typeof namespace === "string") { 429 | namespace = (0, _parse.default)(namespace); 430 | } 431 | if (namespace.length !== 16) { 432 | throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)"); 433 | } 434 | let bytes = new Uint8Array(16 + value.length); 435 | bytes.set(namespace); 436 | bytes.set(value, namespace.length); 437 | bytes = hashfunc(bytes); 438 | bytes[6] = bytes[6] & 15 | version; 439 | bytes[8] = bytes[8] & 63 | 128; 440 | if (buf) { 441 | offset = offset || 0; 442 | for (let i = 0; i < 16; ++i) { 443 | buf[offset + i] = bytes[i]; 444 | } 445 | return buf; 446 | } 447 | return (0, _stringify.default)(bytes); 448 | } 449 | try { 450 | generateUUID.name = name; 451 | } catch (err) { 452 | } 453 | generateUUID.DNS = DNS; 454 | generateUUID.URL = URL2; 455 | return generateUUID; 456 | } 457 | } 458 | }); 459 | 460 | // node_modules/uuid/dist/md5.js 461 | var require_md5 = __commonJS({ 462 | "node_modules/uuid/dist/md5.js"(exports) { 463 | "use strict"; 464 | Object.defineProperty(exports, "__esModule", { 465 | value: true 466 | }); 467 | exports.default = void 0; 468 | var _crypto = _interopRequireDefault(require("crypto")); 469 | function _interopRequireDefault(obj) { 470 | return obj && obj.__esModule ? obj : { default: obj }; 471 | } 472 | function md5(bytes) { 473 | if (Array.isArray(bytes)) { 474 | bytes = Buffer.from(bytes); 475 | } else if (typeof bytes === "string") { 476 | bytes = Buffer.from(bytes, "utf8"); 477 | } 478 | return _crypto.default.createHash("md5").update(bytes).digest(); 479 | } 480 | var _default = md5; 481 | exports.default = _default; 482 | } 483 | }); 484 | 485 | // node_modules/uuid/dist/v3.js 486 | var require_v3 = __commonJS({ 487 | "node_modules/uuid/dist/v3.js"(exports) { 488 | "use strict"; 489 | Object.defineProperty(exports, "__esModule", { 490 | value: true 491 | }); 492 | exports.default = void 0; 493 | var _v = _interopRequireDefault(require_v35()); 494 | var _md = _interopRequireDefault(require_md5()); 495 | function _interopRequireDefault(obj) { 496 | return obj && obj.__esModule ? obj : { default: obj }; 497 | } 498 | var v3 = (0, _v.default)("v3", 48, _md.default); 499 | var _default = v3; 500 | exports.default = _default; 501 | } 502 | }); 503 | 504 | // node_modules/uuid/dist/v4.js 505 | var require_v4 = __commonJS({ 506 | "node_modules/uuid/dist/v4.js"(exports) { 507 | "use strict"; 508 | Object.defineProperty(exports, "__esModule", { 509 | value: true 510 | }); 511 | exports.default = void 0; 512 | var _rng = _interopRequireDefault(require_rng()); 513 | var _stringify = _interopRequireDefault(require_stringify()); 514 | function _interopRequireDefault(obj) { 515 | return obj && obj.__esModule ? obj : { default: obj }; 516 | } 517 | function v4(options, buf, offset) { 518 | options = options || {}; 519 | const rnds = options.random || (options.rng || _rng.default)(); 520 | rnds[6] = rnds[6] & 15 | 64; 521 | rnds[8] = rnds[8] & 63 | 128; 522 | if (buf) { 523 | offset = offset || 0; 524 | for (let i = 0; i < 16; ++i) { 525 | buf[offset + i] = rnds[i]; 526 | } 527 | return buf; 528 | } 529 | return (0, _stringify.default)(rnds); 530 | } 531 | var _default = v4; 532 | exports.default = _default; 533 | } 534 | }); 535 | 536 | // node_modules/uuid/dist/sha1.js 537 | var require_sha1 = __commonJS({ 538 | "node_modules/uuid/dist/sha1.js"(exports) { 539 | "use strict"; 540 | Object.defineProperty(exports, "__esModule", { 541 | value: true 542 | }); 543 | exports.default = void 0; 544 | var _crypto = _interopRequireDefault(require("crypto")); 545 | function _interopRequireDefault(obj) { 546 | return obj && obj.__esModule ? obj : { default: obj }; 547 | } 548 | function sha1(bytes) { 549 | if (Array.isArray(bytes)) { 550 | bytes = Buffer.from(bytes); 551 | } else if (typeof bytes === "string") { 552 | bytes = Buffer.from(bytes, "utf8"); 553 | } 554 | return _crypto.default.createHash("sha1").update(bytes).digest(); 555 | } 556 | var _default = sha1; 557 | exports.default = _default; 558 | } 559 | }); 560 | 561 | // node_modules/uuid/dist/v5.js 562 | var require_v5 = __commonJS({ 563 | "node_modules/uuid/dist/v5.js"(exports) { 564 | "use strict"; 565 | Object.defineProperty(exports, "__esModule", { 566 | value: true 567 | }); 568 | exports.default = void 0; 569 | var _v = _interopRequireDefault(require_v35()); 570 | var _sha = _interopRequireDefault(require_sha1()); 571 | function _interopRequireDefault(obj) { 572 | return obj && obj.__esModule ? obj : { default: obj }; 573 | } 574 | var v5 = (0, _v.default)("v5", 80, _sha.default); 575 | var _default = v5; 576 | exports.default = _default; 577 | } 578 | }); 579 | 580 | // node_modules/uuid/dist/nil.js 581 | var require_nil = __commonJS({ 582 | "node_modules/uuid/dist/nil.js"(exports) { 583 | "use strict"; 584 | Object.defineProperty(exports, "__esModule", { 585 | value: true 586 | }); 587 | exports.default = void 0; 588 | var _default = "00000000-0000-0000-0000-000000000000"; 589 | exports.default = _default; 590 | } 591 | }); 592 | 593 | // node_modules/uuid/dist/version.js 594 | var require_version = __commonJS({ 595 | "node_modules/uuid/dist/version.js"(exports) { 596 | "use strict"; 597 | Object.defineProperty(exports, "__esModule", { 598 | value: true 599 | }); 600 | exports.default = void 0; 601 | var _validate = _interopRequireDefault(require_validate()); 602 | function _interopRequireDefault(obj) { 603 | return obj && obj.__esModule ? obj : { default: obj }; 604 | } 605 | function version(uuid) { 606 | if (!(0, _validate.default)(uuid)) { 607 | throw TypeError("Invalid UUID"); 608 | } 609 | return parseInt(uuid.substr(14, 1), 16); 610 | } 611 | var _default = version; 612 | exports.default = _default; 613 | } 614 | }); 615 | 616 | // node_modules/uuid/dist/index.js 617 | var require_dist = __commonJS({ 618 | "node_modules/uuid/dist/index.js"(exports) { 619 | "use strict"; 620 | Object.defineProperty(exports, "__esModule", { 621 | value: true 622 | }); 623 | Object.defineProperty(exports, "v1", { 624 | enumerable: true, 625 | get: function() { 626 | return _v.default; 627 | } 628 | }); 629 | Object.defineProperty(exports, "v3", { 630 | enumerable: true, 631 | get: function() { 632 | return _v2.default; 633 | } 634 | }); 635 | Object.defineProperty(exports, "v4", { 636 | enumerable: true, 637 | get: function() { 638 | return _v3.default; 639 | } 640 | }); 641 | Object.defineProperty(exports, "v5", { 642 | enumerable: true, 643 | get: function() { 644 | return _v4.default; 645 | } 646 | }); 647 | Object.defineProperty(exports, "NIL", { 648 | enumerable: true, 649 | get: function() { 650 | return _nil.default; 651 | } 652 | }); 653 | Object.defineProperty(exports, "version", { 654 | enumerable: true, 655 | get: function() { 656 | return _version.default; 657 | } 658 | }); 659 | Object.defineProperty(exports, "validate", { 660 | enumerable: true, 661 | get: function() { 662 | return _validate.default; 663 | } 664 | }); 665 | Object.defineProperty(exports, "stringify", { 666 | enumerable: true, 667 | get: function() { 668 | return _stringify.default; 669 | } 670 | }); 671 | Object.defineProperty(exports, "parse", { 672 | enumerable: true, 673 | get: function() { 674 | return _parse.default; 675 | } 676 | }); 677 | var _v = _interopRequireDefault(require_v1()); 678 | var _v2 = _interopRequireDefault(require_v3()); 679 | var _v3 = _interopRequireDefault(require_v4()); 680 | var _v4 = _interopRequireDefault(require_v5()); 681 | var _nil = _interopRequireDefault(require_nil()); 682 | var _version = _interopRequireDefault(require_version()); 683 | var _validate = _interopRequireDefault(require_validate()); 684 | var _stringify = _interopRequireDefault(require_stringify()); 685 | var _parse = _interopRequireDefault(require_parse()); 686 | function _interopRequireDefault(obj) { 687 | return obj && obj.__esModule ? obj : { default: obj }; 688 | } 689 | } 690 | }); 691 | 692 | // node_modules/@actions/http-client/lib/proxy.js 693 | var require_proxy = __commonJS({ 694 | "node_modules/@actions/http-client/lib/proxy.js"(exports) { 695 | "use strict"; 696 | Object.defineProperty(exports, "__esModule", { value: true }); 697 | exports.checkBypass = exports.getProxyUrl = void 0; 698 | function getProxyUrl(reqUrl) { 699 | const usingSsl = reqUrl.protocol === "https:"; 700 | if (checkBypass(reqUrl)) { 701 | return void 0; 702 | } 703 | const proxyVar = (() => { 704 | if (usingSsl) { 705 | return process.env["https_proxy"] || process.env["HTTPS_PROXY"]; 706 | } else { 707 | return process.env["http_proxy"] || process.env["HTTP_PROXY"]; 708 | } 709 | })(); 710 | if (proxyVar) { 711 | return new URL(proxyVar); 712 | } else { 713 | return void 0; 714 | } 715 | } 716 | exports.getProxyUrl = getProxyUrl; 717 | function checkBypass(reqUrl) { 718 | if (!reqUrl.hostname) { 719 | return false; 720 | } 721 | const noProxy = process.env["no_proxy"] || process.env["NO_PROXY"] || ""; 722 | if (!noProxy) { 723 | return false; 724 | } 725 | let reqPort; 726 | if (reqUrl.port) { 727 | reqPort = Number(reqUrl.port); 728 | } else if (reqUrl.protocol === "http:") { 729 | reqPort = 80; 730 | } else if (reqUrl.protocol === "https:") { 731 | reqPort = 443; 732 | } 733 | const upperReqHosts = [reqUrl.hostname.toUpperCase()]; 734 | if (typeof reqPort === "number") { 735 | upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); 736 | } 737 | for (const upperNoProxyItem of noProxy.split(",").map((x) => x.trim().toUpperCase()).filter((x) => x)) { 738 | if (upperReqHosts.some((x) => x === upperNoProxyItem)) { 739 | return true; 740 | } 741 | } 742 | return false; 743 | } 744 | exports.checkBypass = checkBypass; 745 | } 746 | }); 747 | 748 | // node_modules/tunnel/lib/tunnel.js 749 | var require_tunnel = __commonJS({ 750 | "node_modules/tunnel/lib/tunnel.js"(exports) { 751 | "use strict"; 752 | var net = require("net"); 753 | var tls = require("tls"); 754 | var http = require("http"); 755 | var https = require("https"); 756 | var events = require("events"); 757 | var assert = require("assert"); 758 | var util = require("util"); 759 | exports.httpOverHttp = httpOverHttp; 760 | exports.httpsOverHttp = httpsOverHttp; 761 | exports.httpOverHttps = httpOverHttps; 762 | exports.httpsOverHttps = httpsOverHttps; 763 | function httpOverHttp(options) { 764 | var agent = new TunnelingAgent(options); 765 | agent.request = http.request; 766 | return agent; 767 | } 768 | function httpsOverHttp(options) { 769 | var agent = new TunnelingAgent(options); 770 | agent.request = http.request; 771 | agent.createSocket = createSecureSocket; 772 | agent.defaultPort = 443; 773 | return agent; 774 | } 775 | function httpOverHttps(options) { 776 | var agent = new TunnelingAgent(options); 777 | agent.request = https.request; 778 | return agent; 779 | } 780 | function httpsOverHttps(options) { 781 | var agent = new TunnelingAgent(options); 782 | agent.request = https.request; 783 | agent.createSocket = createSecureSocket; 784 | agent.defaultPort = 443; 785 | return agent; 786 | } 787 | function TunnelingAgent(options) { 788 | var self = this; 789 | self.options = options || {}; 790 | self.proxyOptions = self.options.proxy || {}; 791 | self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; 792 | self.requests = []; 793 | self.sockets = []; 794 | self.on("free", function onFree(socket, host, port, localAddress) { 795 | var options2 = toOptions(host, port, localAddress); 796 | for (var i = 0, len = self.requests.length; i < len; ++i) { 797 | var pending = self.requests[i]; 798 | if (pending.host === options2.host && pending.port === options2.port) { 799 | self.requests.splice(i, 1); 800 | pending.request.onSocket(socket); 801 | return; 802 | } 803 | } 804 | socket.destroy(); 805 | self.removeSocket(socket); 806 | }); 807 | } 808 | util.inherits(TunnelingAgent, events.EventEmitter); 809 | TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { 810 | var self = this; 811 | var options = mergeOptions({ request: req }, self.options, toOptions(host, port, localAddress)); 812 | if (self.sockets.length >= this.maxSockets) { 813 | self.requests.push(options); 814 | return; 815 | } 816 | self.createSocket(options, function(socket) { 817 | socket.on("free", onFree); 818 | socket.on("close", onCloseOrRemove); 819 | socket.on("agentRemove", onCloseOrRemove); 820 | req.onSocket(socket); 821 | function onFree() { 822 | self.emit("free", socket, options); 823 | } 824 | function onCloseOrRemove(err) { 825 | self.removeSocket(socket); 826 | socket.removeListener("free", onFree); 827 | socket.removeListener("close", onCloseOrRemove); 828 | socket.removeListener("agentRemove", onCloseOrRemove); 829 | } 830 | }); 831 | }; 832 | TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { 833 | var self = this; 834 | var placeholder = {}; 835 | self.sockets.push(placeholder); 836 | var connectOptions = mergeOptions({}, self.proxyOptions, { 837 | method: "CONNECT", 838 | path: options.host + ":" + options.port, 839 | agent: false, 840 | headers: { 841 | host: options.host + ":" + options.port 842 | } 843 | }); 844 | if (options.localAddress) { 845 | connectOptions.localAddress = options.localAddress; 846 | } 847 | if (connectOptions.proxyAuth) { 848 | connectOptions.headers = connectOptions.headers || {}; 849 | connectOptions.headers["Proxy-Authorization"] = "Basic " + new Buffer(connectOptions.proxyAuth).toString("base64"); 850 | } 851 | debug("making CONNECT request"); 852 | var connectReq = self.request(connectOptions); 853 | connectReq.useChunkedEncodingByDefault = false; 854 | connectReq.once("response", onResponse); 855 | connectReq.once("upgrade", onUpgrade); 856 | connectReq.once("connect", onConnect); 857 | connectReq.once("error", onError); 858 | connectReq.end(); 859 | function onResponse(res) { 860 | res.upgrade = true; 861 | } 862 | function onUpgrade(res, socket, head) { 863 | process.nextTick(function() { 864 | onConnect(res, socket, head); 865 | }); 866 | } 867 | function onConnect(res, socket, head) { 868 | connectReq.removeAllListeners(); 869 | socket.removeAllListeners(); 870 | if (res.statusCode !== 200) { 871 | debug( 872 | "tunneling socket could not be established, statusCode=%d", 873 | res.statusCode 874 | ); 875 | socket.destroy(); 876 | var error = new Error("tunneling socket could not be established, statusCode=" + res.statusCode); 877 | error.code = "ECONNRESET"; 878 | options.request.emit("error", error); 879 | self.removeSocket(placeholder); 880 | return; 881 | } 882 | if (head.length > 0) { 883 | debug("got illegal response body from proxy"); 884 | socket.destroy(); 885 | var error = new Error("got illegal response body from proxy"); 886 | error.code = "ECONNRESET"; 887 | options.request.emit("error", error); 888 | self.removeSocket(placeholder); 889 | return; 890 | } 891 | debug("tunneling connection has established"); 892 | self.sockets[self.sockets.indexOf(placeholder)] = socket; 893 | return cb(socket); 894 | } 895 | function onError(cause) { 896 | connectReq.removeAllListeners(); 897 | debug( 898 | "tunneling socket could not be established, cause=%s\n", 899 | cause.message, 900 | cause.stack 901 | ); 902 | var error = new Error("tunneling socket could not be established, cause=" + cause.message); 903 | error.code = "ECONNRESET"; 904 | options.request.emit("error", error); 905 | self.removeSocket(placeholder); 906 | } 907 | }; 908 | TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { 909 | var pos = this.sockets.indexOf(socket); 910 | if (pos === -1) { 911 | return; 912 | } 913 | this.sockets.splice(pos, 1); 914 | var pending = this.requests.shift(); 915 | if (pending) { 916 | this.createSocket(pending, function(socket2) { 917 | pending.request.onSocket(socket2); 918 | }); 919 | } 920 | }; 921 | function createSecureSocket(options, cb) { 922 | var self = this; 923 | TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { 924 | var hostHeader = options.request.getHeader("host"); 925 | var tlsOptions = mergeOptions({}, self.options, { 926 | socket, 927 | servername: hostHeader ? hostHeader.replace(/:.*$/, "") : options.host 928 | }); 929 | var secureSocket = tls.connect(0, tlsOptions); 930 | self.sockets[self.sockets.indexOf(socket)] = secureSocket; 931 | cb(secureSocket); 932 | }); 933 | } 934 | function toOptions(host, port, localAddress) { 935 | if (typeof host === "string") { 936 | return { 937 | host, 938 | port, 939 | localAddress 940 | }; 941 | } 942 | return host; 943 | } 944 | function mergeOptions(target) { 945 | for (var i = 1, len = arguments.length; i < len; ++i) { 946 | var overrides = arguments[i]; 947 | if (typeof overrides === "object") { 948 | var keys = Object.keys(overrides); 949 | for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { 950 | var k = keys[j]; 951 | if (overrides[k] !== void 0) { 952 | target[k] = overrides[k]; 953 | } 954 | } 955 | } 956 | } 957 | return target; 958 | } 959 | var debug; 960 | if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { 961 | debug = function() { 962 | var args = Array.prototype.slice.call(arguments); 963 | if (typeof args[0] === "string") { 964 | args[0] = "TUNNEL: " + args[0]; 965 | } else { 966 | args.unshift("TUNNEL:"); 967 | } 968 | console.error.apply(console, args); 969 | }; 970 | } else { 971 | debug = function() { 972 | }; 973 | } 974 | exports.debug = debug; 975 | } 976 | }); 977 | 978 | // node_modules/tunnel/index.js 979 | var require_tunnel2 = __commonJS({ 980 | "node_modules/tunnel/index.js"(exports, module2) { 981 | module2.exports = require_tunnel(); 982 | } 983 | }); 984 | 985 | // node_modules/@actions/http-client/lib/index.js 986 | var require_lib = __commonJS({ 987 | "node_modules/@actions/http-client/lib/index.js"(exports) { 988 | "use strict"; 989 | var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { 990 | if (k2 === void 0) 991 | k2 = k; 992 | Object.defineProperty(o, k2, { enumerable: true, get: function() { 993 | return m[k]; 994 | } }); 995 | } : function(o, m, k, k2) { 996 | if (k2 === void 0) 997 | k2 = k; 998 | o[k2] = m[k]; 999 | }); 1000 | var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { 1001 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 1002 | } : function(o, v) { 1003 | o["default"] = v; 1004 | }); 1005 | var __importStar = exports && exports.__importStar || function(mod) { 1006 | if (mod && mod.__esModule) 1007 | return mod; 1008 | var result = {}; 1009 | if (mod != null) { 1010 | for (var k in mod) 1011 | if (k !== "default" && Object.hasOwnProperty.call(mod, k)) 1012 | __createBinding(result, mod, k); 1013 | } 1014 | __setModuleDefault(result, mod); 1015 | return result; 1016 | }; 1017 | var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { 1018 | function adopt(value) { 1019 | return value instanceof P ? value : new P(function(resolve) { 1020 | resolve(value); 1021 | }); 1022 | } 1023 | return new (P || (P = Promise))(function(resolve, reject) { 1024 | function fulfilled(value) { 1025 | try { 1026 | step(generator.next(value)); 1027 | } catch (e) { 1028 | reject(e); 1029 | } 1030 | } 1031 | function rejected(value) { 1032 | try { 1033 | step(generator["throw"](value)); 1034 | } catch (e) { 1035 | reject(e); 1036 | } 1037 | } 1038 | function step(result) { 1039 | result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 1040 | } 1041 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 1042 | }); 1043 | }; 1044 | Object.defineProperty(exports, "__esModule", { value: true }); 1045 | exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; 1046 | var http = __importStar(require("http")); 1047 | var https = __importStar(require("https")); 1048 | var pm = __importStar(require_proxy()); 1049 | var tunnel = __importStar(require_tunnel2()); 1050 | var HttpCodes; 1051 | (function(HttpCodes2) { 1052 | HttpCodes2[HttpCodes2["OK"] = 200] = "OK"; 1053 | HttpCodes2[HttpCodes2["MultipleChoices"] = 300] = "MultipleChoices"; 1054 | HttpCodes2[HttpCodes2["MovedPermanently"] = 301] = "MovedPermanently"; 1055 | HttpCodes2[HttpCodes2["ResourceMoved"] = 302] = "ResourceMoved"; 1056 | HttpCodes2[HttpCodes2["SeeOther"] = 303] = "SeeOther"; 1057 | HttpCodes2[HttpCodes2["NotModified"] = 304] = "NotModified"; 1058 | HttpCodes2[HttpCodes2["UseProxy"] = 305] = "UseProxy"; 1059 | HttpCodes2[HttpCodes2["SwitchProxy"] = 306] = "SwitchProxy"; 1060 | HttpCodes2[HttpCodes2["TemporaryRedirect"] = 307] = "TemporaryRedirect"; 1061 | HttpCodes2[HttpCodes2["PermanentRedirect"] = 308] = "PermanentRedirect"; 1062 | HttpCodes2[HttpCodes2["BadRequest"] = 400] = "BadRequest"; 1063 | HttpCodes2[HttpCodes2["Unauthorized"] = 401] = "Unauthorized"; 1064 | HttpCodes2[HttpCodes2["PaymentRequired"] = 402] = "PaymentRequired"; 1065 | HttpCodes2[HttpCodes2["Forbidden"] = 403] = "Forbidden"; 1066 | HttpCodes2[HttpCodes2["NotFound"] = 404] = "NotFound"; 1067 | HttpCodes2[HttpCodes2["MethodNotAllowed"] = 405] = "MethodNotAllowed"; 1068 | HttpCodes2[HttpCodes2["NotAcceptable"] = 406] = "NotAcceptable"; 1069 | HttpCodes2[HttpCodes2["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; 1070 | HttpCodes2[HttpCodes2["RequestTimeout"] = 408] = "RequestTimeout"; 1071 | HttpCodes2[HttpCodes2["Conflict"] = 409] = "Conflict"; 1072 | HttpCodes2[HttpCodes2["Gone"] = 410] = "Gone"; 1073 | HttpCodes2[HttpCodes2["TooManyRequests"] = 429] = "TooManyRequests"; 1074 | HttpCodes2[HttpCodes2["InternalServerError"] = 500] = "InternalServerError"; 1075 | HttpCodes2[HttpCodes2["NotImplemented"] = 501] = "NotImplemented"; 1076 | HttpCodes2[HttpCodes2["BadGateway"] = 502] = "BadGateway"; 1077 | HttpCodes2[HttpCodes2["ServiceUnavailable"] = 503] = "ServiceUnavailable"; 1078 | HttpCodes2[HttpCodes2["GatewayTimeout"] = 504] = "GatewayTimeout"; 1079 | })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); 1080 | var Headers; 1081 | (function(Headers2) { 1082 | Headers2["Accept"] = "accept"; 1083 | Headers2["ContentType"] = "content-type"; 1084 | })(Headers = exports.Headers || (exports.Headers = {})); 1085 | var MediaTypes; 1086 | (function(MediaTypes2) { 1087 | MediaTypes2["ApplicationJson"] = "application/json"; 1088 | })(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); 1089 | function getProxyUrl(serverUrl) { 1090 | const proxyUrl = pm.getProxyUrl(new URL(serverUrl)); 1091 | return proxyUrl ? proxyUrl.href : ""; 1092 | } 1093 | exports.getProxyUrl = getProxyUrl; 1094 | var HttpRedirectCodes = [ 1095 | HttpCodes.MovedPermanently, 1096 | HttpCodes.ResourceMoved, 1097 | HttpCodes.SeeOther, 1098 | HttpCodes.TemporaryRedirect, 1099 | HttpCodes.PermanentRedirect 1100 | ]; 1101 | var HttpResponseRetryCodes = [ 1102 | HttpCodes.BadGateway, 1103 | HttpCodes.ServiceUnavailable, 1104 | HttpCodes.GatewayTimeout 1105 | ]; 1106 | var RetryableHttpVerbs = ["OPTIONS", "GET", "DELETE", "HEAD"]; 1107 | var ExponentialBackoffCeiling = 10; 1108 | var ExponentialBackoffTimeSlice = 5; 1109 | var HttpClientError = class extends Error { 1110 | constructor(message, statusCode) { 1111 | super(message); 1112 | this.name = "HttpClientError"; 1113 | this.statusCode = statusCode; 1114 | Object.setPrototypeOf(this, HttpClientError.prototype); 1115 | } 1116 | }; 1117 | exports.HttpClientError = HttpClientError; 1118 | var HttpClientResponse = class { 1119 | constructor(message) { 1120 | this.message = message; 1121 | } 1122 | readBody() { 1123 | return __awaiter(this, void 0, void 0, function* () { 1124 | return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { 1125 | let output = Buffer.alloc(0); 1126 | this.message.on("data", (chunk) => { 1127 | output = Buffer.concat([output, chunk]); 1128 | }); 1129 | this.message.on("end", () => { 1130 | resolve(output.toString()); 1131 | }); 1132 | })); 1133 | }); 1134 | } 1135 | }; 1136 | exports.HttpClientResponse = HttpClientResponse; 1137 | function isHttps(requestUrl) { 1138 | const parsedUrl = new URL(requestUrl); 1139 | return parsedUrl.protocol === "https:"; 1140 | } 1141 | exports.isHttps = isHttps; 1142 | var HttpClient = class { 1143 | constructor(userAgent, handlers, requestOptions) { 1144 | this._ignoreSslError = false; 1145 | this._allowRedirects = true; 1146 | this._allowRedirectDowngrade = false; 1147 | this._maxRedirects = 50; 1148 | this._allowRetries = false; 1149 | this._maxRetries = 1; 1150 | this._keepAlive = false; 1151 | this._disposed = false; 1152 | this.userAgent = userAgent; 1153 | this.handlers = handlers || []; 1154 | this.requestOptions = requestOptions; 1155 | if (requestOptions) { 1156 | if (requestOptions.ignoreSslError != null) { 1157 | this._ignoreSslError = requestOptions.ignoreSslError; 1158 | } 1159 | this._socketTimeout = requestOptions.socketTimeout; 1160 | if (requestOptions.allowRedirects != null) { 1161 | this._allowRedirects = requestOptions.allowRedirects; 1162 | } 1163 | if (requestOptions.allowRedirectDowngrade != null) { 1164 | this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; 1165 | } 1166 | if (requestOptions.maxRedirects != null) { 1167 | this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); 1168 | } 1169 | if (requestOptions.keepAlive != null) { 1170 | this._keepAlive = requestOptions.keepAlive; 1171 | } 1172 | if (requestOptions.allowRetries != null) { 1173 | this._allowRetries = requestOptions.allowRetries; 1174 | } 1175 | if (requestOptions.maxRetries != null) { 1176 | this._maxRetries = requestOptions.maxRetries; 1177 | } 1178 | } 1179 | } 1180 | options(requestUrl, additionalHeaders) { 1181 | return __awaiter(this, void 0, void 0, function* () { 1182 | return this.request("OPTIONS", requestUrl, null, additionalHeaders || {}); 1183 | }); 1184 | } 1185 | get(requestUrl, additionalHeaders) { 1186 | return __awaiter(this, void 0, void 0, function* () { 1187 | return this.request("GET", requestUrl, null, additionalHeaders || {}); 1188 | }); 1189 | } 1190 | del(requestUrl, additionalHeaders) { 1191 | return __awaiter(this, void 0, void 0, function* () { 1192 | return this.request("DELETE", requestUrl, null, additionalHeaders || {}); 1193 | }); 1194 | } 1195 | post(requestUrl, data, additionalHeaders) { 1196 | return __awaiter(this, void 0, void 0, function* () { 1197 | return this.request("POST", requestUrl, data, additionalHeaders || {}); 1198 | }); 1199 | } 1200 | patch(requestUrl, data, additionalHeaders) { 1201 | return __awaiter(this, void 0, void 0, function* () { 1202 | return this.request("PATCH", requestUrl, data, additionalHeaders || {}); 1203 | }); 1204 | } 1205 | put(requestUrl, data, additionalHeaders) { 1206 | return __awaiter(this, void 0, void 0, function* () { 1207 | return this.request("PUT", requestUrl, data, additionalHeaders || {}); 1208 | }); 1209 | } 1210 | head(requestUrl, additionalHeaders) { 1211 | return __awaiter(this, void 0, void 0, function* () { 1212 | return this.request("HEAD", requestUrl, null, additionalHeaders || {}); 1213 | }); 1214 | } 1215 | sendStream(verb, requestUrl, stream, additionalHeaders) { 1216 | return __awaiter(this, void 0, void 0, function* () { 1217 | return this.request(verb, requestUrl, stream, additionalHeaders); 1218 | }); 1219 | } 1220 | getJson(requestUrl, additionalHeaders = {}) { 1221 | return __awaiter(this, void 0, void 0, function* () { 1222 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1223 | const res = yield this.get(requestUrl, additionalHeaders); 1224 | return this._processResponse(res, this.requestOptions); 1225 | }); 1226 | } 1227 | postJson(requestUrl, obj, additionalHeaders = {}) { 1228 | return __awaiter(this, void 0, void 0, function* () { 1229 | const data = JSON.stringify(obj, null, 2); 1230 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1231 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1232 | const res = yield this.post(requestUrl, data, additionalHeaders); 1233 | return this._processResponse(res, this.requestOptions); 1234 | }); 1235 | } 1236 | putJson(requestUrl, obj, additionalHeaders = {}) { 1237 | return __awaiter(this, void 0, void 0, function* () { 1238 | const data = JSON.stringify(obj, null, 2); 1239 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1240 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1241 | const res = yield this.put(requestUrl, data, additionalHeaders); 1242 | return this._processResponse(res, this.requestOptions); 1243 | }); 1244 | } 1245 | patchJson(requestUrl, obj, additionalHeaders = {}) { 1246 | return __awaiter(this, void 0, void 0, function* () { 1247 | const data = JSON.stringify(obj, null, 2); 1248 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1249 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1250 | const res = yield this.patch(requestUrl, data, additionalHeaders); 1251 | return this._processResponse(res, this.requestOptions); 1252 | }); 1253 | } 1254 | request(verb, requestUrl, data, headers) { 1255 | return __awaiter(this, void 0, void 0, function* () { 1256 | if (this._disposed) { 1257 | throw new Error("Client has already been disposed."); 1258 | } 1259 | const parsedUrl = new URL(requestUrl); 1260 | let info = this._prepareRequest(verb, parsedUrl, headers); 1261 | const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) ? this._maxRetries + 1 : 1; 1262 | let numTries = 0; 1263 | let response; 1264 | do { 1265 | response = yield this.requestRaw(info, data); 1266 | if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) { 1267 | let authenticationHandler; 1268 | for (const handler of this.handlers) { 1269 | if (handler.canHandleAuthentication(response)) { 1270 | authenticationHandler = handler; 1271 | break; 1272 | } 1273 | } 1274 | if (authenticationHandler) { 1275 | return authenticationHandler.handleAuthentication(this, info, data); 1276 | } else { 1277 | return response; 1278 | } 1279 | } 1280 | let redirectsRemaining = this._maxRedirects; 1281 | while (response.message.statusCode && HttpRedirectCodes.includes(response.message.statusCode) && this._allowRedirects && redirectsRemaining > 0) { 1282 | const redirectUrl = response.message.headers["location"]; 1283 | if (!redirectUrl) { 1284 | break; 1285 | } 1286 | const parsedRedirectUrl = new URL(redirectUrl); 1287 | if (parsedUrl.protocol === "https:" && parsedUrl.protocol !== parsedRedirectUrl.protocol && !this._allowRedirectDowngrade) { 1288 | throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true."); 1289 | } 1290 | yield response.readBody(); 1291 | if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { 1292 | for (const header in headers) { 1293 | if (header.toLowerCase() === "authorization") { 1294 | delete headers[header]; 1295 | } 1296 | } 1297 | } 1298 | info = this._prepareRequest(verb, parsedRedirectUrl, headers); 1299 | response = yield this.requestRaw(info, data); 1300 | redirectsRemaining--; 1301 | } 1302 | if (!response.message.statusCode || !HttpResponseRetryCodes.includes(response.message.statusCode)) { 1303 | return response; 1304 | } 1305 | numTries += 1; 1306 | if (numTries < maxTries) { 1307 | yield response.readBody(); 1308 | yield this._performExponentialBackoff(numTries); 1309 | } 1310 | } while (numTries < maxTries); 1311 | return response; 1312 | }); 1313 | } 1314 | dispose() { 1315 | if (this._agent) { 1316 | this._agent.destroy(); 1317 | } 1318 | this._disposed = true; 1319 | } 1320 | requestRaw(info, data) { 1321 | return __awaiter(this, void 0, void 0, function* () { 1322 | return new Promise((resolve, reject) => { 1323 | function callbackForResult(err, res) { 1324 | if (err) { 1325 | reject(err); 1326 | } else if (!res) { 1327 | reject(new Error("Unknown error")); 1328 | } else { 1329 | resolve(res); 1330 | } 1331 | } 1332 | this.requestRawWithCallback(info, data, callbackForResult); 1333 | }); 1334 | }); 1335 | } 1336 | requestRawWithCallback(info, data, onResult) { 1337 | if (typeof data === "string") { 1338 | if (!info.options.headers) { 1339 | info.options.headers = {}; 1340 | } 1341 | info.options.headers["Content-Length"] = Buffer.byteLength(data, "utf8"); 1342 | } 1343 | let callbackCalled = false; 1344 | function handleResult(err, res) { 1345 | if (!callbackCalled) { 1346 | callbackCalled = true; 1347 | onResult(err, res); 1348 | } 1349 | } 1350 | const req = info.httpModule.request(info.options, (msg) => { 1351 | const res = new HttpClientResponse(msg); 1352 | handleResult(void 0, res); 1353 | }); 1354 | let socket; 1355 | req.on("socket", (sock) => { 1356 | socket = sock; 1357 | }); 1358 | req.setTimeout(this._socketTimeout || 3 * 6e4, () => { 1359 | if (socket) { 1360 | socket.end(); 1361 | } 1362 | handleResult(new Error(`Request timeout: ${info.options.path}`)); 1363 | }); 1364 | req.on("error", function(err) { 1365 | handleResult(err); 1366 | }); 1367 | if (data && typeof data === "string") { 1368 | req.write(data, "utf8"); 1369 | } 1370 | if (data && typeof data !== "string") { 1371 | data.on("close", function() { 1372 | req.end(); 1373 | }); 1374 | data.pipe(req); 1375 | } else { 1376 | req.end(); 1377 | } 1378 | } 1379 | getAgent(serverUrl) { 1380 | const parsedUrl = new URL(serverUrl); 1381 | return this._getAgent(parsedUrl); 1382 | } 1383 | _prepareRequest(method, requestUrl, headers) { 1384 | const info = {}; 1385 | info.parsedUrl = requestUrl; 1386 | const usingSsl = info.parsedUrl.protocol === "https:"; 1387 | info.httpModule = usingSsl ? https : http; 1388 | const defaultPort = usingSsl ? 443 : 80; 1389 | info.options = {}; 1390 | info.options.host = info.parsedUrl.hostname; 1391 | info.options.port = info.parsedUrl.port ? parseInt(info.parsedUrl.port) : defaultPort; 1392 | info.options.path = (info.parsedUrl.pathname || "") + (info.parsedUrl.search || ""); 1393 | info.options.method = method; 1394 | info.options.headers = this._mergeHeaders(headers); 1395 | if (this.userAgent != null) { 1396 | info.options.headers["user-agent"] = this.userAgent; 1397 | } 1398 | info.options.agent = this._getAgent(info.parsedUrl); 1399 | if (this.handlers) { 1400 | for (const handler of this.handlers) { 1401 | handler.prepareRequest(info.options); 1402 | } 1403 | } 1404 | return info; 1405 | } 1406 | _mergeHeaders(headers) { 1407 | if (this.requestOptions && this.requestOptions.headers) { 1408 | return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {})); 1409 | } 1410 | return lowercaseKeys(headers || {}); 1411 | } 1412 | _getExistingOrDefaultHeader(additionalHeaders, header, _default) { 1413 | let clientHeader; 1414 | if (this.requestOptions && this.requestOptions.headers) { 1415 | clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; 1416 | } 1417 | return additionalHeaders[header] || clientHeader || _default; 1418 | } 1419 | _getAgent(parsedUrl) { 1420 | let agent; 1421 | const proxyUrl = pm.getProxyUrl(parsedUrl); 1422 | const useProxy = proxyUrl && proxyUrl.hostname; 1423 | if (this._keepAlive && useProxy) { 1424 | agent = this._proxyAgent; 1425 | } 1426 | if (this._keepAlive && !useProxy) { 1427 | agent = this._agent; 1428 | } 1429 | if (agent) { 1430 | return agent; 1431 | } 1432 | const usingSsl = parsedUrl.protocol === "https:"; 1433 | let maxSockets = 100; 1434 | if (this.requestOptions) { 1435 | maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; 1436 | } 1437 | if (proxyUrl && proxyUrl.hostname) { 1438 | const agentOptions = { 1439 | maxSockets, 1440 | keepAlive: this._keepAlive, 1441 | proxy: Object.assign(Object.assign({}, (proxyUrl.username || proxyUrl.password) && { 1442 | proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` 1443 | }), { host: proxyUrl.hostname, port: proxyUrl.port }) 1444 | }; 1445 | let tunnelAgent; 1446 | const overHttps = proxyUrl.protocol === "https:"; 1447 | if (usingSsl) { 1448 | tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; 1449 | } else { 1450 | tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; 1451 | } 1452 | agent = tunnelAgent(agentOptions); 1453 | this._proxyAgent = agent; 1454 | } 1455 | if (this._keepAlive && !agent) { 1456 | const options = { keepAlive: this._keepAlive, maxSockets }; 1457 | agent = usingSsl ? new https.Agent(options) : new http.Agent(options); 1458 | this._agent = agent; 1459 | } 1460 | if (!agent) { 1461 | agent = usingSsl ? https.globalAgent : http.globalAgent; 1462 | } 1463 | if (usingSsl && this._ignoreSslError) { 1464 | agent.options = Object.assign(agent.options || {}, { 1465 | rejectUnauthorized: false 1466 | }); 1467 | } 1468 | return agent; 1469 | } 1470 | _performExponentialBackoff(retryNumber) { 1471 | return __awaiter(this, void 0, void 0, function* () { 1472 | retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); 1473 | const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); 1474 | return new Promise((resolve) => setTimeout(() => resolve(), ms)); 1475 | }); 1476 | } 1477 | _processResponse(res, options) { 1478 | return __awaiter(this, void 0, void 0, function* () { 1479 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 1480 | const statusCode = res.message.statusCode || 0; 1481 | const response = { 1482 | statusCode, 1483 | result: null, 1484 | headers: {} 1485 | }; 1486 | if (statusCode === HttpCodes.NotFound) { 1487 | resolve(response); 1488 | } 1489 | function dateTimeDeserializer(key, value) { 1490 | if (typeof value === "string") { 1491 | const a = new Date(value); 1492 | if (!isNaN(a.valueOf())) { 1493 | return a; 1494 | } 1495 | } 1496 | return value; 1497 | } 1498 | let obj; 1499 | let contents; 1500 | try { 1501 | contents = yield res.readBody(); 1502 | if (contents && contents.length > 0) { 1503 | if (options && options.deserializeDates) { 1504 | obj = JSON.parse(contents, dateTimeDeserializer); 1505 | } else { 1506 | obj = JSON.parse(contents); 1507 | } 1508 | response.result = obj; 1509 | } 1510 | response.headers = res.message.headers; 1511 | } catch (err) { 1512 | } 1513 | if (statusCode > 299) { 1514 | let msg; 1515 | if (obj && obj.message) { 1516 | msg = obj.message; 1517 | } else if (contents && contents.length > 0) { 1518 | msg = contents; 1519 | } else { 1520 | msg = `Failed request: (${statusCode})`; 1521 | } 1522 | const err = new HttpClientError(msg, statusCode); 1523 | err.result = response.result; 1524 | reject(err); 1525 | } else { 1526 | resolve(response); 1527 | } 1528 | })); 1529 | }); 1530 | } 1531 | }; 1532 | exports.HttpClient = HttpClient; 1533 | var lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); 1534 | } 1535 | }); 1536 | 1537 | // node_modules/@actions/http-client/lib/auth.js 1538 | var require_auth = __commonJS({ 1539 | "node_modules/@actions/http-client/lib/auth.js"(exports) { 1540 | "use strict"; 1541 | var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { 1542 | function adopt(value) { 1543 | return value instanceof P ? value : new P(function(resolve) { 1544 | resolve(value); 1545 | }); 1546 | } 1547 | return new (P || (P = Promise))(function(resolve, reject) { 1548 | function fulfilled(value) { 1549 | try { 1550 | step(generator.next(value)); 1551 | } catch (e) { 1552 | reject(e); 1553 | } 1554 | } 1555 | function rejected(value) { 1556 | try { 1557 | step(generator["throw"](value)); 1558 | } catch (e) { 1559 | reject(e); 1560 | } 1561 | } 1562 | function step(result) { 1563 | result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 1564 | } 1565 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 1566 | }); 1567 | }; 1568 | Object.defineProperty(exports, "__esModule", { value: true }); 1569 | exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0; 1570 | var BasicCredentialHandler = class { 1571 | constructor(username, password) { 1572 | this.username = username; 1573 | this.password = password; 1574 | } 1575 | prepareRequest(options) { 1576 | if (!options.headers) { 1577 | throw Error("The request has no headers"); 1578 | } 1579 | options.headers["Authorization"] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`; 1580 | } 1581 | canHandleAuthentication() { 1582 | return false; 1583 | } 1584 | handleAuthentication() { 1585 | return __awaiter(this, void 0, void 0, function* () { 1586 | throw new Error("not implemented"); 1587 | }); 1588 | } 1589 | }; 1590 | exports.BasicCredentialHandler = BasicCredentialHandler; 1591 | var BearerCredentialHandler = class { 1592 | constructor(token) { 1593 | this.token = token; 1594 | } 1595 | prepareRequest(options) { 1596 | if (!options.headers) { 1597 | throw Error("The request has no headers"); 1598 | } 1599 | options.headers["Authorization"] = `Bearer ${this.token}`; 1600 | } 1601 | canHandleAuthentication() { 1602 | return false; 1603 | } 1604 | handleAuthentication() { 1605 | return __awaiter(this, void 0, void 0, function* () { 1606 | throw new Error("not implemented"); 1607 | }); 1608 | } 1609 | }; 1610 | exports.BearerCredentialHandler = BearerCredentialHandler; 1611 | var PersonalAccessTokenCredentialHandler = class { 1612 | constructor(token) { 1613 | this.token = token; 1614 | } 1615 | prepareRequest(options) { 1616 | if (!options.headers) { 1617 | throw Error("The request has no headers"); 1618 | } 1619 | options.headers["Authorization"] = `Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`; 1620 | } 1621 | canHandleAuthentication() { 1622 | return false; 1623 | } 1624 | handleAuthentication() { 1625 | return __awaiter(this, void 0, void 0, function* () { 1626 | throw new Error("not implemented"); 1627 | }); 1628 | } 1629 | }; 1630 | exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; 1631 | } 1632 | }); 1633 | 1634 | // node_modules/@actions/core/lib/oidc-utils.js 1635 | var require_oidc_utils = __commonJS({ 1636 | "node_modules/@actions/core/lib/oidc-utils.js"(exports) { 1637 | "use strict"; 1638 | var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { 1639 | function adopt(value) { 1640 | return value instanceof P ? value : new P(function(resolve) { 1641 | resolve(value); 1642 | }); 1643 | } 1644 | return new (P || (P = Promise))(function(resolve, reject) { 1645 | function fulfilled(value) { 1646 | try { 1647 | step(generator.next(value)); 1648 | } catch (e) { 1649 | reject(e); 1650 | } 1651 | } 1652 | function rejected(value) { 1653 | try { 1654 | step(generator["throw"](value)); 1655 | } catch (e) { 1656 | reject(e); 1657 | } 1658 | } 1659 | function step(result) { 1660 | result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 1661 | } 1662 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 1663 | }); 1664 | }; 1665 | Object.defineProperty(exports, "__esModule", { value: true }); 1666 | exports.OidcClient = void 0; 1667 | var http_client_1 = require_lib(); 1668 | var auth_1 = require_auth(); 1669 | var core_1 = require_core(); 1670 | var OidcClient = class { 1671 | static createHttpClient(allowRetry = true, maxRetry = 10) { 1672 | const requestOptions = { 1673 | allowRetries: allowRetry, 1674 | maxRetries: maxRetry 1675 | }; 1676 | return new http_client_1.HttpClient("actions/oidc-client", [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); 1677 | } 1678 | static getRequestToken() { 1679 | const token = process.env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"]; 1680 | if (!token) { 1681 | throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable"); 1682 | } 1683 | return token; 1684 | } 1685 | static getIDTokenUrl() { 1686 | const runtimeUrl = process.env["ACTIONS_ID_TOKEN_REQUEST_URL"]; 1687 | if (!runtimeUrl) { 1688 | throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable"); 1689 | } 1690 | return runtimeUrl; 1691 | } 1692 | static getCall(id_token_url) { 1693 | var _a; 1694 | return __awaiter(this, void 0, void 0, function* () { 1695 | const httpclient = OidcClient.createHttpClient(); 1696 | const res = yield httpclient.getJson(id_token_url).catch((error) => { 1697 | throw new Error(`Failed to get ID Token. 1698 | 1699 | Error Code : ${error.statusCode} 1700 | 1701 | Error Message: ${error.result.message}`); 1702 | }); 1703 | const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; 1704 | if (!id_token) { 1705 | throw new Error("Response json body do not have ID Token field"); 1706 | } 1707 | return id_token; 1708 | }); 1709 | } 1710 | static getIDToken(audience) { 1711 | return __awaiter(this, void 0, void 0, function* () { 1712 | try { 1713 | let id_token_url = OidcClient.getIDTokenUrl(); 1714 | if (audience) { 1715 | const encodedAudience = encodeURIComponent(audience); 1716 | id_token_url = `${id_token_url}&audience=${encodedAudience}`; 1717 | } 1718 | core_1.debug(`ID token url is ${id_token_url}`); 1719 | const id_token = yield OidcClient.getCall(id_token_url); 1720 | core_1.setSecret(id_token); 1721 | return id_token; 1722 | } catch (error) { 1723 | throw new Error(`Error message: ${error.message}`); 1724 | } 1725 | }); 1726 | } 1727 | }; 1728 | exports.OidcClient = OidcClient; 1729 | } 1730 | }); 1731 | 1732 | // node_modules/@actions/core/lib/summary.js 1733 | var require_summary = __commonJS({ 1734 | "node_modules/@actions/core/lib/summary.js"(exports) { 1735 | "use strict"; 1736 | var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { 1737 | function adopt(value) { 1738 | return value instanceof P ? value : new P(function(resolve) { 1739 | resolve(value); 1740 | }); 1741 | } 1742 | return new (P || (P = Promise))(function(resolve, reject) { 1743 | function fulfilled(value) { 1744 | try { 1745 | step(generator.next(value)); 1746 | } catch (e) { 1747 | reject(e); 1748 | } 1749 | } 1750 | function rejected(value) { 1751 | try { 1752 | step(generator["throw"](value)); 1753 | } catch (e) { 1754 | reject(e); 1755 | } 1756 | } 1757 | function step(result) { 1758 | result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 1759 | } 1760 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 1761 | }); 1762 | }; 1763 | Object.defineProperty(exports, "__esModule", { value: true }); 1764 | exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; 1765 | var os_1 = require("os"); 1766 | var fs_1 = require("fs"); 1767 | var { access, appendFile, writeFile } = fs_1.promises; 1768 | exports.SUMMARY_ENV_VAR = "GITHUB_STEP_SUMMARY"; 1769 | exports.SUMMARY_DOCS_URL = "https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary"; 1770 | var Summary = class { 1771 | constructor() { 1772 | this._buffer = ""; 1773 | } 1774 | filePath() { 1775 | return __awaiter(this, void 0, void 0, function* () { 1776 | if (this._filePath) { 1777 | return this._filePath; 1778 | } 1779 | const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR]; 1780 | if (!pathFromEnv) { 1781 | throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); 1782 | } 1783 | try { 1784 | yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK); 1785 | } catch (_a) { 1786 | throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); 1787 | } 1788 | this._filePath = pathFromEnv; 1789 | return this._filePath; 1790 | }); 1791 | } 1792 | wrap(tag, content, attrs = {}) { 1793 | const htmlAttrs = Object.entries(attrs).map(([key, value]) => ` ${key}="${value}"`).join(""); 1794 | if (!content) { 1795 | return `<${tag}${htmlAttrs}>`; 1796 | } 1797 | return `<${tag}${htmlAttrs}>${content}`; 1798 | } 1799 | write(options) { 1800 | return __awaiter(this, void 0, void 0, function* () { 1801 | const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); 1802 | const filePath = yield this.filePath(); 1803 | const writeFunc = overwrite ? writeFile : appendFile; 1804 | yield writeFunc(filePath, this._buffer, { encoding: "utf8" }); 1805 | return this.emptyBuffer(); 1806 | }); 1807 | } 1808 | clear() { 1809 | return __awaiter(this, void 0, void 0, function* () { 1810 | return this.emptyBuffer().write({ overwrite: true }); 1811 | }); 1812 | } 1813 | stringify() { 1814 | return this._buffer; 1815 | } 1816 | isEmptyBuffer() { 1817 | return this._buffer.length === 0; 1818 | } 1819 | emptyBuffer() { 1820 | this._buffer = ""; 1821 | return this; 1822 | } 1823 | addRaw(text, addEOL = false) { 1824 | this._buffer += text; 1825 | return addEOL ? this.addEOL() : this; 1826 | } 1827 | addEOL() { 1828 | return this.addRaw(os_1.EOL); 1829 | } 1830 | addCodeBlock(code, lang) { 1831 | const attrs = Object.assign({}, lang && { lang }); 1832 | const element = this.wrap("pre", this.wrap("code", code), attrs); 1833 | return this.addRaw(element).addEOL(); 1834 | } 1835 | addList(items, ordered = false) { 1836 | const tag = ordered ? "ol" : "ul"; 1837 | const listItems = items.map((item) => this.wrap("li", item)).join(""); 1838 | const element = this.wrap(tag, listItems); 1839 | return this.addRaw(element).addEOL(); 1840 | } 1841 | addTable(rows) { 1842 | const tableBody = rows.map((row) => { 1843 | const cells = row.map((cell) => { 1844 | if (typeof cell === "string") { 1845 | return this.wrap("td", cell); 1846 | } 1847 | const { header, data, colspan, rowspan } = cell; 1848 | const tag = header ? "th" : "td"; 1849 | const attrs = Object.assign(Object.assign({}, colspan && { colspan }), rowspan && { rowspan }); 1850 | return this.wrap(tag, data, attrs); 1851 | }).join(""); 1852 | return this.wrap("tr", cells); 1853 | }).join(""); 1854 | const element = this.wrap("table", tableBody); 1855 | return this.addRaw(element).addEOL(); 1856 | } 1857 | addDetails(label, content) { 1858 | const element = this.wrap("details", this.wrap("summary", label) + content); 1859 | return this.addRaw(element).addEOL(); 1860 | } 1861 | addImage(src, alt, options) { 1862 | const { width, height } = options || {}; 1863 | const attrs = Object.assign(Object.assign({}, width && { width }), height && { height }); 1864 | const element = this.wrap("img", null, Object.assign({ src, alt }, attrs)); 1865 | return this.addRaw(element).addEOL(); 1866 | } 1867 | addHeading(text, level) { 1868 | const tag = `h${level}`; 1869 | const allowedTag = ["h1", "h2", "h3", "h4", "h5", "h6"].includes(tag) ? tag : "h1"; 1870 | const element = this.wrap(allowedTag, text); 1871 | return this.addRaw(element).addEOL(); 1872 | } 1873 | addSeparator() { 1874 | const element = this.wrap("hr", null); 1875 | return this.addRaw(element).addEOL(); 1876 | } 1877 | addBreak() { 1878 | const element = this.wrap("br", null); 1879 | return this.addRaw(element).addEOL(); 1880 | } 1881 | addQuote(text, cite) { 1882 | const attrs = Object.assign({}, cite && { cite }); 1883 | const element = this.wrap("blockquote", text, attrs); 1884 | return this.addRaw(element).addEOL(); 1885 | } 1886 | addLink(text, href) { 1887 | const element = this.wrap("a", text, { href }); 1888 | return this.addRaw(element).addEOL(); 1889 | } 1890 | }; 1891 | var _summary = new Summary(); 1892 | exports.markdownSummary = _summary; 1893 | exports.summary = _summary; 1894 | } 1895 | }); 1896 | 1897 | // node_modules/@actions/core/lib/path-utils.js 1898 | var require_path_utils = __commonJS({ 1899 | "node_modules/@actions/core/lib/path-utils.js"(exports) { 1900 | "use strict"; 1901 | var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { 1902 | if (k2 === void 0) 1903 | k2 = k; 1904 | Object.defineProperty(o, k2, { enumerable: true, get: function() { 1905 | return m[k]; 1906 | } }); 1907 | } : function(o, m, k, k2) { 1908 | if (k2 === void 0) 1909 | k2 = k; 1910 | o[k2] = m[k]; 1911 | }); 1912 | var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { 1913 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 1914 | } : function(o, v) { 1915 | o["default"] = v; 1916 | }); 1917 | var __importStar = exports && exports.__importStar || function(mod) { 1918 | if (mod && mod.__esModule) 1919 | return mod; 1920 | var result = {}; 1921 | if (mod != null) { 1922 | for (var k in mod) 1923 | if (k !== "default" && Object.hasOwnProperty.call(mod, k)) 1924 | __createBinding(result, mod, k); 1925 | } 1926 | __setModuleDefault(result, mod); 1927 | return result; 1928 | }; 1929 | Object.defineProperty(exports, "__esModule", { value: true }); 1930 | exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0; 1931 | var path = __importStar(require("path")); 1932 | function toPosixPath(pth) { 1933 | return pth.replace(/[\\]/g, "/"); 1934 | } 1935 | exports.toPosixPath = toPosixPath; 1936 | function toWin32Path(pth) { 1937 | return pth.replace(/[/]/g, "\\"); 1938 | } 1939 | exports.toWin32Path = toWin32Path; 1940 | function toPlatformPath(pth) { 1941 | return pth.replace(/[/\\]/g, path.sep); 1942 | } 1943 | exports.toPlatformPath = toPlatformPath; 1944 | } 1945 | }); 1946 | 1947 | // node_modules/@actions/core/lib/core.js 1948 | var require_core = __commonJS({ 1949 | "node_modules/@actions/core/lib/core.js"(exports) { 1950 | "use strict"; 1951 | var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { 1952 | if (k2 === void 0) 1953 | k2 = k; 1954 | Object.defineProperty(o, k2, { enumerable: true, get: function() { 1955 | return m[k]; 1956 | } }); 1957 | } : function(o, m, k, k2) { 1958 | if (k2 === void 0) 1959 | k2 = k; 1960 | o[k2] = m[k]; 1961 | }); 1962 | var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { 1963 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 1964 | } : function(o, v) { 1965 | o["default"] = v; 1966 | }); 1967 | var __importStar = exports && exports.__importStar || function(mod) { 1968 | if (mod && mod.__esModule) 1969 | return mod; 1970 | var result = {}; 1971 | if (mod != null) { 1972 | for (var k in mod) 1973 | if (k !== "default" && Object.hasOwnProperty.call(mod, k)) 1974 | __createBinding(result, mod, k); 1975 | } 1976 | __setModuleDefault(result, mod); 1977 | return result; 1978 | }; 1979 | var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { 1980 | function adopt(value) { 1981 | return value instanceof P ? value : new P(function(resolve) { 1982 | resolve(value); 1983 | }); 1984 | } 1985 | return new (P || (P = Promise))(function(resolve, reject) { 1986 | function fulfilled(value) { 1987 | try { 1988 | step(generator.next(value)); 1989 | } catch (e) { 1990 | reject(e); 1991 | } 1992 | } 1993 | function rejected(value) { 1994 | try { 1995 | step(generator["throw"](value)); 1996 | } catch (e) { 1997 | reject(e); 1998 | } 1999 | } 2000 | function step(result) { 2001 | result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 2002 | } 2003 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 2004 | }); 2005 | }; 2006 | Object.defineProperty(exports, "__esModule", { value: true }); 2007 | exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; 2008 | var command_1 = require_command(); 2009 | var file_command_1 = require_file_command(); 2010 | var utils_1 = require_utils(); 2011 | var os = __importStar(require("os")); 2012 | var path = __importStar(require("path")); 2013 | var uuid_1 = require_dist(); 2014 | var oidc_utils_1 = require_oidc_utils(); 2015 | var ExitCode; 2016 | (function(ExitCode2) { 2017 | ExitCode2[ExitCode2["Success"] = 0] = "Success"; 2018 | ExitCode2[ExitCode2["Failure"] = 1] = "Failure"; 2019 | })(ExitCode = exports.ExitCode || (exports.ExitCode = {})); 2020 | function exportVariable(name, val) { 2021 | const convertedVal = utils_1.toCommandValue(val); 2022 | process.env[name] = convertedVal; 2023 | const filePath = process.env["GITHUB_ENV"] || ""; 2024 | if (filePath) { 2025 | const delimiter = `ghadelimiter_${uuid_1.v4()}`; 2026 | if (name.includes(delimiter)) { 2027 | throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); 2028 | } 2029 | if (convertedVal.includes(delimiter)) { 2030 | throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); 2031 | } 2032 | const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; 2033 | file_command_1.issueCommand("ENV", commandValue); 2034 | } else { 2035 | command_1.issueCommand("set-env", { name }, convertedVal); 2036 | } 2037 | } 2038 | exports.exportVariable = exportVariable; 2039 | function setSecret(secret) { 2040 | command_1.issueCommand("add-mask", {}, secret); 2041 | } 2042 | exports.setSecret = setSecret; 2043 | function addPath(inputPath) { 2044 | const filePath = process.env["GITHUB_PATH"] || ""; 2045 | if (filePath) { 2046 | file_command_1.issueCommand("PATH", inputPath); 2047 | } else { 2048 | command_1.issueCommand("add-path", {}, inputPath); 2049 | } 2050 | process.env["PATH"] = `${inputPath}${path.delimiter}${process.env["PATH"]}`; 2051 | } 2052 | exports.addPath = addPath; 2053 | function getInput2(name, options) { 2054 | const val = process.env[`INPUT_${name.replace(/ /g, "_").toUpperCase()}`] || ""; 2055 | if (options && options.required && !val) { 2056 | throw new Error(`Input required and not supplied: ${name}`); 2057 | } 2058 | if (options && options.trimWhitespace === false) { 2059 | return val; 2060 | } 2061 | return val.trim(); 2062 | } 2063 | exports.getInput = getInput2; 2064 | function getMultilineInput(name, options) { 2065 | const inputs = getInput2(name, options).split("\n").filter((x) => x !== ""); 2066 | return inputs; 2067 | } 2068 | exports.getMultilineInput = getMultilineInput; 2069 | function getBooleanInput(name, options) { 2070 | const trueValue = ["true", "True", "TRUE"]; 2071 | const falseValue = ["false", "False", "FALSE"]; 2072 | const val = getInput2(name, options); 2073 | if (trueValue.includes(val)) 2074 | return true; 2075 | if (falseValue.includes(val)) 2076 | return false; 2077 | throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name} 2078 | Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); 2079 | } 2080 | exports.getBooleanInput = getBooleanInput; 2081 | function setOutput(name, value) { 2082 | process.stdout.write(os.EOL); 2083 | command_1.issueCommand("set-output", { name }, value); 2084 | } 2085 | exports.setOutput = setOutput; 2086 | function setCommandEcho(enabled) { 2087 | command_1.issue("echo", enabled ? "on" : "off"); 2088 | } 2089 | exports.setCommandEcho = setCommandEcho; 2090 | function setFailed2(message) { 2091 | process.exitCode = ExitCode.Failure; 2092 | error(message); 2093 | } 2094 | exports.setFailed = setFailed2; 2095 | function isDebug() { 2096 | return process.env["RUNNER_DEBUG"] === "1"; 2097 | } 2098 | exports.isDebug = isDebug; 2099 | function debug(message) { 2100 | command_1.issueCommand("debug", {}, message); 2101 | } 2102 | exports.debug = debug; 2103 | function error(message, properties = {}) { 2104 | command_1.issueCommand("error", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 2105 | } 2106 | exports.error = error; 2107 | function warning(message, properties = {}) { 2108 | command_1.issueCommand("warning", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 2109 | } 2110 | exports.warning = warning; 2111 | function notice(message, properties = {}) { 2112 | command_1.issueCommand("notice", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 2113 | } 2114 | exports.notice = notice; 2115 | function info(message) { 2116 | process.stdout.write(message + os.EOL); 2117 | } 2118 | exports.info = info; 2119 | function startGroup(name) { 2120 | command_1.issue("group", name); 2121 | } 2122 | exports.startGroup = startGroup; 2123 | function endGroup() { 2124 | command_1.issue("endgroup"); 2125 | } 2126 | exports.endGroup = endGroup; 2127 | function group(name, fn) { 2128 | return __awaiter(this, void 0, void 0, function* () { 2129 | startGroup(name); 2130 | let result; 2131 | try { 2132 | result = yield fn(); 2133 | } finally { 2134 | endGroup(); 2135 | } 2136 | return result; 2137 | }); 2138 | } 2139 | exports.group = group; 2140 | function saveState(name, value) { 2141 | command_1.issueCommand("save-state", { name }, value); 2142 | } 2143 | exports.saveState = saveState; 2144 | function getState(name) { 2145 | return process.env[`STATE_${name}`] || ""; 2146 | } 2147 | exports.getState = getState; 2148 | function getIDToken(aud) { 2149 | return __awaiter(this, void 0, void 0, function* () { 2150 | return yield oidc_utils_1.OidcClient.getIDToken(aud); 2151 | }); 2152 | } 2153 | exports.getIDToken = getIDToken; 2154 | var summary_1 = require_summary(); 2155 | Object.defineProperty(exports, "summary", { enumerable: true, get: function() { 2156 | return summary_1.summary; 2157 | } }); 2158 | var summary_2 = require_summary(); 2159 | Object.defineProperty(exports, "markdownSummary", { enumerable: true, get: function() { 2160 | return summary_2.markdownSummary; 2161 | } }); 2162 | var path_utils_1 = require_path_utils(); 2163 | Object.defineProperty(exports, "toPosixPath", { enumerable: true, get: function() { 2164 | return path_utils_1.toPosixPath; 2165 | } }); 2166 | Object.defineProperty(exports, "toWin32Path", { enumerable: true, get: function() { 2167 | return path_utils_1.toWin32Path; 2168 | } }); 2169 | Object.defineProperty(exports, "toPlatformPath", { enumerable: true, get: function() { 2170 | return path_utils_1.toPlatformPath; 2171 | } }); 2172 | } 2173 | }); 2174 | 2175 | // node_modules/@actions/io/lib/io-util.js 2176 | var require_io_util = __commonJS({ 2177 | "node_modules/@actions/io/lib/io-util.js"(exports) { 2178 | "use strict"; 2179 | var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { 2180 | if (k2 === void 0) 2181 | k2 = k; 2182 | Object.defineProperty(o, k2, { enumerable: true, get: function() { 2183 | return m[k]; 2184 | } }); 2185 | } : function(o, m, k, k2) { 2186 | if (k2 === void 0) 2187 | k2 = k; 2188 | o[k2] = m[k]; 2189 | }); 2190 | var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { 2191 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 2192 | } : function(o, v) { 2193 | o["default"] = v; 2194 | }); 2195 | var __importStar = exports && exports.__importStar || function(mod) { 2196 | if (mod && mod.__esModule) 2197 | return mod; 2198 | var result = {}; 2199 | if (mod != null) { 2200 | for (var k in mod) 2201 | if (k !== "default" && Object.hasOwnProperty.call(mod, k)) 2202 | __createBinding(result, mod, k); 2203 | } 2204 | __setModuleDefault(result, mod); 2205 | return result; 2206 | }; 2207 | var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { 2208 | function adopt(value) { 2209 | return value instanceof P ? value : new P(function(resolve) { 2210 | resolve(value); 2211 | }); 2212 | } 2213 | return new (P || (P = Promise))(function(resolve, reject) { 2214 | function fulfilled(value) { 2215 | try { 2216 | step(generator.next(value)); 2217 | } catch (e) { 2218 | reject(e); 2219 | } 2220 | } 2221 | function rejected(value) { 2222 | try { 2223 | step(generator["throw"](value)); 2224 | } catch (e) { 2225 | reject(e); 2226 | } 2227 | } 2228 | function step(result) { 2229 | result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 2230 | } 2231 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 2232 | }); 2233 | }; 2234 | var _a; 2235 | Object.defineProperty(exports, "__esModule", { value: true }); 2236 | exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0; 2237 | var fs = __importStar(require("fs")); 2238 | var path = __importStar(require("path")); 2239 | _a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; 2240 | exports.IS_WINDOWS = process.platform === "win32"; 2241 | function exists(fsPath) { 2242 | return __awaiter(this, void 0, void 0, function* () { 2243 | try { 2244 | yield exports.stat(fsPath); 2245 | } catch (err) { 2246 | if (err.code === "ENOENT") { 2247 | return false; 2248 | } 2249 | throw err; 2250 | } 2251 | return true; 2252 | }); 2253 | } 2254 | exports.exists = exists; 2255 | function isDirectory(fsPath, useStat = false) { 2256 | return __awaiter(this, void 0, void 0, function* () { 2257 | const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath); 2258 | return stats.isDirectory(); 2259 | }); 2260 | } 2261 | exports.isDirectory = isDirectory; 2262 | function isRooted(p) { 2263 | p = normalizeSeparators(p); 2264 | if (!p) { 2265 | throw new Error('isRooted() parameter "p" cannot be empty'); 2266 | } 2267 | if (exports.IS_WINDOWS) { 2268 | return p.startsWith("\\") || /^[A-Z]:/i.test(p); 2269 | } 2270 | return p.startsWith("/"); 2271 | } 2272 | exports.isRooted = isRooted; 2273 | function tryGetExecutablePath(filePath, extensions) { 2274 | return __awaiter(this, void 0, void 0, function* () { 2275 | let stats = void 0; 2276 | try { 2277 | stats = yield exports.stat(filePath); 2278 | } catch (err) { 2279 | if (err.code !== "ENOENT") { 2280 | console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); 2281 | } 2282 | } 2283 | if (stats && stats.isFile()) { 2284 | if (exports.IS_WINDOWS) { 2285 | const upperExt = path.extname(filePath).toUpperCase(); 2286 | if (extensions.some((validExt) => validExt.toUpperCase() === upperExt)) { 2287 | return filePath; 2288 | } 2289 | } else { 2290 | if (isUnixExecutable(stats)) { 2291 | return filePath; 2292 | } 2293 | } 2294 | } 2295 | const originalFilePath = filePath; 2296 | for (const extension of extensions) { 2297 | filePath = originalFilePath + extension; 2298 | stats = void 0; 2299 | try { 2300 | stats = yield exports.stat(filePath); 2301 | } catch (err) { 2302 | if (err.code !== "ENOENT") { 2303 | console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); 2304 | } 2305 | } 2306 | if (stats && stats.isFile()) { 2307 | if (exports.IS_WINDOWS) { 2308 | try { 2309 | const directory = path.dirname(filePath); 2310 | const upperName = path.basename(filePath).toUpperCase(); 2311 | for (const actualName of yield exports.readdir(directory)) { 2312 | if (upperName === actualName.toUpperCase()) { 2313 | filePath = path.join(directory, actualName); 2314 | break; 2315 | } 2316 | } 2317 | } catch (err) { 2318 | console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`); 2319 | } 2320 | return filePath; 2321 | } else { 2322 | if (isUnixExecutable(stats)) { 2323 | return filePath; 2324 | } 2325 | } 2326 | } 2327 | } 2328 | return ""; 2329 | }); 2330 | } 2331 | exports.tryGetExecutablePath = tryGetExecutablePath; 2332 | function normalizeSeparators(p) { 2333 | p = p || ""; 2334 | if (exports.IS_WINDOWS) { 2335 | p = p.replace(/\//g, "\\"); 2336 | return p.replace(/\\\\+/g, "\\"); 2337 | } 2338 | return p.replace(/\/\/+/g, "/"); 2339 | } 2340 | function isUnixExecutable(stats) { 2341 | return (stats.mode & 1) > 0 || (stats.mode & 8) > 0 && stats.gid === process.getgid() || (stats.mode & 64) > 0 && stats.uid === process.getuid(); 2342 | } 2343 | function getCmdPath() { 2344 | var _a2; 2345 | return (_a2 = process.env["COMSPEC"]) !== null && _a2 !== void 0 ? _a2 : `cmd.exe`; 2346 | } 2347 | exports.getCmdPath = getCmdPath; 2348 | } 2349 | }); 2350 | 2351 | // node_modules/@actions/io/lib/io.js 2352 | var require_io = __commonJS({ 2353 | "node_modules/@actions/io/lib/io.js"(exports) { 2354 | "use strict"; 2355 | var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { 2356 | if (k2 === void 0) 2357 | k2 = k; 2358 | Object.defineProperty(o, k2, { enumerable: true, get: function() { 2359 | return m[k]; 2360 | } }); 2361 | } : function(o, m, k, k2) { 2362 | if (k2 === void 0) 2363 | k2 = k; 2364 | o[k2] = m[k]; 2365 | }); 2366 | var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { 2367 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 2368 | } : function(o, v) { 2369 | o["default"] = v; 2370 | }); 2371 | var __importStar = exports && exports.__importStar || function(mod) { 2372 | if (mod && mod.__esModule) 2373 | return mod; 2374 | var result = {}; 2375 | if (mod != null) { 2376 | for (var k in mod) 2377 | if (k !== "default" && Object.hasOwnProperty.call(mod, k)) 2378 | __createBinding(result, mod, k); 2379 | } 2380 | __setModuleDefault(result, mod); 2381 | return result; 2382 | }; 2383 | var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { 2384 | function adopt(value) { 2385 | return value instanceof P ? value : new P(function(resolve) { 2386 | resolve(value); 2387 | }); 2388 | } 2389 | return new (P || (P = Promise))(function(resolve, reject) { 2390 | function fulfilled(value) { 2391 | try { 2392 | step(generator.next(value)); 2393 | } catch (e) { 2394 | reject(e); 2395 | } 2396 | } 2397 | function rejected(value) { 2398 | try { 2399 | step(generator["throw"](value)); 2400 | } catch (e) { 2401 | reject(e); 2402 | } 2403 | } 2404 | function step(result) { 2405 | result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 2406 | } 2407 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 2408 | }); 2409 | }; 2410 | Object.defineProperty(exports, "__esModule", { value: true }); 2411 | exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0; 2412 | var assert_1 = require("assert"); 2413 | var childProcess = __importStar(require("child_process")); 2414 | var path = __importStar(require("path")); 2415 | var util_1 = require("util"); 2416 | var ioUtil = __importStar(require_io_util()); 2417 | var exec2 = util_1.promisify(childProcess.exec); 2418 | var execFile = util_1.promisify(childProcess.execFile); 2419 | function cp(source, dest, options = {}) { 2420 | return __awaiter(this, void 0, void 0, function* () { 2421 | const { force, recursive, copySourceDirectory } = readCopyOptions(options); 2422 | const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null; 2423 | if (destStat && destStat.isFile() && !force) { 2424 | return; 2425 | } 2426 | const newDest = destStat && destStat.isDirectory() && copySourceDirectory ? path.join(dest, path.basename(source)) : dest; 2427 | if (!(yield ioUtil.exists(source))) { 2428 | throw new Error(`no such file or directory: ${source}`); 2429 | } 2430 | const sourceStat = yield ioUtil.stat(source); 2431 | if (sourceStat.isDirectory()) { 2432 | if (!recursive) { 2433 | throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`); 2434 | } else { 2435 | yield cpDirRecursive(source, newDest, 0, force); 2436 | } 2437 | } else { 2438 | if (path.relative(source, newDest) === "") { 2439 | throw new Error(`'${newDest}' and '${source}' are the same file`); 2440 | } 2441 | yield copyFile(source, newDest, force); 2442 | } 2443 | }); 2444 | } 2445 | exports.cp = cp; 2446 | function mv(source, dest, options = {}) { 2447 | return __awaiter(this, void 0, void 0, function* () { 2448 | if (yield ioUtil.exists(dest)) { 2449 | let destExists = true; 2450 | if (yield ioUtil.isDirectory(dest)) { 2451 | dest = path.join(dest, path.basename(source)); 2452 | destExists = yield ioUtil.exists(dest); 2453 | } 2454 | if (destExists) { 2455 | if (options.force == null || options.force) { 2456 | yield rmRF(dest); 2457 | } else { 2458 | throw new Error("Destination already exists"); 2459 | } 2460 | } 2461 | } 2462 | yield mkdirP(path.dirname(dest)); 2463 | yield ioUtil.rename(source, dest); 2464 | }); 2465 | } 2466 | exports.mv = mv; 2467 | function rmRF(inputPath) { 2468 | return __awaiter(this, void 0, void 0, function* () { 2469 | if (ioUtil.IS_WINDOWS) { 2470 | if (/[*"<>|]/.test(inputPath)) { 2471 | throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows'); 2472 | } 2473 | try { 2474 | const cmdPath = ioUtil.getCmdPath(); 2475 | if (yield ioUtil.isDirectory(inputPath, true)) { 2476 | yield exec2(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, { 2477 | env: { inputPath } 2478 | }); 2479 | } else { 2480 | yield exec2(`${cmdPath} /s /c "del /f /a "%inputPath%""`, { 2481 | env: { inputPath } 2482 | }); 2483 | } 2484 | } catch (err) { 2485 | if (err.code !== "ENOENT") 2486 | throw err; 2487 | } 2488 | try { 2489 | yield ioUtil.unlink(inputPath); 2490 | } catch (err) { 2491 | if (err.code !== "ENOENT") 2492 | throw err; 2493 | } 2494 | } else { 2495 | let isDir = false; 2496 | try { 2497 | isDir = yield ioUtil.isDirectory(inputPath); 2498 | } catch (err) { 2499 | if (err.code !== "ENOENT") 2500 | throw err; 2501 | return; 2502 | } 2503 | if (isDir) { 2504 | yield execFile(`rm`, [`-rf`, `${inputPath}`]); 2505 | } else { 2506 | yield ioUtil.unlink(inputPath); 2507 | } 2508 | } 2509 | }); 2510 | } 2511 | exports.rmRF = rmRF; 2512 | function mkdirP(fsPath) { 2513 | return __awaiter(this, void 0, void 0, function* () { 2514 | assert_1.ok(fsPath, "a path argument must be provided"); 2515 | yield ioUtil.mkdir(fsPath, { recursive: true }); 2516 | }); 2517 | } 2518 | exports.mkdirP = mkdirP; 2519 | function which(tool, check) { 2520 | return __awaiter(this, void 0, void 0, function* () { 2521 | if (!tool) { 2522 | throw new Error("parameter 'tool' is required"); 2523 | } 2524 | if (check) { 2525 | const result = yield which(tool, false); 2526 | if (!result) { 2527 | if (ioUtil.IS_WINDOWS) { 2528 | throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`); 2529 | } else { 2530 | throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`); 2531 | } 2532 | } 2533 | return result; 2534 | } 2535 | const matches = yield findInPath(tool); 2536 | if (matches && matches.length > 0) { 2537 | return matches[0]; 2538 | } 2539 | return ""; 2540 | }); 2541 | } 2542 | exports.which = which; 2543 | function findInPath(tool) { 2544 | return __awaiter(this, void 0, void 0, function* () { 2545 | if (!tool) { 2546 | throw new Error("parameter 'tool' is required"); 2547 | } 2548 | const extensions = []; 2549 | if (ioUtil.IS_WINDOWS && process.env["PATHEXT"]) { 2550 | for (const extension of process.env["PATHEXT"].split(path.delimiter)) { 2551 | if (extension) { 2552 | extensions.push(extension); 2553 | } 2554 | } 2555 | } 2556 | if (ioUtil.isRooted(tool)) { 2557 | const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); 2558 | if (filePath) { 2559 | return [filePath]; 2560 | } 2561 | return []; 2562 | } 2563 | if (tool.includes(path.sep)) { 2564 | return []; 2565 | } 2566 | const directories = []; 2567 | if (process.env.PATH) { 2568 | for (const p of process.env.PATH.split(path.delimiter)) { 2569 | if (p) { 2570 | directories.push(p); 2571 | } 2572 | } 2573 | } 2574 | const matches = []; 2575 | for (const directory of directories) { 2576 | const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions); 2577 | if (filePath) { 2578 | matches.push(filePath); 2579 | } 2580 | } 2581 | return matches; 2582 | }); 2583 | } 2584 | exports.findInPath = findInPath; 2585 | function readCopyOptions(options) { 2586 | const force = options.force == null ? true : options.force; 2587 | const recursive = Boolean(options.recursive); 2588 | const copySourceDirectory = options.copySourceDirectory == null ? true : Boolean(options.copySourceDirectory); 2589 | return { force, recursive, copySourceDirectory }; 2590 | } 2591 | function cpDirRecursive(sourceDir, destDir, currentDepth, force) { 2592 | return __awaiter(this, void 0, void 0, function* () { 2593 | if (currentDepth >= 255) 2594 | return; 2595 | currentDepth++; 2596 | yield mkdirP(destDir); 2597 | const files = yield ioUtil.readdir(sourceDir); 2598 | for (const fileName of files) { 2599 | const srcFile = `${sourceDir}/${fileName}`; 2600 | const destFile = `${destDir}/${fileName}`; 2601 | const srcFileStat = yield ioUtil.lstat(srcFile); 2602 | if (srcFileStat.isDirectory()) { 2603 | yield cpDirRecursive(srcFile, destFile, currentDepth, force); 2604 | } else { 2605 | yield copyFile(srcFile, destFile, force); 2606 | } 2607 | } 2608 | yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode); 2609 | }); 2610 | } 2611 | function copyFile(srcFile, destFile, force) { 2612 | return __awaiter(this, void 0, void 0, function* () { 2613 | if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) { 2614 | try { 2615 | yield ioUtil.lstat(destFile); 2616 | yield ioUtil.unlink(destFile); 2617 | } catch (e) { 2618 | if (e.code === "EPERM") { 2619 | yield ioUtil.chmod(destFile, "0666"); 2620 | yield ioUtil.unlink(destFile); 2621 | } 2622 | } 2623 | const symlinkFull = yield ioUtil.readlink(srcFile); 2624 | yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? "junction" : null); 2625 | } else if (!(yield ioUtil.exists(destFile)) || force) { 2626 | yield ioUtil.copyFile(srcFile, destFile); 2627 | } 2628 | }); 2629 | } 2630 | } 2631 | }); 2632 | 2633 | // node_modules/@actions/exec/lib/toolrunner.js 2634 | var require_toolrunner = __commonJS({ 2635 | "node_modules/@actions/exec/lib/toolrunner.js"(exports) { 2636 | "use strict"; 2637 | var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { 2638 | if (k2 === void 0) 2639 | k2 = k; 2640 | Object.defineProperty(o, k2, { enumerable: true, get: function() { 2641 | return m[k]; 2642 | } }); 2643 | } : function(o, m, k, k2) { 2644 | if (k2 === void 0) 2645 | k2 = k; 2646 | o[k2] = m[k]; 2647 | }); 2648 | var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { 2649 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 2650 | } : function(o, v) { 2651 | o["default"] = v; 2652 | }); 2653 | var __importStar = exports && exports.__importStar || function(mod) { 2654 | if (mod && mod.__esModule) 2655 | return mod; 2656 | var result = {}; 2657 | if (mod != null) { 2658 | for (var k in mod) 2659 | if (k !== "default" && Object.hasOwnProperty.call(mod, k)) 2660 | __createBinding(result, mod, k); 2661 | } 2662 | __setModuleDefault(result, mod); 2663 | return result; 2664 | }; 2665 | var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { 2666 | function adopt(value) { 2667 | return value instanceof P ? value : new P(function(resolve) { 2668 | resolve(value); 2669 | }); 2670 | } 2671 | return new (P || (P = Promise))(function(resolve, reject) { 2672 | function fulfilled(value) { 2673 | try { 2674 | step(generator.next(value)); 2675 | } catch (e) { 2676 | reject(e); 2677 | } 2678 | } 2679 | function rejected(value) { 2680 | try { 2681 | step(generator["throw"](value)); 2682 | } catch (e) { 2683 | reject(e); 2684 | } 2685 | } 2686 | function step(result) { 2687 | result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 2688 | } 2689 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 2690 | }); 2691 | }; 2692 | Object.defineProperty(exports, "__esModule", { value: true }); 2693 | exports.argStringToArray = exports.ToolRunner = void 0; 2694 | var os = __importStar(require("os")); 2695 | var events = __importStar(require("events")); 2696 | var child = __importStar(require("child_process")); 2697 | var path = __importStar(require("path")); 2698 | var io = __importStar(require_io()); 2699 | var ioUtil = __importStar(require_io_util()); 2700 | var timers_1 = require("timers"); 2701 | var IS_WINDOWS = process.platform === "win32"; 2702 | var ToolRunner = class extends events.EventEmitter { 2703 | constructor(toolPath, args, options) { 2704 | super(); 2705 | if (!toolPath) { 2706 | throw new Error("Parameter 'toolPath' cannot be null or empty."); 2707 | } 2708 | this.toolPath = toolPath; 2709 | this.args = args || []; 2710 | this.options = options || {}; 2711 | } 2712 | _debug(message) { 2713 | if (this.options.listeners && this.options.listeners.debug) { 2714 | this.options.listeners.debug(message); 2715 | } 2716 | } 2717 | _getCommandString(options, noPrefix) { 2718 | const toolPath = this._getSpawnFileName(); 2719 | const args = this._getSpawnArgs(options); 2720 | let cmd = noPrefix ? "" : "[command]"; 2721 | if (IS_WINDOWS) { 2722 | if (this._isCmdFile()) { 2723 | cmd += toolPath; 2724 | for (const a of args) { 2725 | cmd += ` ${a}`; 2726 | } 2727 | } else if (options.windowsVerbatimArguments) { 2728 | cmd += `"${toolPath}"`; 2729 | for (const a of args) { 2730 | cmd += ` ${a}`; 2731 | } 2732 | } else { 2733 | cmd += this._windowsQuoteCmdArg(toolPath); 2734 | for (const a of args) { 2735 | cmd += ` ${this._windowsQuoteCmdArg(a)}`; 2736 | } 2737 | } 2738 | } else { 2739 | cmd += toolPath; 2740 | for (const a of args) { 2741 | cmd += ` ${a}`; 2742 | } 2743 | } 2744 | return cmd; 2745 | } 2746 | _processLineBuffer(data, strBuffer, onLine) { 2747 | try { 2748 | let s = strBuffer + data.toString(); 2749 | let n = s.indexOf(os.EOL); 2750 | while (n > -1) { 2751 | const line = s.substring(0, n); 2752 | onLine(line); 2753 | s = s.substring(n + os.EOL.length); 2754 | n = s.indexOf(os.EOL); 2755 | } 2756 | return s; 2757 | } catch (err) { 2758 | this._debug(`error processing line. Failed with error ${err}`); 2759 | return ""; 2760 | } 2761 | } 2762 | _getSpawnFileName() { 2763 | if (IS_WINDOWS) { 2764 | if (this._isCmdFile()) { 2765 | return process.env["COMSPEC"] || "cmd.exe"; 2766 | } 2767 | } 2768 | return this.toolPath; 2769 | } 2770 | _getSpawnArgs(options) { 2771 | if (IS_WINDOWS) { 2772 | if (this._isCmdFile()) { 2773 | let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`; 2774 | for (const a of this.args) { 2775 | argline += " "; 2776 | argline += options.windowsVerbatimArguments ? a : this._windowsQuoteCmdArg(a); 2777 | } 2778 | argline += '"'; 2779 | return [argline]; 2780 | } 2781 | } 2782 | return this.args; 2783 | } 2784 | _endsWith(str, end) { 2785 | return str.endsWith(end); 2786 | } 2787 | _isCmdFile() { 2788 | const upperToolPath = this.toolPath.toUpperCase(); 2789 | return this._endsWith(upperToolPath, ".CMD") || this._endsWith(upperToolPath, ".BAT"); 2790 | } 2791 | _windowsQuoteCmdArg(arg) { 2792 | if (!this._isCmdFile()) { 2793 | return this._uvQuoteCmdArg(arg); 2794 | } 2795 | if (!arg) { 2796 | return '""'; 2797 | } 2798 | const cmdSpecialChars = [ 2799 | " ", 2800 | " ", 2801 | "&", 2802 | "(", 2803 | ")", 2804 | "[", 2805 | "]", 2806 | "{", 2807 | "}", 2808 | "^", 2809 | "=", 2810 | ";", 2811 | "!", 2812 | "'", 2813 | "+", 2814 | ",", 2815 | "`", 2816 | "~", 2817 | "|", 2818 | "<", 2819 | ">", 2820 | '"' 2821 | ]; 2822 | let needsQuotes = false; 2823 | for (const char of arg) { 2824 | if (cmdSpecialChars.some((x) => x === char)) { 2825 | needsQuotes = true; 2826 | break; 2827 | } 2828 | } 2829 | if (!needsQuotes) { 2830 | return arg; 2831 | } 2832 | let reverse = '"'; 2833 | let quoteHit = true; 2834 | for (let i = arg.length; i > 0; i--) { 2835 | reverse += arg[i - 1]; 2836 | if (quoteHit && arg[i - 1] === "\\") { 2837 | reverse += "\\"; 2838 | } else if (arg[i - 1] === '"') { 2839 | quoteHit = true; 2840 | reverse += '"'; 2841 | } else { 2842 | quoteHit = false; 2843 | } 2844 | } 2845 | reverse += '"'; 2846 | return reverse.split("").reverse().join(""); 2847 | } 2848 | _uvQuoteCmdArg(arg) { 2849 | if (!arg) { 2850 | return '""'; 2851 | } 2852 | if (!arg.includes(" ") && !arg.includes(" ") && !arg.includes('"')) { 2853 | return arg; 2854 | } 2855 | if (!arg.includes('"') && !arg.includes("\\")) { 2856 | return `"${arg}"`; 2857 | } 2858 | let reverse = '"'; 2859 | let quoteHit = true; 2860 | for (let i = arg.length; i > 0; i--) { 2861 | reverse += arg[i - 1]; 2862 | if (quoteHit && arg[i - 1] === "\\") { 2863 | reverse += "\\"; 2864 | } else if (arg[i - 1] === '"') { 2865 | quoteHit = true; 2866 | reverse += "\\"; 2867 | } else { 2868 | quoteHit = false; 2869 | } 2870 | } 2871 | reverse += '"'; 2872 | return reverse.split("").reverse().join(""); 2873 | } 2874 | _cloneExecOptions(options) { 2875 | options = options || {}; 2876 | const result = { 2877 | cwd: options.cwd || process.cwd(), 2878 | env: options.env || process.env, 2879 | silent: options.silent || false, 2880 | windowsVerbatimArguments: options.windowsVerbatimArguments || false, 2881 | failOnStdErr: options.failOnStdErr || false, 2882 | ignoreReturnCode: options.ignoreReturnCode || false, 2883 | delay: options.delay || 1e4 2884 | }; 2885 | result.outStream = options.outStream || process.stdout; 2886 | result.errStream = options.errStream || process.stderr; 2887 | return result; 2888 | } 2889 | _getSpawnOptions(options, toolPath) { 2890 | options = options || {}; 2891 | const result = {}; 2892 | result.cwd = options.cwd; 2893 | result.env = options.env; 2894 | result["windowsVerbatimArguments"] = options.windowsVerbatimArguments || this._isCmdFile(); 2895 | if (options.windowsVerbatimArguments) { 2896 | result.argv0 = `"${toolPath}"`; 2897 | } 2898 | return result; 2899 | } 2900 | exec() { 2901 | return __awaiter(this, void 0, void 0, function* () { 2902 | if (!ioUtil.isRooted(this.toolPath) && (this.toolPath.includes("/") || IS_WINDOWS && this.toolPath.includes("\\"))) { 2903 | this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); 2904 | } 2905 | this.toolPath = yield io.which(this.toolPath, true); 2906 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 2907 | this._debug(`exec tool: ${this.toolPath}`); 2908 | this._debug("arguments:"); 2909 | for (const arg of this.args) { 2910 | this._debug(` ${arg}`); 2911 | } 2912 | const optionsNonNull = this._cloneExecOptions(this.options); 2913 | if (!optionsNonNull.silent && optionsNonNull.outStream) { 2914 | optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); 2915 | } 2916 | const state = new ExecState(optionsNonNull, this.toolPath); 2917 | state.on("debug", (message) => { 2918 | this._debug(message); 2919 | }); 2920 | if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) { 2921 | return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`)); 2922 | } 2923 | const fileName = this._getSpawnFileName(); 2924 | const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); 2925 | let stdbuffer = ""; 2926 | if (cp.stdout) { 2927 | cp.stdout.on("data", (data) => { 2928 | if (this.options.listeners && this.options.listeners.stdout) { 2929 | this.options.listeners.stdout(data); 2930 | } 2931 | if (!optionsNonNull.silent && optionsNonNull.outStream) { 2932 | optionsNonNull.outStream.write(data); 2933 | } 2934 | stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => { 2935 | if (this.options.listeners && this.options.listeners.stdline) { 2936 | this.options.listeners.stdline(line); 2937 | } 2938 | }); 2939 | }); 2940 | } 2941 | let errbuffer = ""; 2942 | if (cp.stderr) { 2943 | cp.stderr.on("data", (data) => { 2944 | state.processStderr = true; 2945 | if (this.options.listeners && this.options.listeners.stderr) { 2946 | this.options.listeners.stderr(data); 2947 | } 2948 | if (!optionsNonNull.silent && optionsNonNull.errStream && optionsNonNull.outStream) { 2949 | const s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream; 2950 | s.write(data); 2951 | } 2952 | errbuffer = this._processLineBuffer(data, errbuffer, (line) => { 2953 | if (this.options.listeners && this.options.listeners.errline) { 2954 | this.options.listeners.errline(line); 2955 | } 2956 | }); 2957 | }); 2958 | } 2959 | cp.on("error", (err) => { 2960 | state.processError = err.message; 2961 | state.processExited = true; 2962 | state.processClosed = true; 2963 | state.CheckComplete(); 2964 | }); 2965 | cp.on("exit", (code) => { 2966 | state.processExitCode = code; 2967 | state.processExited = true; 2968 | this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); 2969 | state.CheckComplete(); 2970 | }); 2971 | cp.on("close", (code) => { 2972 | state.processExitCode = code; 2973 | state.processExited = true; 2974 | state.processClosed = true; 2975 | this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); 2976 | state.CheckComplete(); 2977 | }); 2978 | state.on("done", (error, exitCode) => { 2979 | if (stdbuffer.length > 0) { 2980 | this.emit("stdline", stdbuffer); 2981 | } 2982 | if (errbuffer.length > 0) { 2983 | this.emit("errline", errbuffer); 2984 | } 2985 | cp.removeAllListeners(); 2986 | if (error) { 2987 | reject(error); 2988 | } else { 2989 | resolve(exitCode); 2990 | } 2991 | }); 2992 | if (this.options.input) { 2993 | if (!cp.stdin) { 2994 | throw new Error("child process missing stdin"); 2995 | } 2996 | cp.stdin.end(this.options.input); 2997 | } 2998 | })); 2999 | }); 3000 | } 3001 | }; 3002 | exports.ToolRunner = ToolRunner; 3003 | function argStringToArray(argString) { 3004 | const args = []; 3005 | let inQuotes = false; 3006 | let escaped = false; 3007 | let arg = ""; 3008 | function append(c) { 3009 | if (escaped && c !== '"') { 3010 | arg += "\\"; 3011 | } 3012 | arg += c; 3013 | escaped = false; 3014 | } 3015 | for (let i = 0; i < argString.length; i++) { 3016 | const c = argString.charAt(i); 3017 | if (c === '"') { 3018 | if (!escaped) { 3019 | inQuotes = !inQuotes; 3020 | } else { 3021 | append(c); 3022 | } 3023 | continue; 3024 | } 3025 | if (c === "\\" && escaped) { 3026 | append(c); 3027 | continue; 3028 | } 3029 | if (c === "\\" && inQuotes) { 3030 | escaped = true; 3031 | continue; 3032 | } 3033 | if (c === " " && !inQuotes) { 3034 | if (arg.length > 0) { 3035 | args.push(arg); 3036 | arg = ""; 3037 | } 3038 | continue; 3039 | } 3040 | append(c); 3041 | } 3042 | if (arg.length > 0) { 3043 | args.push(arg.trim()); 3044 | } 3045 | return args; 3046 | } 3047 | exports.argStringToArray = argStringToArray; 3048 | var ExecState = class extends events.EventEmitter { 3049 | constructor(options, toolPath) { 3050 | super(); 3051 | this.processClosed = false; 3052 | this.processError = ""; 3053 | this.processExitCode = 0; 3054 | this.processExited = false; 3055 | this.processStderr = false; 3056 | this.delay = 1e4; 3057 | this.done = false; 3058 | this.timeout = null; 3059 | if (!toolPath) { 3060 | throw new Error("toolPath must not be empty"); 3061 | } 3062 | this.options = options; 3063 | this.toolPath = toolPath; 3064 | if (options.delay) { 3065 | this.delay = options.delay; 3066 | } 3067 | } 3068 | CheckComplete() { 3069 | if (this.done) { 3070 | return; 3071 | } 3072 | if (this.processClosed) { 3073 | this._setResult(); 3074 | } else if (this.processExited) { 3075 | this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this); 3076 | } 3077 | } 3078 | _debug(message) { 3079 | this.emit("debug", message); 3080 | } 3081 | _setResult() { 3082 | let error; 3083 | if (this.processExited) { 3084 | if (this.processError) { 3085 | error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`); 3086 | } else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) { 3087 | error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`); 3088 | } else if (this.processStderr && this.options.failOnStdErr) { 3089 | error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`); 3090 | } 3091 | } 3092 | if (this.timeout) { 3093 | clearTimeout(this.timeout); 3094 | this.timeout = null; 3095 | } 3096 | this.done = true; 3097 | this.emit("done", error, this.processExitCode); 3098 | } 3099 | static HandleTimeout(state) { 3100 | if (state.done) { 3101 | return; 3102 | } 3103 | if (!state.processClosed && state.processExited) { 3104 | const message = `The STDIO streams did not close within ${state.delay / 1e3} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`; 3105 | state._debug(message); 3106 | } 3107 | state._setResult(); 3108 | } 3109 | }; 3110 | } 3111 | }); 3112 | 3113 | // node_modules/@actions/exec/lib/exec.js 3114 | var require_exec = __commonJS({ 3115 | "node_modules/@actions/exec/lib/exec.js"(exports) { 3116 | "use strict"; 3117 | var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { 3118 | if (k2 === void 0) 3119 | k2 = k; 3120 | Object.defineProperty(o, k2, { enumerable: true, get: function() { 3121 | return m[k]; 3122 | } }); 3123 | } : function(o, m, k, k2) { 3124 | if (k2 === void 0) 3125 | k2 = k; 3126 | o[k2] = m[k]; 3127 | }); 3128 | var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { 3129 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 3130 | } : function(o, v) { 3131 | o["default"] = v; 3132 | }); 3133 | var __importStar = exports && exports.__importStar || function(mod) { 3134 | if (mod && mod.__esModule) 3135 | return mod; 3136 | var result = {}; 3137 | if (mod != null) { 3138 | for (var k in mod) 3139 | if (k !== "default" && Object.hasOwnProperty.call(mod, k)) 3140 | __createBinding(result, mod, k); 3141 | } 3142 | __setModuleDefault(result, mod); 3143 | return result; 3144 | }; 3145 | var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { 3146 | function adopt(value) { 3147 | return value instanceof P ? value : new P(function(resolve) { 3148 | resolve(value); 3149 | }); 3150 | } 3151 | return new (P || (P = Promise))(function(resolve, reject) { 3152 | function fulfilled(value) { 3153 | try { 3154 | step(generator.next(value)); 3155 | } catch (e) { 3156 | reject(e); 3157 | } 3158 | } 3159 | function rejected(value) { 3160 | try { 3161 | step(generator["throw"](value)); 3162 | } catch (e) { 3163 | reject(e); 3164 | } 3165 | } 3166 | function step(result) { 3167 | result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 3168 | } 3169 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 3170 | }); 3171 | }; 3172 | Object.defineProperty(exports, "__esModule", { value: true }); 3173 | exports.getExecOutput = exports.exec = void 0; 3174 | var string_decoder_1 = require("string_decoder"); 3175 | var tr = __importStar(require_toolrunner()); 3176 | function exec2(commandLine, args, options) { 3177 | return __awaiter(this, void 0, void 0, function* () { 3178 | const commandArgs = tr.argStringToArray(commandLine); 3179 | if (commandArgs.length === 0) { 3180 | throw new Error(`Parameter 'commandLine' cannot be null or empty.`); 3181 | } 3182 | const toolPath = commandArgs[0]; 3183 | args = commandArgs.slice(1).concat(args || []); 3184 | const runner = new tr.ToolRunner(toolPath, args, options); 3185 | return runner.exec(); 3186 | }); 3187 | } 3188 | exports.exec = exec2; 3189 | function getExecOutput(commandLine, args, options) { 3190 | var _a, _b; 3191 | return __awaiter(this, void 0, void 0, function* () { 3192 | let stdout = ""; 3193 | let stderr = ""; 3194 | const stdoutDecoder = new string_decoder_1.StringDecoder("utf8"); 3195 | const stderrDecoder = new string_decoder_1.StringDecoder("utf8"); 3196 | const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout; 3197 | const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr; 3198 | const stdErrListener = (data) => { 3199 | stderr += stderrDecoder.write(data); 3200 | if (originalStdErrListener) { 3201 | originalStdErrListener(data); 3202 | } 3203 | }; 3204 | const stdOutListener = (data) => { 3205 | stdout += stdoutDecoder.write(data); 3206 | if (originalStdoutListener) { 3207 | originalStdoutListener(data); 3208 | } 3209 | }; 3210 | const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener }); 3211 | const exitCode = yield exec2(commandLine, args, Object.assign(Object.assign({}, options), { listeners })); 3212 | stdout += stdoutDecoder.end(); 3213 | stderr += stderrDecoder.end(); 3214 | return { 3215 | exitCode, 3216 | stdout, 3217 | stderr 3218 | }; 3219 | }); 3220 | } 3221 | exports.getExecOutput = getExecOutput; 3222 | } 3223 | }); 3224 | 3225 | // node_modules/command-exists/lib/command-exists.js 3226 | var require_command_exists = __commonJS({ 3227 | "node_modules/command-exists/lib/command-exists.js"(exports, module2) { 3228 | "use strict"; 3229 | var exec2 = require("child_process").exec; 3230 | var execSync = require("child_process").execSync; 3231 | var fs = require("fs"); 3232 | var path = require("path"); 3233 | var access = fs.access; 3234 | var accessSync = fs.accessSync; 3235 | var constants = fs.constants || fs; 3236 | var isUsingWindows = process.platform == "win32"; 3237 | var fileNotExists = function(commandName, callback) { 3238 | access( 3239 | commandName, 3240 | constants.F_OK, 3241 | function(err) { 3242 | callback(!err); 3243 | } 3244 | ); 3245 | }; 3246 | var fileNotExistsSync = function(commandName) { 3247 | try { 3248 | accessSync(commandName, constants.F_OK); 3249 | return false; 3250 | } catch (e) { 3251 | return true; 3252 | } 3253 | }; 3254 | var localExecutable = function(commandName, callback) { 3255 | access( 3256 | commandName, 3257 | constants.F_OK | constants.X_OK, 3258 | function(err) { 3259 | callback(null, !err); 3260 | } 3261 | ); 3262 | }; 3263 | var localExecutableSync = function(commandName) { 3264 | try { 3265 | accessSync(commandName, constants.F_OK | constants.X_OK); 3266 | return true; 3267 | } catch (e) { 3268 | return false; 3269 | } 3270 | }; 3271 | var commandExistsUnix = function(commandName, cleanedCommandName, callback) { 3272 | fileNotExists(commandName, function(isFile) { 3273 | if (!isFile) { 3274 | var child = exec2( 3275 | "command -v " + cleanedCommandName + " 2>/dev/null && { echo >&1 " + cleanedCommandName + "; exit 0; }", 3276 | function(error, stdout, stderr) { 3277 | callback(null, !!stdout); 3278 | } 3279 | ); 3280 | return; 3281 | } 3282 | localExecutable(commandName, callback); 3283 | }); 3284 | }; 3285 | var commandExistsWindows = function(commandName, cleanedCommandName, callback) { 3286 | if (!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName)) { 3287 | callback(null, false); 3288 | return; 3289 | } 3290 | var child = exec2( 3291 | "where " + cleanedCommandName, 3292 | function(error) { 3293 | if (error !== null) { 3294 | callback(null, false); 3295 | } else { 3296 | callback(null, true); 3297 | } 3298 | } 3299 | ); 3300 | }; 3301 | var commandExistsUnixSync = function(commandName, cleanedCommandName) { 3302 | if (fileNotExistsSync(commandName)) { 3303 | try { 3304 | var stdout = execSync( 3305 | "command -v " + cleanedCommandName + " 2>/dev/null && { echo >&1 " + cleanedCommandName + "; exit 0; }" 3306 | ); 3307 | return !!stdout; 3308 | } catch (error) { 3309 | return false; 3310 | } 3311 | } 3312 | return localExecutableSync(commandName); 3313 | }; 3314 | var commandExistsWindowsSync = function(commandName, cleanedCommandName, callback) { 3315 | if (!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName)) { 3316 | return false; 3317 | } 3318 | try { 3319 | var stdout = execSync("where " + cleanedCommandName, { stdio: [] }); 3320 | return !!stdout; 3321 | } catch (error) { 3322 | return false; 3323 | } 3324 | }; 3325 | var cleanInput = function(s) { 3326 | if (/[^A-Za-z0-9_\/:=-]/.test(s)) { 3327 | s = "'" + s.replace(/'/g, "'\\''") + "'"; 3328 | s = s.replace(/^(?:'')+/g, "").replace(/\\'''/g, "\\'"); 3329 | } 3330 | return s; 3331 | }; 3332 | if (isUsingWindows) { 3333 | cleanInput = function(s) { 3334 | var isPathName = /[\\]/.test(s); 3335 | if (isPathName) { 3336 | var dirname = '"' + path.dirname(s) + '"'; 3337 | var basename = '"' + path.basename(s) + '"'; 3338 | return dirname + ":" + basename; 3339 | } 3340 | return '"' + s + '"'; 3341 | }; 3342 | } 3343 | module2.exports = function commandExists(commandName, callback) { 3344 | var cleanedCommandName = cleanInput(commandName); 3345 | if (!callback && typeof Promise !== "undefined") { 3346 | return new Promise(function(resolve, reject) { 3347 | commandExists(commandName, function(error, output) { 3348 | if (output) { 3349 | resolve(commandName); 3350 | } else { 3351 | reject(error); 3352 | } 3353 | }); 3354 | }); 3355 | } 3356 | if (isUsingWindows) { 3357 | commandExistsWindows(commandName, cleanedCommandName, callback); 3358 | } else { 3359 | commandExistsUnix(commandName, cleanedCommandName, callback); 3360 | } 3361 | }; 3362 | module2.exports.sync = function(commandName) { 3363 | var cleanedCommandName = cleanInput(commandName); 3364 | if (isUsingWindows) { 3365 | return commandExistsWindowsSync(commandName, cleanedCommandName); 3366 | } else { 3367 | return commandExistsUnixSync(commandName, cleanedCommandName); 3368 | } 3369 | }; 3370 | } 3371 | }); 3372 | 3373 | // node_modules/command-exists/index.js 3374 | var require_command_exists2 = __commonJS({ 3375 | "node_modules/command-exists/index.js"(exports, module2) { 3376 | module2.exports = require_command_exists(); 3377 | } 3378 | }); 3379 | 3380 | // node_modules/string-argv/index.js 3381 | var require_string_argv = __commonJS({ 3382 | "node_modules/string-argv/index.js"(exports) { 3383 | "use strict"; 3384 | exports.__esModule = true; 3385 | function parseArgsStringToArgv(value, env, file) { 3386 | var myRegexp = /([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*)|[^\s'"]+|(['"])([^\5]*?)\5/gi; 3387 | var myString = value; 3388 | var myArray = []; 3389 | if (env) { 3390 | myArray.push(env); 3391 | } 3392 | if (file) { 3393 | myArray.push(file); 3394 | } 3395 | var match; 3396 | do { 3397 | match = myRegexp.exec(myString); 3398 | if (match !== null) { 3399 | myArray.push(firstString(match[1], match[6], match[0])); 3400 | } 3401 | } while (match !== null); 3402 | return myArray; 3403 | } 3404 | exports["default"] = parseArgsStringToArgv; 3405 | exports.parseArgsStringToArgv = parseArgsStringToArgv; 3406 | function firstString() { 3407 | var args = []; 3408 | for (var _i = 0; _i < arguments.length; _i++) { 3409 | args[_i] = arguments[_i]; 3410 | } 3411 | for (var i = 0; i < args.length; i++) { 3412 | var arg = args[i]; 3413 | if (typeof arg === "string") { 3414 | return arg; 3415 | } 3416 | } 3417 | } 3418 | } 3419 | }); 3420 | 3421 | // src/main.ts 3422 | var main_exports = {}; 3423 | __export(main_exports, { 3424 | mapOutput: () => mapOutput, 3425 | setupSSHPrivateKey: () => setupSSHPrivateKey, 3426 | syncFiles: () => syncFiles 3427 | }); 3428 | module.exports = __toCommonJS(main_exports); 3429 | var import_core = __toESM(require_core()); 3430 | var import_exec = __toESM(require_exec()); 3431 | var import_command_exists = __toESM(require_command_exists2()); 3432 | var import_string_argv = __toESM(require_string_argv()); 3433 | var import_fs = require("fs"); 3434 | var import_path = require("path"); 3435 | var default_rsync_options = "--archive --verbose --compress --human-readable --progress --delete-after --exclude=.git* --exclude=.git/ --exclude=README.md --exclude=readme.md --exclude=.gitignore"; 3436 | var errorDeploying = "\u26A0\uFE0F Error deploying"; 3437 | async function run() { 3438 | try { 3439 | const userArguments = getUserArguments(); 3440 | console.log(`----------------------------------------------------------------`); 3441 | console.log(`\u{1F680} Thanks for using web deploy. Let's deploy some stuff!`); 3442 | console.log(`----------------------------------------------------------------`); 3443 | console.log(`If you found this project helpful, please support it`); 3444 | console.log(`by giving it a \u2B50 on Github --> https://github.com/SamKirkland/web-deploy`); 3445 | console.log(`or add a badge \u{1F3F7}\uFE0F to your projects readme --> https://github.com/SamKirkland/web-deploy#badge`); 3446 | console.log(`----------------------------------------------------------------`); 3447 | await verifyRsyncInstalled(); 3448 | const privateKeyPath = await setupSSHPrivateKey(userArguments.private_ssh_key); 3449 | await syncFiles(privateKeyPath, userArguments); 3450 | console.log("\u2705 Deploy Complete"); 3451 | } catch (error) { 3452 | console.error(errorDeploying); 3453 | (0, import_core.setFailed)(error); 3454 | } 3455 | } 3456 | run(); 3457 | function getUserArguments() { 3458 | return { 3459 | target_server: (0, import_core.getInput)("target-server", { required: true }), 3460 | destination_path: withDefault((0, import_core.getInput)("destination-path", { required: false }), "./"), 3461 | remote_user: (0, import_core.getInput)("remote-user", { required: true }), 3462 | private_ssh_key: (0, import_core.getInput)("private-ssh-key", { required: true }), 3463 | source_path: withDefault((0, import_core.getInput)("source-path", { required: false }), "./"), 3464 | ssh_port: withDefault((0, import_core.getInput)("ssh-port"), "22"), 3465 | rsync_options: withDefault((0, import_core.getInput)("rsync-options"), default_rsync_options) 3466 | }; 3467 | } 3468 | function withDefault(value, defaultValue) { 3469 | if (value === "" || value === null || value === void 0) { 3470 | return defaultValue; 3471 | } 3472 | return value; 3473 | } 3474 | async function syncFiles(privateKeyPath, args) { 3475 | try { 3476 | const rsyncArguments = []; 3477 | rsyncArguments.push(...(0, import_string_argv.default)(`-e 'ssh -p ${args.ssh_port} -i ${privateKeyPath} -o StrictHostKeyChecking=no'`)); 3478 | rsyncArguments.push(...(0, import_string_argv.default)(args.rsync_options)); 3479 | if (args.source_path !== void 0) { 3480 | rsyncArguments.push(args.source_path); 3481 | } 3482 | const destination = `${args.remote_user}@${args.target_server}:${args.destination_path}`; 3483 | rsyncArguments.push(destination); 3484 | return await (0, import_exec.exec)( 3485 | "rsync", 3486 | rsyncArguments, 3487 | mapOutput 3488 | ); 3489 | } catch (error) { 3490 | (0, import_core.setFailed)(error); 3491 | } 3492 | } 3493 | async function verifyRsyncInstalled() { 3494 | try { 3495 | await (0, import_command_exists.default)("rsync"); 3496 | return; 3497 | } catch (commandExistsError) { 3498 | throw new Error("rsync not installed. For instructions on how to fix see https://github.com/SamKirkland/web-deploy#rsync-not-installed"); 3499 | } 3500 | } 3501 | var { 3502 | HOME, 3503 | GITHUB_WORKSPACE 3504 | } = process.env; 3505 | async function setupSSHPrivateKey(key) { 3506 | const sshFolderPath = (0, import_path.join)(HOME || __dirname, ".ssh"); 3507 | const privateKeyPath = (0, import_path.join)(sshFolderPath, "web_deploy_key"); 3508 | console.log("HOME", HOME); 3509 | console.log("GITHUB_WORKSPACE", GITHUB_WORKSPACE); 3510 | await import_fs.promises.mkdir(sshFolderPath, { recursive: true }); 3511 | const knownHostsPath = `${sshFolderPath}/known_hosts`; 3512 | if (!(0, import_fs.existsSync)(knownHostsPath)) { 3513 | console.log(`[SSH] Creating ${knownHostsPath} file in `, GITHUB_WORKSPACE); 3514 | await import_fs.promises.writeFile(knownHostsPath, "", { 3515 | encoding: "utf8", 3516 | mode: 384 3517 | }); 3518 | console.log("\u2705 [SSH] file created."); 3519 | } else { 3520 | console.log(`[SSH] ${knownHostsPath} file exist`); 3521 | } 3522 | await import_fs.promises.writeFile(privateKeyPath, key, { 3523 | encoding: "utf8", 3524 | mode: 384 3525 | }); 3526 | console.log("\u2705 Ssh key added to `.ssh` dir ", privateKeyPath); 3527 | return privateKeyPath; 3528 | } 3529 | var mapOutput = { 3530 | listeners: { 3531 | stdout: (data) => { 3532 | console.log(data); 3533 | }, 3534 | stderr: (data) => { 3535 | console.error(data); 3536 | } 3537 | } 3538 | }; 3539 | // Annotate the CommonJS export names for ESM import in node: 3540 | 0 && (module.exports = { 3541 | mapOutput, 3542 | setupSSHPrivateKey, 3543 | syncFiles 3544 | }); 3545 | -------------------------------------------------------------------------------- /images/web-deploy-logo-full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamKirkland/web-deploy/7d7a529dd2384687ccc1d3e251d8c7f164fbc533/images/web-deploy-logo-full.png -------------------------------------------------------------------------------- /images/web-deploy-logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamKirkland/web-deploy/7d7a529dd2384687ccc1d3e251d8c7f164fbc533/images/web-deploy-logo-small.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web-deploy", 3 | "version": "1.0.0", 4 | "private": true, 5 | "description": "web deploy", 6 | "main": "dist/index.js", 7 | "scripts": { 8 | "build": "esbuild src/main.ts --bundle --platform=node --outfile=dist/index.js", 9 | "test": "jest", 10 | "test-ci": "jest --ci --reporters=default --reporters=jest-junit" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/SamKirkland/web-deploy.git" 15 | }, 16 | "keywords": [ 17 | "website deploy", 18 | "continuous integration", 19 | "sftp", 20 | "ssh", 21 | "rsync" 22 | ], 23 | "author": "Sam Kirkland", 24 | "license": "MIT", 25 | "dependencies": { 26 | "@actions/core": "^1.9.1", 27 | "@actions/exec": "^1.1.1", 28 | "@types/command-exists": "^1.2.0", 29 | "command-exists": "^1.2.9", 30 | "esbuild": "^0.15.6", 31 | "string-argv": "^0.3.1" 32 | }, 33 | "devDependencies": { 34 | "@types/jest": "^28.0.0", 35 | "@types/node": "^18.7.9", 36 | "jest": "^28.0.0", 37 | "jest-junit": "^14.0.1", 38 | "jest-junit-reporter": "^1.1.0", 39 | "ts-jest": "^28.0.0", 40 | "typescript": "^4.7.4" 41 | }, 42 | "jest": { 43 | "preset": "ts-jest", 44 | "testEnvironment": "node" 45 | }, 46 | "jest-junit": { 47 | "outputDirectory": "reports", 48 | "outputName": "jest-junit.xml", 49 | "ancestorSeparator": " › ", 50 | "uniqueOutputName": "false", 51 | "suiteNameTemplate": "{filepath}", 52 | "classNameTemplate": "{classname}", 53 | "titleTemplate": "{title}" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main.test.ts: -------------------------------------------------------------------------------- 1 | import * as actionsExec from "@actions/exec"; 2 | import { mapOutput, syncFiles } from "./main"; 3 | 4 | // const exec = jest.createMockFromModule('@actions/exec'); 5 | 6 | describe("syncFiles", () => { 7 | test("syncFiles ssh port", async () => { 8 | const spy = jest.spyOn(actionsExec, "exec"); 9 | 10 | await syncFiles("/home/.ssh/web_deploy", { 11 | target_server: "targetserver", 12 | source_path: "./sourcePath", 13 | destination_path: "/destFolder/subFolder/", 14 | remote_user: "username", 15 | private_ssh_key: "keyname", 16 | ssh_port: "54321", 17 | rsync_options: "--test", 18 | }); 19 | 20 | expect(spy).toHaveBeenCalledWith( 21 | "rsync", 22 | [ 23 | "-e", 24 | "ssh -p 54321 -i /home/.ssh/web_deploy -o StrictHostKeyChecking=no", 25 | "--test", 26 | "./sourcePath", 27 | "username@targetserver:/destFolder/subFolder/" 28 | ], 29 | mapOutput 30 | ); 31 | }); 32 | }); -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { getInput, setFailed } from "@actions/core"; 2 | import { exec, ExecOptions } from "@actions/exec"; 3 | import { IActionArguments } from "./types"; 4 | import commandExistsSync from "command-exists"; 5 | import stringArgv from "string-argv"; 6 | import { existsSync, promises } from "fs"; 7 | import { join } from "path"; 8 | 9 | // note: when updating also update README.md, action.yml 10 | const default_rsync_options = "--archive --verbose --compress --human-readable --progress --delete-after --exclude=.git* --exclude=.git/ --exclude=README.md --exclude=readme.md --exclude=.gitignore"; 11 | const errorDeploying = "⚠️ Error deploying"; 12 | 13 | async function run() { 14 | try { 15 | const userArguments = getUserArguments(); 16 | 17 | console.log(`----------------------------------------------------------------`); 18 | console.log(`🚀 Thanks for using web deploy. Let's deploy some stuff!`); 19 | console.log(`----------------------------------------------------------------`); 20 | console.log(`If you found this project helpful, please support it`); 21 | console.log(`by giving it a ⭐ on Github --> https://github.com/SamKirkland/web-deploy`); 22 | console.log(`or add a badge 🏷️ to your projects readme --> https://github.com/SamKirkland/web-deploy#badge`); 23 | console.log(`----------------------------------------------------------------`); 24 | 25 | await verifyRsyncInstalled(); 26 | const privateKeyPath = await setupSSHPrivateKey(userArguments.private_ssh_key); 27 | await syncFiles(privateKeyPath, userArguments); 28 | 29 | console.log("✅ Deploy Complete"); 30 | } 31 | catch (error) { 32 | console.error(errorDeploying); 33 | setFailed(error as any); 34 | } 35 | } 36 | 37 | run(); 38 | 39 | function getUserArguments(): IActionArguments { 40 | return { 41 | target_server: getInput("target-server", { required: true }), 42 | destination_path: withDefault(getInput("destination-path", { required: false }), "./"), 43 | remote_user: getInput("remote-user", { required: true }), 44 | private_ssh_key: getInput("private-ssh-key", { required: true }), 45 | source_path: withDefault(getInput("source-path", { required: false }), "./"), 46 | ssh_port: withDefault(getInput("ssh-port"), "22"), 47 | rsync_options: withDefault(getInput("rsync-options"), default_rsync_options) 48 | }; 49 | } 50 | 51 | function withDefault(value: string, defaultValue: string) { 52 | if (value === "" || value === null || value === undefined) { 53 | return defaultValue; 54 | } 55 | 56 | return value; 57 | } 58 | 59 | /** 60 | * Sync changed files 61 | */ 62 | export async function syncFiles(privateKeyPath: string, args: IActionArguments) { 63 | try { 64 | const rsyncArguments: string[] = []; 65 | 66 | rsyncArguments.push(...stringArgv(`-e 'ssh -p ${args.ssh_port} -i ${privateKeyPath} -o StrictHostKeyChecking=no'`)); 67 | 68 | rsyncArguments.push(...stringArgv(args.rsync_options)); 69 | 70 | if (args.source_path !== undefined) { 71 | rsyncArguments.push(args.source_path); 72 | } 73 | 74 | const destination = `${args.remote_user}@${args.target_server}:${args.destination_path}`; 75 | rsyncArguments.push(destination); 76 | 77 | return await exec( 78 | "rsync", 79 | rsyncArguments, 80 | mapOutput 81 | ); 82 | } 83 | catch (error) { 84 | setFailed(error as any); 85 | } 86 | } 87 | 88 | async function verifyRsyncInstalled() { 89 | try { 90 | await commandExistsSync("rsync"); 91 | 92 | // command exists, continue 93 | return; 94 | } 95 | catch (commandExistsError) { 96 | throw new Error("rsync not installed. For instructions on how to fix see https://github.com/SamKirkland/web-deploy#rsync-not-installed"); 97 | } 98 | }; 99 | 100 | const { 101 | HOME, 102 | GITHUB_WORKSPACE 103 | } = process.env; 104 | 105 | export async function setupSSHPrivateKey(key: string) { 106 | const sshFolderPath = join(HOME || __dirname, '.ssh'); 107 | const privateKeyPath = join(sshFolderPath, "web_deploy_key"); 108 | 109 | console.log("HOME", HOME); 110 | console.log("GITHUB_WORKSPACE", GITHUB_WORKSPACE); 111 | 112 | await promises.mkdir(sshFolderPath, { recursive: true }); 113 | 114 | const knownHostsPath = `${sshFolderPath}/known_hosts`; 115 | 116 | if (!existsSync(knownHostsPath)) { 117 | console.log(`[SSH] Creating ${knownHostsPath} file in `, GITHUB_WORKSPACE); 118 | await promises.writeFile(knownHostsPath, "", { 119 | encoding: 'utf8', 120 | mode: 0o600 121 | }); 122 | console.log('✅ [SSH] file created.'); 123 | } else { 124 | console.log(`[SSH] ${knownHostsPath} file exist`); 125 | } 126 | 127 | await promises.writeFile(privateKeyPath, key, { 128 | encoding: 'utf8', 129 | mode: 0o600 130 | }); 131 | console.log('✅ Ssh key added to `.ssh` dir ', privateKeyPath); 132 | 133 | return privateKeyPath; 134 | }; 135 | 136 | export const mapOutput: ExecOptions = { 137 | listeners: { 138 | stdout: (data: Buffer) => { 139 | console.log(data); 140 | }, 141 | stderr: (data: Buffer) => { 142 | console.error(data); 143 | }, 144 | } 145 | }; -------------------------------------------------------------------------------- /src/types.ts: -------------------------------------------------------------------------------- 1 | export interface IActionArguments { 2 | target_server: string; 3 | source_path: string | undefined; 4 | destination_path: string; 5 | remote_user: string; 6 | private_ssh_key: string; 7 | 8 | ssh_port: string; 9 | rsync_options: string; 10 | } 11 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2019" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, 4 | "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, 5 | "outDir": "./dist" /* Redirect output structure to the directory. */, 6 | "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, 7 | "strict": true /* Enable all strict type-checking options. */, 8 | "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, 9 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, 10 | "noEmit": true, 11 | "types": ["node", "jest"] 12 | }, 13 | "exclude": ["node_modules", "**/.test.ts"] 14 | } 15 | --------------------------------------------------------------------------------