├── .gitignore ├── dist ├── package.json └── index.js ├── proxy ├── go.mod ├── go.sum ├── Dockerfile ├── proxy_test.go └── proxy.go ├── tsconfig.json ├── action.yml ├── src └── action.ts ├── .github └── workflows │ └── tests.yml ├── LICENSE ├── package.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | node_modules/ -------------------------------------------------------------------------------- /dist/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /proxy/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/cirruslabs/http-cache-action/proxy 2 | 3 | go 1.15 4 | 5 | require github.com/dimchansky/utfbom v1.1.0 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "moduleResolution": "node", 4 | "strict": true, 5 | "target": "es6" 6 | } 7 | } -------------------------------------------------------------------------------- /proxy/go.sum: -------------------------------------------------------------------------------- 1 | github.com/dimchansky/utfbom v1.1.0 h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4= 2 | github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= 3 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'HTTP Cache Proxy' 2 | description: 'Run HTTP Cache Proxy' 3 | branding: 4 | icon: 'box' 5 | color: gray-dark 6 | inputs: 7 | port: 8 | description: 'Port to run on' 9 | required: false 10 | default: '12321' 11 | 12 | runs: 13 | using: 'node12' 14 | main: 'dist/index.js' 15 | -------------------------------------------------------------------------------- /proxy/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:latest as builder 2 | 3 | WORKDIR /tmp/build 4 | ADD . /tmp/build/ 5 | 6 | RUN go get ./... && \ 7 | CGO_ENABLED=0 GOOS=linux go build -o proxy proxy.go 8 | 9 | FROM alpine:latest 10 | 11 | LABEL org.opencontainers.image.source = "https://github.com/cirruslabs/http-cache-action/" 12 | EXPOSE 12321 13 | 14 | RUN apk --no-cache add ca-certificates 15 | COPY --from=builder /tmp/build/proxy /app/ 16 | WORKDIR /app 17 | CMD ["./proxy"] -------------------------------------------------------------------------------- /src/action.ts: -------------------------------------------------------------------------------- 1 | import * as core from '@actions/core'; 2 | import {exec} from "@actions/exec"; 3 | 4 | async function run() { 5 | const port = core.getInput('port'); 6 | 7 | let runArguments = [ 8 | "run", "-d", "-p", `${port}:12321`, 9 | "--name", "cache_proxy", 10 | "--env", "ACTIONS_CACHE_URL", 11 | "--env", "ACTIONS_RUNTIME_URL", 12 | "--env", "ACTIONS_RUNTIME_TOKEN", 13 | "ghcr.io/cirruslabs/actions-http-cache-proxy:latest" 14 | ]; 15 | 16 | try { 17 | await exec(`"docker"`, runArguments); 18 | } catch (e: any) { 19 | core.error(e) 20 | } 21 | } 22 | 23 | run(); -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: tests 2 | on: 3 | push: 4 | branches: 5 | - master 6 | paths-ignore: 7 | - '**.md' 8 | pull_request: 9 | paths-ignore: 10 | - '**.md' 11 | 12 | jobs: 13 | test: 14 | runs-on: ubuntu-latest 15 | name: Test Proxy 16 | steps: 17 | - uses: actions/checkout@v2 18 | - name: Proxy Integration Tests 19 | # Need it so ACTIONS_CACHE_URL and ACTIONS_RUNTIME_TOKEN are available 20 | uses: cedrickring/golang-action@1.6.0 21 | with: 22 | args: cd proxy && go test -v ./... 23 | - name: Push Image 24 | if: github.event_name == 'push' && github.ref == 'refs/heads/master' 25 | env: 26 | CR_PAT: ${{secrets.CR_PAT}} 27 | run: | 28 | echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin 29 | docker build proxy --tag ghcr.io/cirruslabs/actions-http-cache-proxy:latest 30 | docker push ghcr.io/cirruslabs/actions-http-cache-proxy:latest 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Cirrus Labs 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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "http-cache-service", 3 | "version": "1.0.0", 4 | "description": "HTTP Caching service for GitHub Actions", 5 | "type": "module", 6 | "scripts": { 7 | "build": "ncc build src/action.ts", 8 | "test": "mocha --timeout 30000 -r ts-node/register src/**.spec.ts" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/cirruslabs/http-cache-service.git" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "MIT", 17 | "bugs": { 18 | "url": "https://github.com/cirruslabs/http-cache-service/issues" 19 | }, 20 | "homepage": "https://github.com/cirruslabs/http-cache-service#readme", 21 | "dependencies": { 22 | "@actions/core": "^1.2.5", 23 | "@actions/exec": "^1.0.4", 24 | "@actions/glob": "^0.1.0", 25 | "@actions/http-client": "^1.0.8", 26 | "@actions/io": "^1.0.2", 27 | "@azure/ms-rest-js": "^2.0.8", 28 | "@azure/storage-blob": "^12.2.0-preview.1", 29 | "@types/node": "^14.6.2", 30 | "@types/request": "^2.48.5", 31 | "@types/semver": "^7.3.3", 32 | "@types/uuid": "^8.3.0", 33 | "got": "^11.5.2", 34 | "semver": "^7.3.2", 35 | "typescript": "^4.0.2", 36 | "uuid": "^8.3.0" 37 | }, 38 | "devDependencies": { 39 | "@types/chai": "^4.2.12", 40 | "@types/mocha": "^8.0.3", 41 | "@vercel/ncc": "^0.33.3", 42 | "chai": "^4.2.0", 43 | "mocha": "^9.2.2", 44 | "request": "^2.88.2", 45 | "ts-node": "^9.0.0" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /proxy/proxy_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "crypto/rand" 5 | "fmt" 6 | "io" 7 | "net/http" 8 | "testing" 9 | "time" 10 | ) 11 | 12 | func Test_API(t *testing.T) { 13 | //log.Printf("Cache URL for debugging: %s\n", os.Getenv("ACTIONS_CACHE_URL")) 14 | //encodedToken := base32.StdEncoding.EncodeToString([]byte(os.Getenv("ACTIONS_RUNTIME_TOKEN"))) 15 | //log.Printf("Token for debugging: %s\n", encodedToken) 16 | 17 | cacheKey := fmt.Sprintf("Linux-node-%d", time.Now().Unix()) 18 | location, err := findCacheLocation(cacheKey) 19 | if err != nil { 20 | t.Error(err) 21 | } 22 | if location != "" { 23 | t.Error("cache should not exist") 24 | } 25 | 26 | cacheId, err := reserveCache(cacheKey) 27 | if err != nil { 28 | t.Error(err) 29 | return 30 | } 31 | 32 | var cacheEntrySize int64 = 100 * 1024 * 1024 33 | err = uploadCacheFromReader(cacheId, io.LimitReader(rand.Reader, cacheEntrySize)) 34 | if err != nil { 35 | t.Error(err) 36 | return 37 | } 38 | 39 | location, err = findCacheLocation(cacheKey) 40 | if err != nil { 41 | t.Error(err) 42 | return 43 | } 44 | if location == "" { 45 | t.Error("cache should exist now!") 46 | return 47 | } 48 | 49 | resp, err := http.Get(location) 50 | if err != nil { 51 | t.Error(err) 52 | return 53 | } 54 | if resp.StatusCode != 200 { 55 | t.Errorf("Failed to download cache entry: %d %s", resp.StatusCode, resp.Status) 56 | } 57 | 58 | if resp.ContentLength != cacheEntrySize { 59 | t.Errorf("Downloaded only %d bytes!", resp.ContentLength) 60 | return 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Action to run an HTTP Caching server 2 | 3 | Run a local server with an API compatible with build systems like Gradle, Bazel, Buck, Pants, etc. 4 | 5 | `/` endpoint supports `GET`, `POST`/`PUT` and `HEAD` methods for downloading, uploading and existence checking of a cache entry with `KEY` cache key. 6 | 7 | ## Inputs 8 | 9 | ### `port` 10 | 11 | **Optional** Port number to start the proxy on. By default, `12321` is used. 12 | 13 | ## Example usage 14 | 15 | ```yaml 16 | uses: cirruslabs/http-cache-action@master 17 | ``` 18 | 19 | After that you can reach the HTTP Caching Proxy via `http://localhost:12321/` 20 | 21 | ### Gradle Example 22 | 23 | ```yaml 24 | name: Tests 25 | on: [push, pull_request] 26 | 27 | jobs: 28 | test-gradle: 29 | runs-on: ubuntu-latest 30 | name: Gradle Check 31 | steps: 32 | - uses: actions/checkout@v2 33 | - uses: cirruslabs/http-cache-action@master 34 | - uses: actions/setup-java@v1 35 | with: 36 | java-version: 13 37 | - run: ./gradlew check 38 | ``` 39 | 40 | Don't forget to add the following to your `settings.gradle`: 41 | 42 | ```groovy 43 | ext.isCiServer = System.getenv().containsKey("CI") 44 | 45 | buildCache { 46 | local { 47 | enabled = !isCiServer 48 | } 49 | remote(HttpBuildCache) { 50 | url = 'http://' + System.getenv().getOrDefault("CIRRUS_HTTP_CACHE_HOST", "localhost:12321") + "/" 51 | enabled = isCiServer 52 | push = true 53 | } 54 | } 55 | ``` 56 | 57 | Or the following to your `settings.gradle.kts` if you are using Kotlin Script: 58 | 59 | 60 | ```kotlin 61 | val isCiServer = System.getenv().containsKey("CI") 62 | 63 | buildCache { 64 | local { 65 | isEnabled = !isCiServer 66 | } 67 | remote { 68 | val cacheHost = System.getenv().getOrDefault("CIRRUS_HTTP_CACHE_HOST", "localhost:12321") 69 | url = uri("http://$cacheHost/") 70 | isEnabled = isCiServer 71 | isPush = true 72 | } 73 | } 74 | ``` 75 | -------------------------------------------------------------------------------- /proxy/proxy.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "bytes" 6 | "crypto/sha256" 7 | "encoding/hex" 8 | "encoding/json" 9 | "fmt" 10 | "github.com/dimchansky/utfbom" 11 | "io" 12 | "io/ioutil" 13 | "log" 14 | "net/http" 15 | "os" 16 | "strings" 17 | "time" 18 | ) 19 | 20 | var token = os.Getenv("ACTIONS_RUNTIME_TOKEN") 21 | var httpClient = &http.Client{} 22 | 23 | type GetCacheResponse struct { 24 | ArchiveLocation string `json:"archiveLocation"` 25 | } 26 | 27 | type ReserveCacheResponse struct { 28 | CacheId int `json:"cacheId"` 29 | } 30 | 31 | func main() { 32 | http.HandleFunc("/", handler) 33 | 34 | log.Println("Starting http cache server on port 12321") 35 | err := http.ListenAndServe(":12321", nil) 36 | if err != nil { 37 | log.Printf("Failed to start server: %v\n", err) 38 | } 39 | } 40 | 41 | func handler(w http.ResponseWriter, r *http.Request) { 42 | startTime := time.Now() 43 | key := r.URL.Path 44 | if key[0] == '/' { 45 | key = key[1:] 46 | } 47 | if key == "" { 48 | _, _ = w.Write([]byte("HTTP Cache is running!")) 49 | w.WriteHeader(200) 50 | } else if r.Method == "GET" { 51 | downloadCache(w, r, key) 52 | } else if r.Method == "HEAD" { 53 | checkCacheExists(w, key) 54 | } else if r.Method == "POST" { 55 | uploadCache(w, r, key) 56 | } else if r.Method == "PUT" { 57 | uploadCache(w, r, key) 58 | } 59 | duration := time.Since(startTime) 60 | log.Printf("Served %s request for %s key in %dms\n", r.Method, key, duration.Milliseconds()) 61 | } 62 | 63 | func downloadCache(w http.ResponseWriter, r *http.Request, key string) { 64 | location, err := findCacheLocation(key) 65 | if err != nil { 66 | log.Printf("Failed to download key %s: %v\n", key, err) 67 | w.Write([]byte(err.Error())) 68 | w.WriteHeader(500) 69 | return 70 | } 71 | if location == "" { 72 | log.Printf("Cache %s not found\n", key) 73 | w.WriteHeader(404) 74 | return 75 | } 76 | proxyDownloadFromURL(w, location) 77 | } 78 | 79 | func proxyDownloadFromURL(w http.ResponseWriter, url string) { 80 | resp, err := http.Get(url) 81 | if err != nil { 82 | log.Printf("Proxying cache %s failed: %v\n", url, err) 83 | w.WriteHeader(http.StatusInternalServerError) 84 | return 85 | } 86 | successfulStatus := 100 <= resp.StatusCode && resp.StatusCode < 300 87 | if !successfulStatus { 88 | log.Printf("Proxying cache %s failed with %d status\n", url, resp.StatusCode) 89 | w.WriteHeader(resp.StatusCode) 90 | return 91 | } 92 | _, err = io.Copy(w, resp.Body) 93 | if err != nil { 94 | w.WriteHeader(http.StatusInternalServerError) 95 | } 96 | w.WriteHeader(http.StatusOK) 97 | } 98 | 99 | func checkCacheExists(w http.ResponseWriter, key string) { 100 | location, err := findCacheLocation(key) 101 | if location == "" || err != nil { 102 | log.Printf("Cache %s not found\n", key) 103 | w.WriteHeader(404) 104 | return 105 | } 106 | w.WriteHeader(200) 107 | } 108 | 109 | func findCacheLocation(key string) (string, error) { 110 | resource := fmt.Sprintf("cache?keys=%s&version=%s", key, calculateSHA256(key)) 111 | requestUrl := getCacheApiUrl(resource) 112 | request, _ := http.NewRequest("GET", requestUrl, nil) 113 | request.Header.Set("Authorization", "Bearer "+token) 114 | request.Header.Set("User-Agent", "actions/cache") 115 | request.Header.Set("Accept", "application/json;api-version=6.0-preview.1") 116 | request.Header.Set("Accept-Charset", "utf-8") 117 | 118 | response, err := httpClient.Do(request) 119 | if err != nil { 120 | return "", err 121 | } 122 | if response.StatusCode == 404 { 123 | return "", nil 124 | } 125 | if response.StatusCode == 204 { 126 | // no content 127 | return "", nil 128 | } 129 | defer response.Body.Close() 130 | bodyBytes, err := ioutil.ReadAll(utfbom.SkipOnly(response.Body)) 131 | if response.StatusCode >= 400 { 132 | log.Printf("Failed to download key %s: %d %s\n", key, response.StatusCode, string(bodyBytes)) 133 | return "", fmt.Errorf("failed to get location: %d", response.StatusCode) 134 | } 135 | 136 | cacheResponse := GetCacheResponse{} 137 | err = json.NewDecoder(bytes.NewReader(bodyBytes)).Decode(&cacheResponse) 138 | if err != nil { 139 | log.Println(string(bodyBytes)) 140 | return "", err 141 | } 142 | if cacheResponse.ArchiveLocation == "" { 143 | log.Println(string(bodyBytes)) 144 | } 145 | return cacheResponse.ArchiveLocation, nil 146 | } 147 | 148 | func uploadCache(w http.ResponseWriter, r *http.Request, key string) { 149 | cacheId, err := reserveCache(key) 150 | if err != nil { 151 | log.Printf("Failed to reserve upload for cache key %s: %v\n", key, err) 152 | w.Write([]byte(err.Error())) 153 | w.WriteHeader(500) 154 | return 155 | } 156 | err = uploadCacheFromReader(cacheId, r.Body) 157 | if err != nil { 158 | log.Printf("Failed to upload cache %s: %v\n", key, err) 159 | w.Write([]byte(err.Error())) 160 | w.WriteHeader(http.StatusBadRequest) 161 | return 162 | } 163 | w.WriteHeader(http.StatusCreated) 164 | } 165 | 166 | func uploadCacheFromReader(cacheId int, body io.Reader) error { 167 | resourceUrl := getCacheApiUrl(fmt.Sprintf("caches/%d", cacheId)) 168 | readBufferSize := int(1024 * 1024) 169 | readBuffer := make([]byte, readBufferSize) 170 | bufferedBodyReader := bufio.NewReaderSize(body, readBufferSize) 171 | bytesUploaded := 0 172 | for { 173 | n, err := bufferedBodyReader.Read(readBuffer) 174 | 175 | if n > 0 { 176 | uploadCacheChunk(resourceUrl, readBuffer[:n], bytesUploaded) 177 | bytesUploaded += n 178 | } 179 | 180 | if err == io.EOF || n == 0 { 181 | break 182 | } 183 | if err != nil { 184 | return err 185 | } 186 | } 187 | return commitCache(cacheId, bytesUploaded) 188 | } 189 | 190 | func uploadCacheChunk(url string, data []byte, position int) error { 191 | request, _ := http.NewRequest("PATCH", url, bytes.NewBuffer(data)) 192 | request.Header.Set("Authorization", "Bearer "+token) 193 | request.Header.Set("User-Agent", "actions/cache") 194 | request.Header.Set("Content-Type", "application/octet-stream") 195 | request.Header.Set("Content-Range", fmt.Sprintf("bytes %d-%d/*", position, position+len(data)-1)) 196 | request.Header.Set("Accept", "application/json;api-version=6.0-preview.1") 197 | request.Header.Set("Accept-Charset", "utf-8") 198 | 199 | response, _ := httpClient.Do(request) 200 | if response.StatusCode != 204 { 201 | defer response.Body.Close() 202 | bodyBytes, _ := ioutil.ReadAll(response.Body) 203 | log.Printf("Failed to upload cache chunk: %s\n", string(bodyBytes)) 204 | log.Println(string(bodyBytes)) 205 | return fmt.Errorf("failed to upload chunk with status %d: %s", response.StatusCode, string(bodyBytes)) 206 | } 207 | return nil 208 | } 209 | 210 | func commitCache(cacheId int, size int) error { 211 | url := getCacheApiUrl(fmt.Sprintf("caches/%d", cacheId)) 212 | requestBody := fmt.Sprintf("{ \"size\": \"%d\" }", size) 213 | request, _ := http.NewRequest("POST", url, bytes.NewBufferString(requestBody)) 214 | request.Header.Set("Authorization", "Bearer "+token) 215 | request.Header.Set("User-Agent", "actions/cache") 216 | request.Header.Set("Content-Type", "application/json") 217 | request.Header.Set("Accept", "application/json;api-version=6.0-preview.1") 218 | request.Header.Set("Accept-Charset", "utf-8") 219 | response, _ := httpClient.Do(request) 220 | if response.StatusCode != 204 { 221 | defer response.Body.Close() 222 | bodyBytes, _ := ioutil.ReadAll(response.Body) 223 | log.Printf("Failed to commit cache %d: %s\n", cacheId, string(bodyBytes)) 224 | return fmt.Errorf("failed to commit cache %d with status %d: %s", cacheId, response.StatusCode, string(bodyBytes)) 225 | } 226 | return nil 227 | } 228 | 229 | func reserveCache(key string) (int, error) { 230 | requestUrl := getCacheApiUrl("caches") 231 | requestBody := fmt.Sprintf("{ \"key\": \"%s\", \"version\": \"%s\" }", key, calculateSHA256(key)) 232 | request, _ := http.NewRequest("POST", requestUrl, bytes.NewBufferString(requestBody)) 233 | request.Header.Set("Authorization", "Bearer "+token) 234 | request.Header.Set("User-Agent", "actions/cache") 235 | request.Header.Set("Content-Type", "application/json") 236 | request.Header.Set("Accept", "application/json;api-version=6.0-preview.1") 237 | request.Header.Set("Accept-Charset", "utf-8") 238 | 239 | response, err := httpClient.Do(request) 240 | if err != nil { 241 | return -1, err 242 | } 243 | defer response.Body.Close() 244 | bodyBytes, err := ioutil.ReadAll(utfbom.SkipOnly(response.Body)) 245 | if response.StatusCode >= 400 { 246 | return -1, fmt.Errorf("failed to reserve cache: %d", response.StatusCode) 247 | } 248 | 249 | var cacheResponse ReserveCacheResponse 250 | err = json.Unmarshal(bodyBytes, &cacheResponse) 251 | if err != nil { 252 | return -1, err 253 | } 254 | return cacheResponse.CacheId, nil 255 | } 256 | 257 | func calculateSHA256(s string) string { 258 | h := sha256.New() 259 | h.Write([]byte(s)) 260 | return hex.EncodeToString(h.Sum(nil)) 261 | } 262 | 263 | func getCacheApiUrl(resource string) string { 264 | baseUrl := strings.ReplaceAll(os.Getenv("ACTIONS_CACHE_URL"), "pipelines", "artifactcache") 265 | return baseUrl + "_apis/artifactcache/" + resource 266 | } 267 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module"; 2 | /******/ var __webpack_modules__ = ({ 3 | 4 | /***/ 351: 5 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 6 | 7 | 8 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 9 | if (k2 === undefined) k2 = k; 10 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 11 | }) : (function(o, m, k, k2) { 12 | if (k2 === undefined) k2 = k; 13 | o[k2] = m[k]; 14 | })); 15 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 16 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 17 | }) : function(o, v) { 18 | o["default"] = v; 19 | }); 20 | var __importStar = (this && this.__importStar) || function (mod) { 21 | if (mod && mod.__esModule) return mod; 22 | var result = {}; 23 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 24 | __setModuleDefault(result, mod); 25 | return result; 26 | }; 27 | Object.defineProperty(exports, "__esModule", ({ value: true })); 28 | exports.issue = exports.issueCommand = void 0; 29 | const os = __importStar(__nccwpck_require__(37)); 30 | const utils_1 = __nccwpck_require__(278); 31 | /** 32 | * Commands 33 | * 34 | * Command Format: 35 | * ::name key=value,key=value::message 36 | * 37 | * Examples: 38 | * ::warning::This is the message 39 | * ::set-env name=MY_VAR::some value 40 | */ 41 | function issueCommand(command, properties, message) { 42 | const cmd = new Command(command, properties, message); 43 | process.stdout.write(cmd.toString() + os.EOL); 44 | } 45 | exports.issueCommand = issueCommand; 46 | function issue(name, message = '') { 47 | issueCommand(name, {}, message); 48 | } 49 | exports.issue = issue; 50 | const CMD_STRING = '::'; 51 | class Command { 52 | constructor(command, properties, message) { 53 | if (!command) { 54 | command = 'missing.command'; 55 | } 56 | this.command = command; 57 | this.properties = properties; 58 | this.message = message; 59 | } 60 | toString() { 61 | let cmdStr = CMD_STRING + this.command; 62 | if (this.properties && Object.keys(this.properties).length > 0) { 63 | cmdStr += ' '; 64 | let first = true; 65 | for (const key in this.properties) { 66 | if (this.properties.hasOwnProperty(key)) { 67 | const val = this.properties[key]; 68 | if (val) { 69 | if (first) { 70 | first = false; 71 | } 72 | else { 73 | cmdStr += ','; 74 | } 75 | cmdStr += `${key}=${escapeProperty(val)}`; 76 | } 77 | } 78 | } 79 | } 80 | cmdStr += `${CMD_STRING}${escapeData(this.message)}`; 81 | return cmdStr; 82 | } 83 | } 84 | function escapeData(s) { 85 | return utils_1.toCommandValue(s) 86 | .replace(/%/g, '%25') 87 | .replace(/\r/g, '%0D') 88 | .replace(/\n/g, '%0A'); 89 | } 90 | function escapeProperty(s) { 91 | return utils_1.toCommandValue(s) 92 | .replace(/%/g, '%25') 93 | .replace(/\r/g, '%0D') 94 | .replace(/\n/g, '%0A') 95 | .replace(/:/g, '%3A') 96 | .replace(/,/g, '%2C'); 97 | } 98 | //# sourceMappingURL=command.js.map 99 | 100 | /***/ }), 101 | 102 | /***/ 186: 103 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 104 | 105 | 106 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 107 | if (k2 === undefined) k2 = k; 108 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 109 | }) : (function(o, m, k, k2) { 110 | if (k2 === undefined) k2 = k; 111 | o[k2] = m[k]; 112 | })); 113 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 114 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 115 | }) : function(o, v) { 116 | o["default"] = v; 117 | }); 118 | var __importStar = (this && this.__importStar) || function (mod) { 119 | if (mod && mod.__esModule) return mod; 120 | var result = {}; 121 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 122 | __setModuleDefault(result, mod); 123 | return result; 124 | }; 125 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 126 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 127 | return new (P || (P = Promise))(function (resolve, reject) { 128 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 129 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 130 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 131 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 132 | }); 133 | }; 134 | Object.defineProperty(exports, "__esModule", ({ value: true })); 135 | 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; 136 | const command_1 = __nccwpck_require__(351); 137 | const file_command_1 = __nccwpck_require__(717); 138 | const utils_1 = __nccwpck_require__(278); 139 | const os = __importStar(__nccwpck_require__(37)); 140 | const path = __importStar(__nccwpck_require__(17)); 141 | const oidc_utils_1 = __nccwpck_require__(41); 142 | /** 143 | * The code to exit an action 144 | */ 145 | var ExitCode; 146 | (function (ExitCode) { 147 | /** 148 | * A code indicating that the action was successful 149 | */ 150 | ExitCode[ExitCode["Success"] = 0] = "Success"; 151 | /** 152 | * A code indicating that the action was a failure 153 | */ 154 | ExitCode[ExitCode["Failure"] = 1] = "Failure"; 155 | })(ExitCode = exports.ExitCode || (exports.ExitCode = {})); 156 | //----------------------------------------------------------------------- 157 | // Variables 158 | //----------------------------------------------------------------------- 159 | /** 160 | * Sets env variable for this action and future actions in the job 161 | * @param name the name of the variable to set 162 | * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify 163 | */ 164 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 165 | function exportVariable(name, val) { 166 | const convertedVal = utils_1.toCommandValue(val); 167 | process.env[name] = convertedVal; 168 | const filePath = process.env['GITHUB_ENV'] || ''; 169 | if (filePath) { 170 | const delimiter = '_GitHubActionsFileCommandDelimeter_'; 171 | const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; 172 | file_command_1.issueCommand('ENV', commandValue); 173 | } 174 | else { 175 | command_1.issueCommand('set-env', { name }, convertedVal); 176 | } 177 | } 178 | exports.exportVariable = exportVariable; 179 | /** 180 | * Registers a secret which will get masked from logs 181 | * @param secret value of the secret 182 | */ 183 | function setSecret(secret) { 184 | command_1.issueCommand('add-mask', {}, secret); 185 | } 186 | exports.setSecret = setSecret; 187 | /** 188 | * Prepends inputPath to the PATH (for this action and future actions) 189 | * @param inputPath 190 | */ 191 | function addPath(inputPath) { 192 | const filePath = process.env['GITHUB_PATH'] || ''; 193 | if (filePath) { 194 | file_command_1.issueCommand('PATH', inputPath); 195 | } 196 | else { 197 | command_1.issueCommand('add-path', {}, inputPath); 198 | } 199 | process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; 200 | } 201 | exports.addPath = addPath; 202 | /** 203 | * Gets the value of an input. 204 | * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed. 205 | * Returns an empty string if the value is not defined. 206 | * 207 | * @param name name of the input to get 208 | * @param options optional. See InputOptions. 209 | * @returns string 210 | */ 211 | function getInput(name, options) { 212 | const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; 213 | if (options && options.required && !val) { 214 | throw new Error(`Input required and not supplied: ${name}`); 215 | } 216 | if (options && options.trimWhitespace === false) { 217 | return val; 218 | } 219 | return val.trim(); 220 | } 221 | exports.getInput = getInput; 222 | /** 223 | * Gets the values of an multiline input. Each value is also trimmed. 224 | * 225 | * @param name name of the input to get 226 | * @param options optional. See InputOptions. 227 | * @returns string[] 228 | * 229 | */ 230 | function getMultilineInput(name, options) { 231 | const inputs = getInput(name, options) 232 | .split('\n') 233 | .filter(x => x !== ''); 234 | return inputs; 235 | } 236 | exports.getMultilineInput = getMultilineInput; 237 | /** 238 | * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. 239 | * Support boolean input list: `true | True | TRUE | false | False | FALSE` . 240 | * The return value is also in boolean type. 241 | * ref: https://yaml.org/spec/1.2/spec.html#id2804923 242 | * 243 | * @param name name of the input to get 244 | * @param options optional. See InputOptions. 245 | * @returns boolean 246 | */ 247 | function getBooleanInput(name, options) { 248 | const trueValue = ['true', 'True', 'TRUE']; 249 | const falseValue = ['false', 'False', 'FALSE']; 250 | const val = getInput(name, options); 251 | if (trueValue.includes(val)) 252 | return true; 253 | if (falseValue.includes(val)) 254 | return false; 255 | throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` + 256 | `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); 257 | } 258 | exports.getBooleanInput = getBooleanInput; 259 | /** 260 | * Sets the value of an output. 261 | * 262 | * @param name name of the output to set 263 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify 264 | */ 265 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 266 | function setOutput(name, value) { 267 | process.stdout.write(os.EOL); 268 | command_1.issueCommand('set-output', { name }, value); 269 | } 270 | exports.setOutput = setOutput; 271 | /** 272 | * Enables or disables the echoing of commands into stdout for the rest of the step. 273 | * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. 274 | * 275 | */ 276 | function setCommandEcho(enabled) { 277 | command_1.issue('echo', enabled ? 'on' : 'off'); 278 | } 279 | exports.setCommandEcho = setCommandEcho; 280 | //----------------------------------------------------------------------- 281 | // Results 282 | //----------------------------------------------------------------------- 283 | /** 284 | * Sets the action status to failed. 285 | * When the action exits it will be with an exit code of 1 286 | * @param message add error issue message 287 | */ 288 | function setFailed(message) { 289 | process.exitCode = ExitCode.Failure; 290 | error(message); 291 | } 292 | exports.setFailed = setFailed; 293 | //----------------------------------------------------------------------- 294 | // Logging Commands 295 | //----------------------------------------------------------------------- 296 | /** 297 | * Gets whether Actions Step Debug is on or not 298 | */ 299 | function isDebug() { 300 | return process.env['RUNNER_DEBUG'] === '1'; 301 | } 302 | exports.isDebug = isDebug; 303 | /** 304 | * Writes debug message to user log 305 | * @param message debug message 306 | */ 307 | function debug(message) { 308 | command_1.issueCommand('debug', {}, message); 309 | } 310 | exports.debug = debug; 311 | /** 312 | * Adds an error issue 313 | * @param message error issue message. Errors will be converted to string via toString() 314 | * @param properties optional properties to add to the annotation. 315 | */ 316 | function error(message, properties = {}) { 317 | command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 318 | } 319 | exports.error = error; 320 | /** 321 | * Adds a warning issue 322 | * @param message warning issue message. Errors will be converted to string via toString() 323 | * @param properties optional properties to add to the annotation. 324 | */ 325 | function warning(message, properties = {}) { 326 | command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 327 | } 328 | exports.warning = warning; 329 | /** 330 | * Adds a notice issue 331 | * @param message notice issue message. Errors will be converted to string via toString() 332 | * @param properties optional properties to add to the annotation. 333 | */ 334 | function notice(message, properties = {}) { 335 | command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 336 | } 337 | exports.notice = notice; 338 | /** 339 | * Writes info to log with console.log. 340 | * @param message info message 341 | */ 342 | function info(message) { 343 | process.stdout.write(message + os.EOL); 344 | } 345 | exports.info = info; 346 | /** 347 | * Begin an output group. 348 | * 349 | * Output until the next `groupEnd` will be foldable in this group 350 | * 351 | * @param name The name of the output group 352 | */ 353 | function startGroup(name) { 354 | command_1.issue('group', name); 355 | } 356 | exports.startGroup = startGroup; 357 | /** 358 | * End an output group. 359 | */ 360 | function endGroup() { 361 | command_1.issue('endgroup'); 362 | } 363 | exports.endGroup = endGroup; 364 | /** 365 | * Wrap an asynchronous function call in a group. 366 | * 367 | * Returns the same type as the function itself. 368 | * 369 | * @param name The name of the group 370 | * @param fn The function to wrap in the group 371 | */ 372 | function group(name, fn) { 373 | return __awaiter(this, void 0, void 0, function* () { 374 | startGroup(name); 375 | let result; 376 | try { 377 | result = yield fn(); 378 | } 379 | finally { 380 | endGroup(); 381 | } 382 | return result; 383 | }); 384 | } 385 | exports.group = group; 386 | //----------------------------------------------------------------------- 387 | // Wrapper action state 388 | //----------------------------------------------------------------------- 389 | /** 390 | * Saves state for current action, the state can only be retrieved by this action's post job execution. 391 | * 392 | * @param name name of the state to store 393 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify 394 | */ 395 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 396 | function saveState(name, value) { 397 | command_1.issueCommand('save-state', { name }, value); 398 | } 399 | exports.saveState = saveState; 400 | /** 401 | * Gets the value of an state set by this action's main execution. 402 | * 403 | * @param name name of the state to get 404 | * @returns string 405 | */ 406 | function getState(name) { 407 | return process.env[`STATE_${name}`] || ''; 408 | } 409 | exports.getState = getState; 410 | function getIDToken(aud) { 411 | return __awaiter(this, void 0, void 0, function* () { 412 | return yield oidc_utils_1.OidcClient.getIDToken(aud); 413 | }); 414 | } 415 | exports.getIDToken = getIDToken; 416 | //# sourceMappingURL=core.js.map 417 | 418 | /***/ }), 419 | 420 | /***/ 717: 421 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 422 | 423 | 424 | // For internal use, subject to change. 425 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 426 | if (k2 === undefined) k2 = k; 427 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 428 | }) : (function(o, m, k, k2) { 429 | if (k2 === undefined) k2 = k; 430 | o[k2] = m[k]; 431 | })); 432 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 433 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 434 | }) : function(o, v) { 435 | o["default"] = v; 436 | }); 437 | var __importStar = (this && this.__importStar) || function (mod) { 438 | if (mod && mod.__esModule) return mod; 439 | var result = {}; 440 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 441 | __setModuleDefault(result, mod); 442 | return result; 443 | }; 444 | Object.defineProperty(exports, "__esModule", ({ value: true })); 445 | exports.issueCommand = void 0; 446 | // We use any as a valid input type 447 | /* eslint-disable @typescript-eslint/no-explicit-any */ 448 | const fs = __importStar(__nccwpck_require__(147)); 449 | const os = __importStar(__nccwpck_require__(37)); 450 | const utils_1 = __nccwpck_require__(278); 451 | function issueCommand(command, message) { 452 | const filePath = process.env[`GITHUB_${command}`]; 453 | if (!filePath) { 454 | throw new Error(`Unable to find environment variable for file command ${command}`); 455 | } 456 | if (!fs.existsSync(filePath)) { 457 | throw new Error(`Missing file at path: ${filePath}`); 458 | } 459 | fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { 460 | encoding: 'utf8' 461 | }); 462 | } 463 | exports.issueCommand = issueCommand; 464 | //# sourceMappingURL=file-command.js.map 465 | 466 | /***/ }), 467 | 468 | /***/ 41: 469 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 470 | 471 | 472 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 473 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 474 | return new (P || (P = Promise))(function (resolve, reject) { 475 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 476 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 477 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 478 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 479 | }); 480 | }; 481 | Object.defineProperty(exports, "__esModule", ({ value: true })); 482 | exports.OidcClient = void 0; 483 | const http_client_1 = __nccwpck_require__(925); 484 | const auth_1 = __nccwpck_require__(702); 485 | const core_1 = __nccwpck_require__(186); 486 | class OidcClient { 487 | static createHttpClient(allowRetry = true, maxRetry = 10) { 488 | const requestOptions = { 489 | allowRetries: allowRetry, 490 | maxRetries: maxRetry 491 | }; 492 | return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); 493 | } 494 | static getRequestToken() { 495 | const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN']; 496 | if (!token) { 497 | throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable'); 498 | } 499 | return token; 500 | } 501 | static getIDTokenUrl() { 502 | const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']; 503 | if (!runtimeUrl) { 504 | throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable'); 505 | } 506 | return runtimeUrl; 507 | } 508 | static getCall(id_token_url) { 509 | var _a; 510 | return __awaiter(this, void 0, void 0, function* () { 511 | const httpclient = OidcClient.createHttpClient(); 512 | const res = yield httpclient 513 | .getJson(id_token_url) 514 | .catch(error => { 515 | throw new Error(`Failed to get ID Token. \n 516 | Error Code : ${error.statusCode}\n 517 | Error Message: ${error.result.message}`); 518 | }); 519 | const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; 520 | if (!id_token) { 521 | throw new Error('Response json body do not have ID Token field'); 522 | } 523 | return id_token; 524 | }); 525 | } 526 | static getIDToken(audience) { 527 | return __awaiter(this, void 0, void 0, function* () { 528 | try { 529 | // New ID Token is requested from action service 530 | let id_token_url = OidcClient.getIDTokenUrl(); 531 | if (audience) { 532 | const encodedAudience = encodeURIComponent(audience); 533 | id_token_url = `${id_token_url}&audience=${encodedAudience}`; 534 | } 535 | core_1.debug(`ID token url is ${id_token_url}`); 536 | const id_token = yield OidcClient.getCall(id_token_url); 537 | core_1.setSecret(id_token); 538 | return id_token; 539 | } 540 | catch (error) { 541 | throw new Error(`Error message: ${error.message}`); 542 | } 543 | }); 544 | } 545 | } 546 | exports.OidcClient = OidcClient; 547 | //# sourceMappingURL=oidc-utils.js.map 548 | 549 | /***/ }), 550 | 551 | /***/ 278: 552 | /***/ ((__unused_webpack_module, exports) => { 553 | 554 | 555 | // We use any as a valid input type 556 | /* eslint-disable @typescript-eslint/no-explicit-any */ 557 | Object.defineProperty(exports, "__esModule", ({ value: true })); 558 | exports.toCommandProperties = exports.toCommandValue = void 0; 559 | /** 560 | * Sanitizes an input into a string so it can be passed into issueCommand safely 561 | * @param input input to sanitize into a string 562 | */ 563 | function toCommandValue(input) { 564 | if (input === null || input === undefined) { 565 | return ''; 566 | } 567 | else if (typeof input === 'string' || input instanceof String) { 568 | return input; 569 | } 570 | return JSON.stringify(input); 571 | } 572 | exports.toCommandValue = toCommandValue; 573 | /** 574 | * 575 | * @param annotationProperties 576 | * @returns The command properties to send with the actual annotation command 577 | * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 578 | */ 579 | function toCommandProperties(annotationProperties) { 580 | if (!Object.keys(annotationProperties).length) { 581 | return {}; 582 | } 583 | return { 584 | title: annotationProperties.title, 585 | file: annotationProperties.file, 586 | line: annotationProperties.startLine, 587 | endLine: annotationProperties.endLine, 588 | col: annotationProperties.startColumn, 589 | endColumn: annotationProperties.endColumn 590 | }; 591 | } 592 | exports.toCommandProperties = toCommandProperties; 593 | //# sourceMappingURL=utils.js.map 594 | 595 | /***/ }), 596 | 597 | /***/ 514: 598 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 599 | 600 | 601 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 602 | if (k2 === undefined) k2 = k; 603 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 604 | }) : (function(o, m, k, k2) { 605 | if (k2 === undefined) k2 = k; 606 | o[k2] = m[k]; 607 | })); 608 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 609 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 610 | }) : function(o, v) { 611 | o["default"] = v; 612 | }); 613 | var __importStar = (this && this.__importStar) || function (mod) { 614 | if (mod && mod.__esModule) return mod; 615 | var result = {}; 616 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 617 | __setModuleDefault(result, mod); 618 | return result; 619 | }; 620 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 621 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 622 | return new (P || (P = Promise))(function (resolve, reject) { 623 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 624 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 625 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 626 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 627 | }); 628 | }; 629 | Object.defineProperty(exports, "__esModule", ({ value: true })); 630 | exports.getExecOutput = exports.exec = void 0; 631 | const string_decoder_1 = __nccwpck_require__(576); 632 | const tr = __importStar(__nccwpck_require__(159)); 633 | /** 634 | * Exec a command. 635 | * Output will be streamed to the live console. 636 | * Returns promise with return code 637 | * 638 | * @param commandLine command to execute (can include additional args). Must be correctly escaped. 639 | * @param args optional arguments for tool. Escaping is handled by the lib. 640 | * @param options optional exec options. See ExecOptions 641 | * @returns Promise exit code 642 | */ 643 | function exec(commandLine, args, options) { 644 | return __awaiter(this, void 0, void 0, function* () { 645 | const commandArgs = tr.argStringToArray(commandLine); 646 | if (commandArgs.length === 0) { 647 | throw new Error(`Parameter 'commandLine' cannot be null or empty.`); 648 | } 649 | // Path to tool to execute should be first arg 650 | const toolPath = commandArgs[0]; 651 | args = commandArgs.slice(1).concat(args || []); 652 | const runner = new tr.ToolRunner(toolPath, args, options); 653 | return runner.exec(); 654 | }); 655 | } 656 | exports.exec = exec; 657 | /** 658 | * Exec a command and get the output. 659 | * Output will be streamed to the live console. 660 | * Returns promise with the exit code and collected stdout and stderr 661 | * 662 | * @param commandLine command to execute (can include additional args). Must be correctly escaped. 663 | * @param args optional arguments for tool. Escaping is handled by the lib. 664 | * @param options optional exec options. See ExecOptions 665 | * @returns Promise exit code, stdout, and stderr 666 | */ 667 | function getExecOutput(commandLine, args, options) { 668 | var _a, _b; 669 | return __awaiter(this, void 0, void 0, function* () { 670 | let stdout = ''; 671 | let stderr = ''; 672 | //Using string decoder covers the case where a mult-byte character is split 673 | const stdoutDecoder = new string_decoder_1.StringDecoder('utf8'); 674 | const stderrDecoder = new string_decoder_1.StringDecoder('utf8'); 675 | const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout; 676 | const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr; 677 | const stdErrListener = (data) => { 678 | stderr += stderrDecoder.write(data); 679 | if (originalStdErrListener) { 680 | originalStdErrListener(data); 681 | } 682 | }; 683 | const stdOutListener = (data) => { 684 | stdout += stdoutDecoder.write(data); 685 | if (originalStdoutListener) { 686 | originalStdoutListener(data); 687 | } 688 | }; 689 | const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener }); 690 | const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners })); 691 | //flush any remaining characters 692 | stdout += stdoutDecoder.end(); 693 | stderr += stderrDecoder.end(); 694 | return { 695 | exitCode, 696 | stdout, 697 | stderr 698 | }; 699 | }); 700 | } 701 | exports.getExecOutput = getExecOutput; 702 | //# sourceMappingURL=exec.js.map 703 | 704 | /***/ }), 705 | 706 | /***/ 159: 707 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 708 | 709 | 710 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 711 | if (k2 === undefined) k2 = k; 712 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 713 | }) : (function(o, m, k, k2) { 714 | if (k2 === undefined) k2 = k; 715 | o[k2] = m[k]; 716 | })); 717 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 718 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 719 | }) : function(o, v) { 720 | o["default"] = v; 721 | }); 722 | var __importStar = (this && this.__importStar) || function (mod) { 723 | if (mod && mod.__esModule) return mod; 724 | var result = {}; 725 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 726 | __setModuleDefault(result, mod); 727 | return result; 728 | }; 729 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 730 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 731 | return new (P || (P = Promise))(function (resolve, reject) { 732 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 733 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 734 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 735 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 736 | }); 737 | }; 738 | Object.defineProperty(exports, "__esModule", ({ value: true })); 739 | exports.argStringToArray = exports.ToolRunner = void 0; 740 | const os = __importStar(__nccwpck_require__(37)); 741 | const events = __importStar(__nccwpck_require__(361)); 742 | const child = __importStar(__nccwpck_require__(81)); 743 | const path = __importStar(__nccwpck_require__(17)); 744 | const io = __importStar(__nccwpck_require__(436)); 745 | const ioUtil = __importStar(__nccwpck_require__(962)); 746 | const timers_1 = __nccwpck_require__(512); 747 | /* eslint-disable @typescript-eslint/unbound-method */ 748 | const IS_WINDOWS = process.platform === 'win32'; 749 | /* 750 | * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way. 751 | */ 752 | class ToolRunner extends events.EventEmitter { 753 | constructor(toolPath, args, options) { 754 | super(); 755 | if (!toolPath) { 756 | throw new Error("Parameter 'toolPath' cannot be null or empty."); 757 | } 758 | this.toolPath = toolPath; 759 | this.args = args || []; 760 | this.options = options || {}; 761 | } 762 | _debug(message) { 763 | if (this.options.listeners && this.options.listeners.debug) { 764 | this.options.listeners.debug(message); 765 | } 766 | } 767 | _getCommandString(options, noPrefix) { 768 | const toolPath = this._getSpawnFileName(); 769 | const args = this._getSpawnArgs(options); 770 | let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool 771 | if (IS_WINDOWS) { 772 | // Windows + cmd file 773 | if (this._isCmdFile()) { 774 | cmd += toolPath; 775 | for (const a of args) { 776 | cmd += ` ${a}`; 777 | } 778 | } 779 | // Windows + verbatim 780 | else if (options.windowsVerbatimArguments) { 781 | cmd += `"${toolPath}"`; 782 | for (const a of args) { 783 | cmd += ` ${a}`; 784 | } 785 | } 786 | // Windows (regular) 787 | else { 788 | cmd += this._windowsQuoteCmdArg(toolPath); 789 | for (const a of args) { 790 | cmd += ` ${this._windowsQuoteCmdArg(a)}`; 791 | } 792 | } 793 | } 794 | else { 795 | // OSX/Linux - this can likely be improved with some form of quoting. 796 | // creating processes on Unix is fundamentally different than Windows. 797 | // on Unix, execvp() takes an arg array. 798 | cmd += toolPath; 799 | for (const a of args) { 800 | cmd += ` ${a}`; 801 | } 802 | } 803 | return cmd; 804 | } 805 | _processLineBuffer(data, strBuffer, onLine) { 806 | try { 807 | let s = strBuffer + data.toString(); 808 | let n = s.indexOf(os.EOL); 809 | while (n > -1) { 810 | const line = s.substring(0, n); 811 | onLine(line); 812 | // the rest of the string ... 813 | s = s.substring(n + os.EOL.length); 814 | n = s.indexOf(os.EOL); 815 | } 816 | return s; 817 | } 818 | catch (err) { 819 | // streaming lines to console is best effort. Don't fail a build. 820 | this._debug(`error processing line. Failed with error ${err}`); 821 | return ''; 822 | } 823 | } 824 | _getSpawnFileName() { 825 | if (IS_WINDOWS) { 826 | if (this._isCmdFile()) { 827 | return process.env['COMSPEC'] || 'cmd.exe'; 828 | } 829 | } 830 | return this.toolPath; 831 | } 832 | _getSpawnArgs(options) { 833 | if (IS_WINDOWS) { 834 | if (this._isCmdFile()) { 835 | let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`; 836 | for (const a of this.args) { 837 | argline += ' '; 838 | argline += options.windowsVerbatimArguments 839 | ? a 840 | : this._windowsQuoteCmdArg(a); 841 | } 842 | argline += '"'; 843 | return [argline]; 844 | } 845 | } 846 | return this.args; 847 | } 848 | _endsWith(str, end) { 849 | return str.endsWith(end); 850 | } 851 | _isCmdFile() { 852 | const upperToolPath = this.toolPath.toUpperCase(); 853 | return (this._endsWith(upperToolPath, '.CMD') || 854 | this._endsWith(upperToolPath, '.BAT')); 855 | } 856 | _windowsQuoteCmdArg(arg) { 857 | // for .exe, apply the normal quoting rules that libuv applies 858 | if (!this._isCmdFile()) { 859 | return this._uvQuoteCmdArg(arg); 860 | } 861 | // otherwise apply quoting rules specific to the cmd.exe command line parser. 862 | // the libuv rules are generic and are not designed specifically for cmd.exe 863 | // command line parser. 864 | // 865 | // for a detailed description of the cmd.exe command line parser, refer to 866 | // http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912 867 | // need quotes for empty arg 868 | if (!arg) { 869 | return '""'; 870 | } 871 | // determine whether the arg needs to be quoted 872 | const cmdSpecialChars = [ 873 | ' ', 874 | '\t', 875 | '&', 876 | '(', 877 | ')', 878 | '[', 879 | ']', 880 | '{', 881 | '}', 882 | '^', 883 | '=', 884 | ';', 885 | '!', 886 | "'", 887 | '+', 888 | ',', 889 | '`', 890 | '~', 891 | '|', 892 | '<', 893 | '>', 894 | '"' 895 | ]; 896 | let needsQuotes = false; 897 | for (const char of arg) { 898 | if (cmdSpecialChars.some(x => x === char)) { 899 | needsQuotes = true; 900 | break; 901 | } 902 | } 903 | // short-circuit if quotes not needed 904 | if (!needsQuotes) { 905 | return arg; 906 | } 907 | // the following quoting rules are very similar to the rules that by libuv applies. 908 | // 909 | // 1) wrap the string in quotes 910 | // 911 | // 2) double-up quotes - i.e. " => "" 912 | // 913 | // this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately 914 | // doesn't work well with a cmd.exe command line. 915 | // 916 | // note, replacing " with "" also works well if the arg is passed to a downstream .NET console app. 917 | // for example, the command line: 918 | // foo.exe "myarg:""my val""" 919 | // is parsed by a .NET console app into an arg array: 920 | // [ "myarg:\"my val\"" ] 921 | // which is the same end result when applying libuv quoting rules. although the actual 922 | // command line from libuv quoting rules would look like: 923 | // foo.exe "myarg:\"my val\"" 924 | // 925 | // 3) double-up slashes that precede a quote, 926 | // e.g. hello \world => "hello \world" 927 | // hello\"world => "hello\\""world" 928 | // hello\\"world => "hello\\\\""world" 929 | // hello world\ => "hello world\\" 930 | // 931 | // technically this is not required for a cmd.exe command line, or the batch argument parser. 932 | // the reasons for including this as a .cmd quoting rule are: 933 | // 934 | // a) this is optimized for the scenario where the argument is passed from the .cmd file to an 935 | // external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule. 936 | // 937 | // b) it's what we've been doing previously (by deferring to node default behavior) and we 938 | // haven't heard any complaints about that aspect. 939 | // 940 | // note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be 941 | // escaped when used on the command line directly - even though within a .cmd file % can be escaped 942 | // by using %%. 943 | // 944 | // the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts 945 | // the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing. 946 | // 947 | // one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would 948 | // often work, since it is unlikely that var^ would exist, and the ^ character is removed when the 949 | // variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args 950 | // to an external program. 951 | // 952 | // an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file. 953 | // % can be escaped within a .cmd file. 954 | let reverse = '"'; 955 | let quoteHit = true; 956 | for (let i = arg.length; i > 0; i--) { 957 | // walk the string in reverse 958 | reverse += arg[i - 1]; 959 | if (quoteHit && arg[i - 1] === '\\') { 960 | reverse += '\\'; // double the slash 961 | } 962 | else if (arg[i - 1] === '"') { 963 | quoteHit = true; 964 | reverse += '"'; // double the quote 965 | } 966 | else { 967 | quoteHit = false; 968 | } 969 | } 970 | reverse += '"'; 971 | return reverse 972 | .split('') 973 | .reverse() 974 | .join(''); 975 | } 976 | _uvQuoteCmdArg(arg) { 977 | // Tool runner wraps child_process.spawn() and needs to apply the same quoting as 978 | // Node in certain cases where the undocumented spawn option windowsVerbatimArguments 979 | // is used. 980 | // 981 | // Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV, 982 | // see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details), 983 | // pasting copyright notice from Node within this function: 984 | // 985 | // Copyright Joyent, Inc. and other Node contributors. All rights reserved. 986 | // 987 | // Permission is hereby granted, free of charge, to any person obtaining a copy 988 | // of this software and associated documentation files (the "Software"), to 989 | // deal in the Software without restriction, including without limitation the 990 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 991 | // sell copies of the Software, and to permit persons to whom the Software is 992 | // furnished to do so, subject to the following conditions: 993 | // 994 | // The above copyright notice and this permission notice shall be included in 995 | // all copies or substantial portions of the Software. 996 | // 997 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 998 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 999 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1000 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1001 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 1002 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 1003 | // IN THE SOFTWARE. 1004 | if (!arg) { 1005 | // Need double quotation for empty argument 1006 | return '""'; 1007 | } 1008 | if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) { 1009 | // No quotation needed 1010 | return arg; 1011 | } 1012 | if (!arg.includes('"') && !arg.includes('\\')) { 1013 | // No embedded double quotes or backslashes, so I can just wrap 1014 | // quote marks around the whole thing. 1015 | return `"${arg}"`; 1016 | } 1017 | // Expected input/output: 1018 | // input : hello"world 1019 | // output: "hello\"world" 1020 | // input : hello""world 1021 | // output: "hello\"\"world" 1022 | // input : hello\world 1023 | // output: hello\world 1024 | // input : hello\\world 1025 | // output: hello\\world 1026 | // input : hello\"world 1027 | // output: "hello\\\"world" 1028 | // input : hello\\"world 1029 | // output: "hello\\\\\"world" 1030 | // input : hello world\ 1031 | // output: "hello world\\" - note the comment in libuv actually reads "hello world\" 1032 | // but it appears the comment is wrong, it should be "hello world\\" 1033 | let reverse = '"'; 1034 | let quoteHit = true; 1035 | for (let i = arg.length; i > 0; i--) { 1036 | // walk the string in reverse 1037 | reverse += arg[i - 1]; 1038 | if (quoteHit && arg[i - 1] === '\\') { 1039 | reverse += '\\'; 1040 | } 1041 | else if (arg[i - 1] === '"') { 1042 | quoteHit = true; 1043 | reverse += '\\'; 1044 | } 1045 | else { 1046 | quoteHit = false; 1047 | } 1048 | } 1049 | reverse += '"'; 1050 | return reverse 1051 | .split('') 1052 | .reverse() 1053 | .join(''); 1054 | } 1055 | _cloneExecOptions(options) { 1056 | options = options || {}; 1057 | const result = { 1058 | cwd: options.cwd || process.cwd(), 1059 | env: options.env || process.env, 1060 | silent: options.silent || false, 1061 | windowsVerbatimArguments: options.windowsVerbatimArguments || false, 1062 | failOnStdErr: options.failOnStdErr || false, 1063 | ignoreReturnCode: options.ignoreReturnCode || false, 1064 | delay: options.delay || 10000 1065 | }; 1066 | result.outStream = options.outStream || process.stdout; 1067 | result.errStream = options.errStream || process.stderr; 1068 | return result; 1069 | } 1070 | _getSpawnOptions(options, toolPath) { 1071 | options = options || {}; 1072 | const result = {}; 1073 | result.cwd = options.cwd; 1074 | result.env = options.env; 1075 | result['windowsVerbatimArguments'] = 1076 | options.windowsVerbatimArguments || this._isCmdFile(); 1077 | if (options.windowsVerbatimArguments) { 1078 | result.argv0 = `"${toolPath}"`; 1079 | } 1080 | return result; 1081 | } 1082 | /** 1083 | * Exec a tool. 1084 | * Output will be streamed to the live console. 1085 | * Returns promise with return code 1086 | * 1087 | * @param tool path to tool to exec 1088 | * @param options optional exec options. See ExecOptions 1089 | * @returns number 1090 | */ 1091 | exec() { 1092 | return __awaiter(this, void 0, void 0, function* () { 1093 | // root the tool path if it is unrooted and contains relative pathing 1094 | if (!ioUtil.isRooted(this.toolPath) && 1095 | (this.toolPath.includes('/') || 1096 | (IS_WINDOWS && this.toolPath.includes('\\')))) { 1097 | // prefer options.cwd if it is specified, however options.cwd may also need to be rooted 1098 | this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); 1099 | } 1100 | // if the tool is only a file name, then resolve it from the PATH 1101 | // otherwise verify it exists (add extension on Windows if necessary) 1102 | this.toolPath = yield io.which(this.toolPath, true); 1103 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 1104 | this._debug(`exec tool: ${this.toolPath}`); 1105 | this._debug('arguments:'); 1106 | for (const arg of this.args) { 1107 | this._debug(` ${arg}`); 1108 | } 1109 | const optionsNonNull = this._cloneExecOptions(this.options); 1110 | if (!optionsNonNull.silent && optionsNonNull.outStream) { 1111 | optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); 1112 | } 1113 | const state = new ExecState(optionsNonNull, this.toolPath); 1114 | state.on('debug', (message) => { 1115 | this._debug(message); 1116 | }); 1117 | if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) { 1118 | return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`)); 1119 | } 1120 | const fileName = this._getSpawnFileName(); 1121 | const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); 1122 | let stdbuffer = ''; 1123 | if (cp.stdout) { 1124 | cp.stdout.on('data', (data) => { 1125 | if (this.options.listeners && this.options.listeners.stdout) { 1126 | this.options.listeners.stdout(data); 1127 | } 1128 | if (!optionsNonNull.silent && optionsNonNull.outStream) { 1129 | optionsNonNull.outStream.write(data); 1130 | } 1131 | stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => { 1132 | if (this.options.listeners && this.options.listeners.stdline) { 1133 | this.options.listeners.stdline(line); 1134 | } 1135 | }); 1136 | }); 1137 | } 1138 | let errbuffer = ''; 1139 | if (cp.stderr) { 1140 | cp.stderr.on('data', (data) => { 1141 | state.processStderr = true; 1142 | if (this.options.listeners && this.options.listeners.stderr) { 1143 | this.options.listeners.stderr(data); 1144 | } 1145 | if (!optionsNonNull.silent && 1146 | optionsNonNull.errStream && 1147 | optionsNonNull.outStream) { 1148 | const s = optionsNonNull.failOnStdErr 1149 | ? optionsNonNull.errStream 1150 | : optionsNonNull.outStream; 1151 | s.write(data); 1152 | } 1153 | errbuffer = this._processLineBuffer(data, errbuffer, (line) => { 1154 | if (this.options.listeners && this.options.listeners.errline) { 1155 | this.options.listeners.errline(line); 1156 | } 1157 | }); 1158 | }); 1159 | } 1160 | cp.on('error', (err) => { 1161 | state.processError = err.message; 1162 | state.processExited = true; 1163 | state.processClosed = true; 1164 | state.CheckComplete(); 1165 | }); 1166 | cp.on('exit', (code) => { 1167 | state.processExitCode = code; 1168 | state.processExited = true; 1169 | this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); 1170 | state.CheckComplete(); 1171 | }); 1172 | cp.on('close', (code) => { 1173 | state.processExitCode = code; 1174 | state.processExited = true; 1175 | state.processClosed = true; 1176 | this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); 1177 | state.CheckComplete(); 1178 | }); 1179 | state.on('done', (error, exitCode) => { 1180 | if (stdbuffer.length > 0) { 1181 | this.emit('stdline', stdbuffer); 1182 | } 1183 | if (errbuffer.length > 0) { 1184 | this.emit('errline', errbuffer); 1185 | } 1186 | cp.removeAllListeners(); 1187 | if (error) { 1188 | reject(error); 1189 | } 1190 | else { 1191 | resolve(exitCode); 1192 | } 1193 | }); 1194 | if (this.options.input) { 1195 | if (!cp.stdin) { 1196 | throw new Error('child process missing stdin'); 1197 | } 1198 | cp.stdin.end(this.options.input); 1199 | } 1200 | })); 1201 | }); 1202 | } 1203 | } 1204 | exports.ToolRunner = ToolRunner; 1205 | /** 1206 | * Convert an arg string to an array of args. Handles escaping 1207 | * 1208 | * @param argString string of arguments 1209 | * @returns string[] array of arguments 1210 | */ 1211 | function argStringToArray(argString) { 1212 | const args = []; 1213 | let inQuotes = false; 1214 | let escaped = false; 1215 | let arg = ''; 1216 | function append(c) { 1217 | // we only escape double quotes. 1218 | if (escaped && c !== '"') { 1219 | arg += '\\'; 1220 | } 1221 | arg += c; 1222 | escaped = false; 1223 | } 1224 | for (let i = 0; i < argString.length; i++) { 1225 | const c = argString.charAt(i); 1226 | if (c === '"') { 1227 | if (!escaped) { 1228 | inQuotes = !inQuotes; 1229 | } 1230 | else { 1231 | append(c); 1232 | } 1233 | continue; 1234 | } 1235 | if (c === '\\' && escaped) { 1236 | append(c); 1237 | continue; 1238 | } 1239 | if (c === '\\' && inQuotes) { 1240 | escaped = true; 1241 | continue; 1242 | } 1243 | if (c === ' ' && !inQuotes) { 1244 | if (arg.length > 0) { 1245 | args.push(arg); 1246 | arg = ''; 1247 | } 1248 | continue; 1249 | } 1250 | append(c); 1251 | } 1252 | if (arg.length > 0) { 1253 | args.push(arg.trim()); 1254 | } 1255 | return args; 1256 | } 1257 | exports.argStringToArray = argStringToArray; 1258 | class ExecState extends events.EventEmitter { 1259 | constructor(options, toolPath) { 1260 | super(); 1261 | this.processClosed = false; // tracks whether the process has exited and stdio is closed 1262 | this.processError = ''; 1263 | this.processExitCode = 0; 1264 | this.processExited = false; // tracks whether the process has exited 1265 | this.processStderr = false; // tracks whether stderr was written to 1266 | this.delay = 10000; // 10 seconds 1267 | this.done = false; 1268 | this.timeout = null; 1269 | if (!toolPath) { 1270 | throw new Error('toolPath must not be empty'); 1271 | } 1272 | this.options = options; 1273 | this.toolPath = toolPath; 1274 | if (options.delay) { 1275 | this.delay = options.delay; 1276 | } 1277 | } 1278 | CheckComplete() { 1279 | if (this.done) { 1280 | return; 1281 | } 1282 | if (this.processClosed) { 1283 | this._setResult(); 1284 | } 1285 | else if (this.processExited) { 1286 | this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this); 1287 | } 1288 | } 1289 | _debug(message) { 1290 | this.emit('debug', message); 1291 | } 1292 | _setResult() { 1293 | // determine whether there is an error 1294 | let error; 1295 | if (this.processExited) { 1296 | if (this.processError) { 1297 | 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}`); 1298 | } 1299 | else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) { 1300 | error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`); 1301 | } 1302 | else if (this.processStderr && this.options.failOnStdErr) { 1303 | error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`); 1304 | } 1305 | } 1306 | // clear the timeout 1307 | if (this.timeout) { 1308 | clearTimeout(this.timeout); 1309 | this.timeout = null; 1310 | } 1311 | this.done = true; 1312 | this.emit('done', error, this.processExitCode); 1313 | } 1314 | static HandleTimeout(state) { 1315 | if (state.done) { 1316 | return; 1317 | } 1318 | if (!state.processClosed && state.processExited) { 1319 | const message = `The STDIO streams did not close within ${state.delay / 1320 | 1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`; 1321 | state._debug(message); 1322 | } 1323 | state._setResult(); 1324 | } 1325 | } 1326 | //# sourceMappingURL=toolrunner.js.map 1327 | 1328 | /***/ }), 1329 | 1330 | /***/ 702: 1331 | /***/ ((__unused_webpack_module, exports) => { 1332 | 1333 | 1334 | Object.defineProperty(exports, "__esModule", ({ value: true })); 1335 | class BasicCredentialHandler { 1336 | constructor(username, password) { 1337 | this.username = username; 1338 | this.password = password; 1339 | } 1340 | prepareRequest(options) { 1341 | options.headers['Authorization'] = 1342 | 'Basic ' + 1343 | Buffer.from(this.username + ':' + this.password).toString('base64'); 1344 | } 1345 | // This handler cannot handle 401 1346 | canHandleAuthentication(response) { 1347 | return false; 1348 | } 1349 | handleAuthentication(httpClient, requestInfo, objs) { 1350 | return null; 1351 | } 1352 | } 1353 | exports.BasicCredentialHandler = BasicCredentialHandler; 1354 | class BearerCredentialHandler { 1355 | constructor(token) { 1356 | this.token = token; 1357 | } 1358 | // currently implements pre-authorization 1359 | // TODO: support preAuth = false where it hooks on 401 1360 | prepareRequest(options) { 1361 | options.headers['Authorization'] = 'Bearer ' + this.token; 1362 | } 1363 | // This handler cannot handle 401 1364 | canHandleAuthentication(response) { 1365 | return false; 1366 | } 1367 | handleAuthentication(httpClient, requestInfo, objs) { 1368 | return null; 1369 | } 1370 | } 1371 | exports.BearerCredentialHandler = BearerCredentialHandler; 1372 | class PersonalAccessTokenCredentialHandler { 1373 | constructor(token) { 1374 | this.token = token; 1375 | } 1376 | // currently implements pre-authorization 1377 | // TODO: support preAuth = false where it hooks on 401 1378 | prepareRequest(options) { 1379 | options.headers['Authorization'] = 1380 | 'Basic ' + Buffer.from('PAT:' + this.token).toString('base64'); 1381 | } 1382 | // This handler cannot handle 401 1383 | canHandleAuthentication(response) { 1384 | return false; 1385 | } 1386 | handleAuthentication(httpClient, requestInfo, objs) { 1387 | return null; 1388 | } 1389 | } 1390 | exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; 1391 | 1392 | 1393 | /***/ }), 1394 | 1395 | /***/ 925: 1396 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 1397 | 1398 | 1399 | Object.defineProperty(exports, "__esModule", ({ value: true })); 1400 | const http = __nccwpck_require__(685); 1401 | const https = __nccwpck_require__(687); 1402 | const pm = __nccwpck_require__(443); 1403 | let tunnel; 1404 | var HttpCodes; 1405 | (function (HttpCodes) { 1406 | HttpCodes[HttpCodes["OK"] = 200] = "OK"; 1407 | HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; 1408 | HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; 1409 | HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; 1410 | HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; 1411 | HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; 1412 | HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; 1413 | HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; 1414 | HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; 1415 | HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; 1416 | HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; 1417 | HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; 1418 | HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; 1419 | HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; 1420 | HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; 1421 | HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; 1422 | HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; 1423 | HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; 1424 | HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; 1425 | HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; 1426 | HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; 1427 | HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; 1428 | HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; 1429 | HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; 1430 | HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; 1431 | HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; 1432 | HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; 1433 | })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); 1434 | var Headers; 1435 | (function (Headers) { 1436 | Headers["Accept"] = "accept"; 1437 | Headers["ContentType"] = "content-type"; 1438 | })(Headers = exports.Headers || (exports.Headers = {})); 1439 | var MediaTypes; 1440 | (function (MediaTypes) { 1441 | MediaTypes["ApplicationJson"] = "application/json"; 1442 | })(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); 1443 | /** 1444 | * Returns the proxy URL, depending upon the supplied url and proxy environment variables. 1445 | * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 1446 | */ 1447 | function getProxyUrl(serverUrl) { 1448 | let proxyUrl = pm.getProxyUrl(new URL(serverUrl)); 1449 | return proxyUrl ? proxyUrl.href : ''; 1450 | } 1451 | exports.getProxyUrl = getProxyUrl; 1452 | const HttpRedirectCodes = [ 1453 | HttpCodes.MovedPermanently, 1454 | HttpCodes.ResourceMoved, 1455 | HttpCodes.SeeOther, 1456 | HttpCodes.TemporaryRedirect, 1457 | HttpCodes.PermanentRedirect 1458 | ]; 1459 | const HttpResponseRetryCodes = [ 1460 | HttpCodes.BadGateway, 1461 | HttpCodes.ServiceUnavailable, 1462 | HttpCodes.GatewayTimeout 1463 | ]; 1464 | const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; 1465 | const ExponentialBackoffCeiling = 10; 1466 | const ExponentialBackoffTimeSlice = 5; 1467 | class HttpClientError extends Error { 1468 | constructor(message, statusCode) { 1469 | super(message); 1470 | this.name = 'HttpClientError'; 1471 | this.statusCode = statusCode; 1472 | Object.setPrototypeOf(this, HttpClientError.prototype); 1473 | } 1474 | } 1475 | exports.HttpClientError = HttpClientError; 1476 | class HttpClientResponse { 1477 | constructor(message) { 1478 | this.message = message; 1479 | } 1480 | readBody() { 1481 | return new Promise(async (resolve, reject) => { 1482 | let output = Buffer.alloc(0); 1483 | this.message.on('data', (chunk) => { 1484 | output = Buffer.concat([output, chunk]); 1485 | }); 1486 | this.message.on('end', () => { 1487 | resolve(output.toString()); 1488 | }); 1489 | }); 1490 | } 1491 | } 1492 | exports.HttpClientResponse = HttpClientResponse; 1493 | function isHttps(requestUrl) { 1494 | let parsedUrl = new URL(requestUrl); 1495 | return parsedUrl.protocol === 'https:'; 1496 | } 1497 | exports.isHttps = isHttps; 1498 | class HttpClient { 1499 | constructor(userAgent, handlers, requestOptions) { 1500 | this._ignoreSslError = false; 1501 | this._allowRedirects = true; 1502 | this._allowRedirectDowngrade = false; 1503 | this._maxRedirects = 50; 1504 | this._allowRetries = false; 1505 | this._maxRetries = 1; 1506 | this._keepAlive = false; 1507 | this._disposed = false; 1508 | this.userAgent = userAgent; 1509 | this.handlers = handlers || []; 1510 | this.requestOptions = requestOptions; 1511 | if (requestOptions) { 1512 | if (requestOptions.ignoreSslError != null) { 1513 | this._ignoreSslError = requestOptions.ignoreSslError; 1514 | } 1515 | this._socketTimeout = requestOptions.socketTimeout; 1516 | if (requestOptions.allowRedirects != null) { 1517 | this._allowRedirects = requestOptions.allowRedirects; 1518 | } 1519 | if (requestOptions.allowRedirectDowngrade != null) { 1520 | this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; 1521 | } 1522 | if (requestOptions.maxRedirects != null) { 1523 | this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); 1524 | } 1525 | if (requestOptions.keepAlive != null) { 1526 | this._keepAlive = requestOptions.keepAlive; 1527 | } 1528 | if (requestOptions.allowRetries != null) { 1529 | this._allowRetries = requestOptions.allowRetries; 1530 | } 1531 | if (requestOptions.maxRetries != null) { 1532 | this._maxRetries = requestOptions.maxRetries; 1533 | } 1534 | } 1535 | } 1536 | options(requestUrl, additionalHeaders) { 1537 | return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); 1538 | } 1539 | get(requestUrl, additionalHeaders) { 1540 | return this.request('GET', requestUrl, null, additionalHeaders || {}); 1541 | } 1542 | del(requestUrl, additionalHeaders) { 1543 | return this.request('DELETE', requestUrl, null, additionalHeaders || {}); 1544 | } 1545 | post(requestUrl, data, additionalHeaders) { 1546 | return this.request('POST', requestUrl, data, additionalHeaders || {}); 1547 | } 1548 | patch(requestUrl, data, additionalHeaders) { 1549 | return this.request('PATCH', requestUrl, data, additionalHeaders || {}); 1550 | } 1551 | put(requestUrl, data, additionalHeaders) { 1552 | return this.request('PUT', requestUrl, data, additionalHeaders || {}); 1553 | } 1554 | head(requestUrl, additionalHeaders) { 1555 | return this.request('HEAD', requestUrl, null, additionalHeaders || {}); 1556 | } 1557 | sendStream(verb, requestUrl, stream, additionalHeaders) { 1558 | return this.request(verb, requestUrl, stream, additionalHeaders); 1559 | } 1560 | /** 1561 | * Gets a typed object from an endpoint 1562 | * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise 1563 | */ 1564 | async getJson(requestUrl, additionalHeaders = {}) { 1565 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1566 | let res = await this.get(requestUrl, additionalHeaders); 1567 | return this._processResponse(res, this.requestOptions); 1568 | } 1569 | async postJson(requestUrl, obj, additionalHeaders = {}) { 1570 | let data = JSON.stringify(obj, null, 2); 1571 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1572 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1573 | let res = await this.post(requestUrl, data, additionalHeaders); 1574 | return this._processResponse(res, this.requestOptions); 1575 | } 1576 | async putJson(requestUrl, obj, additionalHeaders = {}) { 1577 | let data = JSON.stringify(obj, null, 2); 1578 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1579 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1580 | let res = await this.put(requestUrl, data, additionalHeaders); 1581 | return this._processResponse(res, this.requestOptions); 1582 | } 1583 | async patchJson(requestUrl, obj, additionalHeaders = {}) { 1584 | let data = JSON.stringify(obj, null, 2); 1585 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1586 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1587 | let res = await this.patch(requestUrl, data, additionalHeaders); 1588 | return this._processResponse(res, this.requestOptions); 1589 | } 1590 | /** 1591 | * Makes a raw http request. 1592 | * All other methods such as get, post, patch, and request ultimately call this. 1593 | * Prefer get, del, post and patch 1594 | */ 1595 | async request(verb, requestUrl, data, headers) { 1596 | if (this._disposed) { 1597 | throw new Error('Client has already been disposed.'); 1598 | } 1599 | let parsedUrl = new URL(requestUrl); 1600 | let info = this._prepareRequest(verb, parsedUrl, headers); 1601 | // Only perform retries on reads since writes may not be idempotent. 1602 | let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1 1603 | ? this._maxRetries + 1 1604 | : 1; 1605 | let numTries = 0; 1606 | let response; 1607 | while (numTries < maxTries) { 1608 | response = await this.requestRaw(info, data); 1609 | // Check if it's an authentication challenge 1610 | if (response && 1611 | response.message && 1612 | response.message.statusCode === HttpCodes.Unauthorized) { 1613 | let authenticationHandler; 1614 | for (let i = 0; i < this.handlers.length; i++) { 1615 | if (this.handlers[i].canHandleAuthentication(response)) { 1616 | authenticationHandler = this.handlers[i]; 1617 | break; 1618 | } 1619 | } 1620 | if (authenticationHandler) { 1621 | return authenticationHandler.handleAuthentication(this, info, data); 1622 | } 1623 | else { 1624 | // We have received an unauthorized response but have no handlers to handle it. 1625 | // Let the response return to the caller. 1626 | return response; 1627 | } 1628 | } 1629 | let redirectsRemaining = this._maxRedirects; 1630 | while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 && 1631 | this._allowRedirects && 1632 | redirectsRemaining > 0) { 1633 | const redirectUrl = response.message.headers['location']; 1634 | if (!redirectUrl) { 1635 | // if there's no location to redirect to, we won't 1636 | break; 1637 | } 1638 | let parsedRedirectUrl = new URL(redirectUrl); 1639 | if (parsedUrl.protocol == 'https:' && 1640 | parsedUrl.protocol != parsedRedirectUrl.protocol && 1641 | !this._allowRedirectDowngrade) { 1642 | 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.'); 1643 | } 1644 | // we need to finish reading the response before reassigning response 1645 | // which will leak the open socket. 1646 | await response.readBody(); 1647 | // strip authorization header if redirected to a different hostname 1648 | if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { 1649 | for (let header in headers) { 1650 | // header names are case insensitive 1651 | if (header.toLowerCase() === 'authorization') { 1652 | delete headers[header]; 1653 | } 1654 | } 1655 | } 1656 | // let's make the request with the new redirectUrl 1657 | info = this._prepareRequest(verb, parsedRedirectUrl, headers); 1658 | response = await this.requestRaw(info, data); 1659 | redirectsRemaining--; 1660 | } 1661 | if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { 1662 | // If not a retry code, return immediately instead of retrying 1663 | return response; 1664 | } 1665 | numTries += 1; 1666 | if (numTries < maxTries) { 1667 | await response.readBody(); 1668 | await this._performExponentialBackoff(numTries); 1669 | } 1670 | } 1671 | return response; 1672 | } 1673 | /** 1674 | * Needs to be called if keepAlive is set to true in request options. 1675 | */ 1676 | dispose() { 1677 | if (this._agent) { 1678 | this._agent.destroy(); 1679 | } 1680 | this._disposed = true; 1681 | } 1682 | /** 1683 | * Raw request. 1684 | * @param info 1685 | * @param data 1686 | */ 1687 | requestRaw(info, data) { 1688 | return new Promise((resolve, reject) => { 1689 | let callbackForResult = function (err, res) { 1690 | if (err) { 1691 | reject(err); 1692 | } 1693 | resolve(res); 1694 | }; 1695 | this.requestRawWithCallback(info, data, callbackForResult); 1696 | }); 1697 | } 1698 | /** 1699 | * Raw request with callback. 1700 | * @param info 1701 | * @param data 1702 | * @param onResult 1703 | */ 1704 | requestRawWithCallback(info, data, onResult) { 1705 | let socket; 1706 | if (typeof data === 'string') { 1707 | info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); 1708 | } 1709 | let callbackCalled = false; 1710 | let handleResult = (err, res) => { 1711 | if (!callbackCalled) { 1712 | callbackCalled = true; 1713 | onResult(err, res); 1714 | } 1715 | }; 1716 | let req = info.httpModule.request(info.options, (msg) => { 1717 | let res = new HttpClientResponse(msg); 1718 | handleResult(null, res); 1719 | }); 1720 | req.on('socket', sock => { 1721 | socket = sock; 1722 | }); 1723 | // If we ever get disconnected, we want the socket to timeout eventually 1724 | req.setTimeout(this._socketTimeout || 3 * 60000, () => { 1725 | if (socket) { 1726 | socket.end(); 1727 | } 1728 | handleResult(new Error('Request timeout: ' + info.options.path), null); 1729 | }); 1730 | req.on('error', function (err) { 1731 | // err has statusCode property 1732 | // res should have headers 1733 | handleResult(err, null); 1734 | }); 1735 | if (data && typeof data === 'string') { 1736 | req.write(data, 'utf8'); 1737 | } 1738 | if (data && typeof data !== 'string') { 1739 | data.on('close', function () { 1740 | req.end(); 1741 | }); 1742 | data.pipe(req); 1743 | } 1744 | else { 1745 | req.end(); 1746 | } 1747 | } 1748 | /** 1749 | * Gets an http agent. This function is useful when you need an http agent that handles 1750 | * routing through a proxy server - depending upon the url and proxy environment variables. 1751 | * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 1752 | */ 1753 | getAgent(serverUrl) { 1754 | let parsedUrl = new URL(serverUrl); 1755 | return this._getAgent(parsedUrl); 1756 | } 1757 | _prepareRequest(method, requestUrl, headers) { 1758 | const info = {}; 1759 | info.parsedUrl = requestUrl; 1760 | const usingSsl = info.parsedUrl.protocol === 'https:'; 1761 | info.httpModule = usingSsl ? https : http; 1762 | const defaultPort = usingSsl ? 443 : 80; 1763 | info.options = {}; 1764 | info.options.host = info.parsedUrl.hostname; 1765 | info.options.port = info.parsedUrl.port 1766 | ? parseInt(info.parsedUrl.port) 1767 | : defaultPort; 1768 | info.options.path = 1769 | (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); 1770 | info.options.method = method; 1771 | info.options.headers = this._mergeHeaders(headers); 1772 | if (this.userAgent != null) { 1773 | info.options.headers['user-agent'] = this.userAgent; 1774 | } 1775 | info.options.agent = this._getAgent(info.parsedUrl); 1776 | // gives handlers an opportunity to participate 1777 | if (this.handlers) { 1778 | this.handlers.forEach(handler => { 1779 | handler.prepareRequest(info.options); 1780 | }); 1781 | } 1782 | return info; 1783 | } 1784 | _mergeHeaders(headers) { 1785 | const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); 1786 | if (this.requestOptions && this.requestOptions.headers) { 1787 | return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); 1788 | } 1789 | return lowercaseKeys(headers || {}); 1790 | } 1791 | _getExistingOrDefaultHeader(additionalHeaders, header, _default) { 1792 | const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); 1793 | let clientHeader; 1794 | if (this.requestOptions && this.requestOptions.headers) { 1795 | clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; 1796 | } 1797 | return additionalHeaders[header] || clientHeader || _default; 1798 | } 1799 | _getAgent(parsedUrl) { 1800 | let agent; 1801 | let proxyUrl = pm.getProxyUrl(parsedUrl); 1802 | let useProxy = proxyUrl && proxyUrl.hostname; 1803 | if (this._keepAlive && useProxy) { 1804 | agent = this._proxyAgent; 1805 | } 1806 | if (this._keepAlive && !useProxy) { 1807 | agent = this._agent; 1808 | } 1809 | // if agent is already assigned use that agent. 1810 | if (!!agent) { 1811 | return agent; 1812 | } 1813 | const usingSsl = parsedUrl.protocol === 'https:'; 1814 | let maxSockets = 100; 1815 | if (!!this.requestOptions) { 1816 | maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; 1817 | } 1818 | if (useProxy) { 1819 | // If using proxy, need tunnel 1820 | if (!tunnel) { 1821 | tunnel = __nccwpck_require__(294); 1822 | } 1823 | const agentOptions = { 1824 | maxSockets: maxSockets, 1825 | keepAlive: this._keepAlive, 1826 | proxy: { 1827 | ...((proxyUrl.username || proxyUrl.password) && { 1828 | proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` 1829 | }), 1830 | host: proxyUrl.hostname, 1831 | port: proxyUrl.port 1832 | } 1833 | }; 1834 | let tunnelAgent; 1835 | const overHttps = proxyUrl.protocol === 'https:'; 1836 | if (usingSsl) { 1837 | tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; 1838 | } 1839 | else { 1840 | tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; 1841 | } 1842 | agent = tunnelAgent(agentOptions); 1843 | this._proxyAgent = agent; 1844 | } 1845 | // if reusing agent across request and tunneling agent isn't assigned create a new agent 1846 | if (this._keepAlive && !agent) { 1847 | const options = { keepAlive: this._keepAlive, maxSockets: maxSockets }; 1848 | agent = usingSsl ? new https.Agent(options) : new http.Agent(options); 1849 | this._agent = agent; 1850 | } 1851 | // if not using private agent and tunnel agent isn't setup then use global agent 1852 | if (!agent) { 1853 | agent = usingSsl ? https.globalAgent : http.globalAgent; 1854 | } 1855 | if (usingSsl && this._ignoreSslError) { 1856 | // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process 1857 | // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options 1858 | // we have to cast it to any and change it directly 1859 | agent.options = Object.assign(agent.options || {}, { 1860 | rejectUnauthorized: false 1861 | }); 1862 | } 1863 | return agent; 1864 | } 1865 | _performExponentialBackoff(retryNumber) { 1866 | retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); 1867 | const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); 1868 | return new Promise(resolve => setTimeout(() => resolve(), ms)); 1869 | } 1870 | static dateTimeDeserializer(key, value) { 1871 | if (typeof value === 'string') { 1872 | let a = new Date(value); 1873 | if (!isNaN(a.valueOf())) { 1874 | return a; 1875 | } 1876 | } 1877 | return value; 1878 | } 1879 | async _processResponse(res, options) { 1880 | return new Promise(async (resolve, reject) => { 1881 | const statusCode = res.message.statusCode; 1882 | const response = { 1883 | statusCode: statusCode, 1884 | result: null, 1885 | headers: {} 1886 | }; 1887 | // not found leads to null obj returned 1888 | if (statusCode == HttpCodes.NotFound) { 1889 | resolve(response); 1890 | } 1891 | let obj; 1892 | let contents; 1893 | // get the result from the body 1894 | try { 1895 | contents = await res.readBody(); 1896 | if (contents && contents.length > 0) { 1897 | if (options && options.deserializeDates) { 1898 | obj = JSON.parse(contents, HttpClient.dateTimeDeserializer); 1899 | } 1900 | else { 1901 | obj = JSON.parse(contents); 1902 | } 1903 | response.result = obj; 1904 | } 1905 | response.headers = res.message.headers; 1906 | } 1907 | catch (err) { 1908 | // Invalid resource (contents not json); leaving result obj null 1909 | } 1910 | // note that 3xx redirects are handled by the http layer. 1911 | if (statusCode > 299) { 1912 | let msg; 1913 | // if exception/error in body, attempt to get better error 1914 | if (obj && obj.message) { 1915 | msg = obj.message; 1916 | } 1917 | else if (contents && contents.length > 0) { 1918 | // it may be the case that the exception is in the body message as string 1919 | msg = contents; 1920 | } 1921 | else { 1922 | msg = 'Failed request: (' + statusCode + ')'; 1923 | } 1924 | let err = new HttpClientError(msg, statusCode); 1925 | err.result = response.result; 1926 | reject(err); 1927 | } 1928 | else { 1929 | resolve(response); 1930 | } 1931 | }); 1932 | } 1933 | } 1934 | exports.HttpClient = HttpClient; 1935 | 1936 | 1937 | /***/ }), 1938 | 1939 | /***/ 443: 1940 | /***/ ((__unused_webpack_module, exports) => { 1941 | 1942 | 1943 | Object.defineProperty(exports, "__esModule", ({ value: true })); 1944 | function getProxyUrl(reqUrl) { 1945 | let usingSsl = reqUrl.protocol === 'https:'; 1946 | let proxyUrl; 1947 | if (checkBypass(reqUrl)) { 1948 | return proxyUrl; 1949 | } 1950 | let proxyVar; 1951 | if (usingSsl) { 1952 | proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY']; 1953 | } 1954 | else { 1955 | proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY']; 1956 | } 1957 | if (proxyVar) { 1958 | proxyUrl = new URL(proxyVar); 1959 | } 1960 | return proxyUrl; 1961 | } 1962 | exports.getProxyUrl = getProxyUrl; 1963 | function checkBypass(reqUrl) { 1964 | if (!reqUrl.hostname) { 1965 | return false; 1966 | } 1967 | let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; 1968 | if (!noProxy) { 1969 | return false; 1970 | } 1971 | // Determine the request port 1972 | let reqPort; 1973 | if (reqUrl.port) { 1974 | reqPort = Number(reqUrl.port); 1975 | } 1976 | else if (reqUrl.protocol === 'http:') { 1977 | reqPort = 80; 1978 | } 1979 | else if (reqUrl.protocol === 'https:') { 1980 | reqPort = 443; 1981 | } 1982 | // Format the request hostname and hostname with port 1983 | let upperReqHosts = [reqUrl.hostname.toUpperCase()]; 1984 | if (typeof reqPort === 'number') { 1985 | upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); 1986 | } 1987 | // Compare request host against noproxy 1988 | for (let upperNoProxyItem of noProxy 1989 | .split(',') 1990 | .map(x => x.trim().toUpperCase()) 1991 | .filter(x => x)) { 1992 | if (upperReqHosts.some(x => x === upperNoProxyItem)) { 1993 | return true; 1994 | } 1995 | } 1996 | return false; 1997 | } 1998 | exports.checkBypass = checkBypass; 1999 | 2000 | 2001 | /***/ }), 2002 | 2003 | /***/ 962: 2004 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 2005 | 2006 | 2007 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 2008 | if (k2 === undefined) k2 = k; 2009 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 2010 | }) : (function(o, m, k, k2) { 2011 | if (k2 === undefined) k2 = k; 2012 | o[k2] = m[k]; 2013 | })); 2014 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 2015 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 2016 | }) : function(o, v) { 2017 | o["default"] = v; 2018 | }); 2019 | var __importStar = (this && this.__importStar) || function (mod) { 2020 | if (mod && mod.__esModule) return mod; 2021 | var result = {}; 2022 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 2023 | __setModuleDefault(result, mod); 2024 | return result; 2025 | }; 2026 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2027 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 2028 | return new (P || (P = Promise))(function (resolve, reject) { 2029 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 2030 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 2031 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 2032 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 2033 | }); 2034 | }; 2035 | var _a; 2036 | Object.defineProperty(exports, "__esModule", ({ value: true })); 2037 | 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; 2038 | const fs = __importStar(__nccwpck_require__(147)); 2039 | const path = __importStar(__nccwpck_require__(17)); 2040 | _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; 2041 | exports.IS_WINDOWS = process.platform === 'win32'; 2042 | function exists(fsPath) { 2043 | return __awaiter(this, void 0, void 0, function* () { 2044 | try { 2045 | yield exports.stat(fsPath); 2046 | } 2047 | catch (err) { 2048 | if (err.code === 'ENOENT') { 2049 | return false; 2050 | } 2051 | throw err; 2052 | } 2053 | return true; 2054 | }); 2055 | } 2056 | exports.exists = exists; 2057 | function isDirectory(fsPath, useStat = false) { 2058 | return __awaiter(this, void 0, void 0, function* () { 2059 | const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath); 2060 | return stats.isDirectory(); 2061 | }); 2062 | } 2063 | exports.isDirectory = isDirectory; 2064 | /** 2065 | * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like: 2066 | * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases). 2067 | */ 2068 | function isRooted(p) { 2069 | p = normalizeSeparators(p); 2070 | if (!p) { 2071 | throw new Error('isRooted() parameter "p" cannot be empty'); 2072 | } 2073 | if (exports.IS_WINDOWS) { 2074 | return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello 2075 | ); // e.g. C: or C:\hello 2076 | } 2077 | return p.startsWith('/'); 2078 | } 2079 | exports.isRooted = isRooted; 2080 | /** 2081 | * Best effort attempt to determine whether a file exists and is executable. 2082 | * @param filePath file path to check 2083 | * @param extensions additional file extensions to try 2084 | * @return if file exists and is executable, returns the file path. otherwise empty string. 2085 | */ 2086 | function tryGetExecutablePath(filePath, extensions) { 2087 | return __awaiter(this, void 0, void 0, function* () { 2088 | let stats = undefined; 2089 | try { 2090 | // test file exists 2091 | stats = yield exports.stat(filePath); 2092 | } 2093 | catch (err) { 2094 | if (err.code !== 'ENOENT') { 2095 | // eslint-disable-next-line no-console 2096 | console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); 2097 | } 2098 | } 2099 | if (stats && stats.isFile()) { 2100 | if (exports.IS_WINDOWS) { 2101 | // on Windows, test for valid extension 2102 | const upperExt = path.extname(filePath).toUpperCase(); 2103 | if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) { 2104 | return filePath; 2105 | } 2106 | } 2107 | else { 2108 | if (isUnixExecutable(stats)) { 2109 | return filePath; 2110 | } 2111 | } 2112 | } 2113 | // try each extension 2114 | const originalFilePath = filePath; 2115 | for (const extension of extensions) { 2116 | filePath = originalFilePath + extension; 2117 | stats = undefined; 2118 | try { 2119 | stats = yield exports.stat(filePath); 2120 | } 2121 | catch (err) { 2122 | if (err.code !== 'ENOENT') { 2123 | // eslint-disable-next-line no-console 2124 | console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); 2125 | } 2126 | } 2127 | if (stats && stats.isFile()) { 2128 | if (exports.IS_WINDOWS) { 2129 | // preserve the case of the actual file (since an extension was appended) 2130 | try { 2131 | const directory = path.dirname(filePath); 2132 | const upperName = path.basename(filePath).toUpperCase(); 2133 | for (const actualName of yield exports.readdir(directory)) { 2134 | if (upperName === actualName.toUpperCase()) { 2135 | filePath = path.join(directory, actualName); 2136 | break; 2137 | } 2138 | } 2139 | } 2140 | catch (err) { 2141 | // eslint-disable-next-line no-console 2142 | console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`); 2143 | } 2144 | return filePath; 2145 | } 2146 | else { 2147 | if (isUnixExecutable(stats)) { 2148 | return filePath; 2149 | } 2150 | } 2151 | } 2152 | } 2153 | return ''; 2154 | }); 2155 | } 2156 | exports.tryGetExecutablePath = tryGetExecutablePath; 2157 | function normalizeSeparators(p) { 2158 | p = p || ''; 2159 | if (exports.IS_WINDOWS) { 2160 | // convert slashes on Windows 2161 | p = p.replace(/\//g, '\\'); 2162 | // remove redundant slashes 2163 | return p.replace(/\\\\+/g, '\\'); 2164 | } 2165 | // remove redundant slashes 2166 | return p.replace(/\/\/+/g, '/'); 2167 | } 2168 | // on Mac/Linux, test the execute bit 2169 | // R W X R W X R W X 2170 | // 256 128 64 32 16 8 4 2 1 2171 | function isUnixExecutable(stats) { 2172 | return ((stats.mode & 1) > 0 || 2173 | ((stats.mode & 8) > 0 && stats.gid === process.getgid()) || 2174 | ((stats.mode & 64) > 0 && stats.uid === process.getuid())); 2175 | } 2176 | // Get the path of cmd.exe in windows 2177 | function getCmdPath() { 2178 | var _a; 2179 | return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`; 2180 | } 2181 | exports.getCmdPath = getCmdPath; 2182 | //# sourceMappingURL=io-util.js.map 2183 | 2184 | /***/ }), 2185 | 2186 | /***/ 436: 2187 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 2188 | 2189 | 2190 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 2191 | if (k2 === undefined) k2 = k; 2192 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 2193 | }) : (function(o, m, k, k2) { 2194 | if (k2 === undefined) k2 = k; 2195 | o[k2] = m[k]; 2196 | })); 2197 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 2198 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 2199 | }) : function(o, v) { 2200 | o["default"] = v; 2201 | }); 2202 | var __importStar = (this && this.__importStar) || function (mod) { 2203 | if (mod && mod.__esModule) return mod; 2204 | var result = {}; 2205 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 2206 | __setModuleDefault(result, mod); 2207 | return result; 2208 | }; 2209 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2210 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 2211 | return new (P || (P = Promise))(function (resolve, reject) { 2212 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 2213 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 2214 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 2215 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 2216 | }); 2217 | }; 2218 | Object.defineProperty(exports, "__esModule", ({ value: true })); 2219 | exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0; 2220 | const assert_1 = __nccwpck_require__(491); 2221 | const childProcess = __importStar(__nccwpck_require__(81)); 2222 | const path = __importStar(__nccwpck_require__(17)); 2223 | const util_1 = __nccwpck_require__(837); 2224 | const ioUtil = __importStar(__nccwpck_require__(962)); 2225 | const exec = util_1.promisify(childProcess.exec); 2226 | const execFile = util_1.promisify(childProcess.execFile); 2227 | /** 2228 | * Copies a file or folder. 2229 | * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js 2230 | * 2231 | * @param source source path 2232 | * @param dest destination path 2233 | * @param options optional. See CopyOptions. 2234 | */ 2235 | function cp(source, dest, options = {}) { 2236 | return __awaiter(this, void 0, void 0, function* () { 2237 | const { force, recursive, copySourceDirectory } = readCopyOptions(options); 2238 | const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null; 2239 | // Dest is an existing file, but not forcing 2240 | if (destStat && destStat.isFile() && !force) { 2241 | return; 2242 | } 2243 | // If dest is an existing directory, should copy inside. 2244 | const newDest = destStat && destStat.isDirectory() && copySourceDirectory 2245 | ? path.join(dest, path.basename(source)) 2246 | : dest; 2247 | if (!(yield ioUtil.exists(source))) { 2248 | throw new Error(`no such file or directory: ${source}`); 2249 | } 2250 | const sourceStat = yield ioUtil.stat(source); 2251 | if (sourceStat.isDirectory()) { 2252 | if (!recursive) { 2253 | throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`); 2254 | } 2255 | else { 2256 | yield cpDirRecursive(source, newDest, 0, force); 2257 | } 2258 | } 2259 | else { 2260 | if (path.relative(source, newDest) === '') { 2261 | // a file cannot be copied to itself 2262 | throw new Error(`'${newDest}' and '${source}' are the same file`); 2263 | } 2264 | yield copyFile(source, newDest, force); 2265 | } 2266 | }); 2267 | } 2268 | exports.cp = cp; 2269 | /** 2270 | * Moves a path. 2271 | * 2272 | * @param source source path 2273 | * @param dest destination path 2274 | * @param options optional. See MoveOptions. 2275 | */ 2276 | function mv(source, dest, options = {}) { 2277 | return __awaiter(this, void 0, void 0, function* () { 2278 | if (yield ioUtil.exists(dest)) { 2279 | let destExists = true; 2280 | if (yield ioUtil.isDirectory(dest)) { 2281 | // If dest is directory copy src into dest 2282 | dest = path.join(dest, path.basename(source)); 2283 | destExists = yield ioUtil.exists(dest); 2284 | } 2285 | if (destExists) { 2286 | if (options.force == null || options.force) { 2287 | yield rmRF(dest); 2288 | } 2289 | else { 2290 | throw new Error('Destination already exists'); 2291 | } 2292 | } 2293 | } 2294 | yield mkdirP(path.dirname(dest)); 2295 | yield ioUtil.rename(source, dest); 2296 | }); 2297 | } 2298 | exports.mv = mv; 2299 | /** 2300 | * Remove a path recursively with force 2301 | * 2302 | * @param inputPath path to remove 2303 | */ 2304 | function rmRF(inputPath) { 2305 | return __awaiter(this, void 0, void 0, function* () { 2306 | if (ioUtil.IS_WINDOWS) { 2307 | // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another 2308 | // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del. 2309 | // Check for invalid characters 2310 | // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file 2311 | if (/[*"<>|]/.test(inputPath)) { 2312 | throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows'); 2313 | } 2314 | try { 2315 | const cmdPath = ioUtil.getCmdPath(); 2316 | if (yield ioUtil.isDirectory(inputPath, true)) { 2317 | yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, { 2318 | env: { inputPath } 2319 | }); 2320 | } 2321 | else { 2322 | yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, { 2323 | env: { inputPath } 2324 | }); 2325 | } 2326 | } 2327 | catch (err) { 2328 | // if you try to delete a file that doesn't exist, desired result is achieved 2329 | // other errors are valid 2330 | if (err.code !== 'ENOENT') 2331 | throw err; 2332 | } 2333 | // Shelling out fails to remove a symlink folder with missing source, this unlink catches that 2334 | try { 2335 | yield ioUtil.unlink(inputPath); 2336 | } 2337 | catch (err) { 2338 | // if you try to delete a file that doesn't exist, desired result is achieved 2339 | // other errors are valid 2340 | if (err.code !== 'ENOENT') 2341 | throw err; 2342 | } 2343 | } 2344 | else { 2345 | let isDir = false; 2346 | try { 2347 | isDir = yield ioUtil.isDirectory(inputPath); 2348 | } 2349 | catch (err) { 2350 | // if you try to delete a file that doesn't exist, desired result is achieved 2351 | // other errors are valid 2352 | if (err.code !== 'ENOENT') 2353 | throw err; 2354 | return; 2355 | } 2356 | if (isDir) { 2357 | yield execFile(`rm`, [`-rf`, `${inputPath}`]); 2358 | } 2359 | else { 2360 | yield ioUtil.unlink(inputPath); 2361 | } 2362 | } 2363 | }); 2364 | } 2365 | exports.rmRF = rmRF; 2366 | /** 2367 | * Make a directory. Creates the full path with folders in between 2368 | * Will throw if it fails 2369 | * 2370 | * @param fsPath path to create 2371 | * @returns Promise 2372 | */ 2373 | function mkdirP(fsPath) { 2374 | return __awaiter(this, void 0, void 0, function* () { 2375 | assert_1.ok(fsPath, 'a path argument must be provided'); 2376 | yield ioUtil.mkdir(fsPath, { recursive: true }); 2377 | }); 2378 | } 2379 | exports.mkdirP = mkdirP; 2380 | /** 2381 | * Returns path of a tool had the tool actually been invoked. Resolves via paths. 2382 | * If you check and the tool does not exist, it will throw. 2383 | * 2384 | * @param tool name of the tool 2385 | * @param check whether to check if tool exists 2386 | * @returns Promise path to tool 2387 | */ 2388 | function which(tool, check) { 2389 | return __awaiter(this, void 0, void 0, function* () { 2390 | if (!tool) { 2391 | throw new Error("parameter 'tool' is required"); 2392 | } 2393 | // recursive when check=true 2394 | if (check) { 2395 | const result = yield which(tool, false); 2396 | if (!result) { 2397 | if (ioUtil.IS_WINDOWS) { 2398 | 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.`); 2399 | } 2400 | else { 2401 | 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.`); 2402 | } 2403 | } 2404 | return result; 2405 | } 2406 | const matches = yield findInPath(tool); 2407 | if (matches && matches.length > 0) { 2408 | return matches[0]; 2409 | } 2410 | return ''; 2411 | }); 2412 | } 2413 | exports.which = which; 2414 | /** 2415 | * Returns a list of all occurrences of the given tool on the system path. 2416 | * 2417 | * @returns Promise the paths of the tool 2418 | */ 2419 | function findInPath(tool) { 2420 | return __awaiter(this, void 0, void 0, function* () { 2421 | if (!tool) { 2422 | throw new Error("parameter 'tool' is required"); 2423 | } 2424 | // build the list of extensions to try 2425 | const extensions = []; 2426 | if (ioUtil.IS_WINDOWS && process.env['PATHEXT']) { 2427 | for (const extension of process.env['PATHEXT'].split(path.delimiter)) { 2428 | if (extension) { 2429 | extensions.push(extension); 2430 | } 2431 | } 2432 | } 2433 | // if it's rooted, return it if exists. otherwise return empty. 2434 | if (ioUtil.isRooted(tool)) { 2435 | const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); 2436 | if (filePath) { 2437 | return [filePath]; 2438 | } 2439 | return []; 2440 | } 2441 | // if any path separators, return empty 2442 | if (tool.includes(path.sep)) { 2443 | return []; 2444 | } 2445 | // build the list of directories 2446 | // 2447 | // Note, technically "where" checks the current directory on Windows. From a toolkit perspective, 2448 | // it feels like we should not do this. Checking the current directory seems like more of a use 2449 | // case of a shell, and the which() function exposed by the toolkit should strive for consistency 2450 | // across platforms. 2451 | const directories = []; 2452 | if (process.env.PATH) { 2453 | for (const p of process.env.PATH.split(path.delimiter)) { 2454 | if (p) { 2455 | directories.push(p); 2456 | } 2457 | } 2458 | } 2459 | // find all matches 2460 | const matches = []; 2461 | for (const directory of directories) { 2462 | const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions); 2463 | if (filePath) { 2464 | matches.push(filePath); 2465 | } 2466 | } 2467 | return matches; 2468 | }); 2469 | } 2470 | exports.findInPath = findInPath; 2471 | function readCopyOptions(options) { 2472 | const force = options.force == null ? true : options.force; 2473 | const recursive = Boolean(options.recursive); 2474 | const copySourceDirectory = options.copySourceDirectory == null 2475 | ? true 2476 | : Boolean(options.copySourceDirectory); 2477 | return { force, recursive, copySourceDirectory }; 2478 | } 2479 | function cpDirRecursive(sourceDir, destDir, currentDepth, force) { 2480 | return __awaiter(this, void 0, void 0, function* () { 2481 | // Ensure there is not a run away recursive copy 2482 | if (currentDepth >= 255) 2483 | return; 2484 | currentDepth++; 2485 | yield mkdirP(destDir); 2486 | const files = yield ioUtil.readdir(sourceDir); 2487 | for (const fileName of files) { 2488 | const srcFile = `${sourceDir}/${fileName}`; 2489 | const destFile = `${destDir}/${fileName}`; 2490 | const srcFileStat = yield ioUtil.lstat(srcFile); 2491 | if (srcFileStat.isDirectory()) { 2492 | // Recurse 2493 | yield cpDirRecursive(srcFile, destFile, currentDepth, force); 2494 | } 2495 | else { 2496 | yield copyFile(srcFile, destFile, force); 2497 | } 2498 | } 2499 | // Change the mode for the newly created directory 2500 | yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode); 2501 | }); 2502 | } 2503 | // Buffered file copy 2504 | function copyFile(srcFile, destFile, force) { 2505 | return __awaiter(this, void 0, void 0, function* () { 2506 | if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) { 2507 | // unlink/re-link it 2508 | try { 2509 | yield ioUtil.lstat(destFile); 2510 | yield ioUtil.unlink(destFile); 2511 | } 2512 | catch (e) { 2513 | // Try to override file permission 2514 | if (e.code === 'EPERM') { 2515 | yield ioUtil.chmod(destFile, '0666'); 2516 | yield ioUtil.unlink(destFile); 2517 | } 2518 | // other errors = it doesn't exist, no work to do 2519 | } 2520 | // Copy over symlink 2521 | const symlinkFull = yield ioUtil.readlink(srcFile); 2522 | yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null); 2523 | } 2524 | else if (!(yield ioUtil.exists(destFile)) || force) { 2525 | yield ioUtil.copyFile(srcFile, destFile); 2526 | } 2527 | }); 2528 | } 2529 | //# sourceMappingURL=io.js.map 2530 | 2531 | /***/ }), 2532 | 2533 | /***/ 294: 2534 | /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { 2535 | 2536 | module.exports = __nccwpck_require__(219); 2537 | 2538 | 2539 | /***/ }), 2540 | 2541 | /***/ 219: 2542 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2543 | 2544 | 2545 | 2546 | var net = __nccwpck_require__(808); 2547 | var tls = __nccwpck_require__(404); 2548 | var http = __nccwpck_require__(685); 2549 | var https = __nccwpck_require__(687); 2550 | var events = __nccwpck_require__(361); 2551 | var assert = __nccwpck_require__(491); 2552 | var util = __nccwpck_require__(837); 2553 | 2554 | 2555 | exports.httpOverHttp = httpOverHttp; 2556 | exports.httpsOverHttp = httpsOverHttp; 2557 | exports.httpOverHttps = httpOverHttps; 2558 | exports.httpsOverHttps = httpsOverHttps; 2559 | 2560 | 2561 | function httpOverHttp(options) { 2562 | var agent = new TunnelingAgent(options); 2563 | agent.request = http.request; 2564 | return agent; 2565 | } 2566 | 2567 | function httpsOverHttp(options) { 2568 | var agent = new TunnelingAgent(options); 2569 | agent.request = http.request; 2570 | agent.createSocket = createSecureSocket; 2571 | agent.defaultPort = 443; 2572 | return agent; 2573 | } 2574 | 2575 | function httpOverHttps(options) { 2576 | var agent = new TunnelingAgent(options); 2577 | agent.request = https.request; 2578 | return agent; 2579 | } 2580 | 2581 | function httpsOverHttps(options) { 2582 | var agent = new TunnelingAgent(options); 2583 | agent.request = https.request; 2584 | agent.createSocket = createSecureSocket; 2585 | agent.defaultPort = 443; 2586 | return agent; 2587 | } 2588 | 2589 | 2590 | function TunnelingAgent(options) { 2591 | var self = this; 2592 | self.options = options || {}; 2593 | self.proxyOptions = self.options.proxy || {}; 2594 | self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; 2595 | self.requests = []; 2596 | self.sockets = []; 2597 | 2598 | self.on('free', function onFree(socket, host, port, localAddress) { 2599 | var options = toOptions(host, port, localAddress); 2600 | for (var i = 0, len = self.requests.length; i < len; ++i) { 2601 | var pending = self.requests[i]; 2602 | if (pending.host === options.host && pending.port === options.port) { 2603 | // Detect the request to connect same origin server, 2604 | // reuse the connection. 2605 | self.requests.splice(i, 1); 2606 | pending.request.onSocket(socket); 2607 | return; 2608 | } 2609 | } 2610 | socket.destroy(); 2611 | self.removeSocket(socket); 2612 | }); 2613 | } 2614 | util.inherits(TunnelingAgent, events.EventEmitter); 2615 | 2616 | TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { 2617 | var self = this; 2618 | var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); 2619 | 2620 | if (self.sockets.length >= this.maxSockets) { 2621 | // We are over limit so we'll add it to the queue. 2622 | self.requests.push(options); 2623 | return; 2624 | } 2625 | 2626 | // If we are under maxSockets create a new one. 2627 | self.createSocket(options, function(socket) { 2628 | socket.on('free', onFree); 2629 | socket.on('close', onCloseOrRemove); 2630 | socket.on('agentRemove', onCloseOrRemove); 2631 | req.onSocket(socket); 2632 | 2633 | function onFree() { 2634 | self.emit('free', socket, options); 2635 | } 2636 | 2637 | function onCloseOrRemove(err) { 2638 | self.removeSocket(socket); 2639 | socket.removeListener('free', onFree); 2640 | socket.removeListener('close', onCloseOrRemove); 2641 | socket.removeListener('agentRemove', onCloseOrRemove); 2642 | } 2643 | }); 2644 | }; 2645 | 2646 | TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { 2647 | var self = this; 2648 | var placeholder = {}; 2649 | self.sockets.push(placeholder); 2650 | 2651 | var connectOptions = mergeOptions({}, self.proxyOptions, { 2652 | method: 'CONNECT', 2653 | path: options.host + ':' + options.port, 2654 | agent: false, 2655 | headers: { 2656 | host: options.host + ':' + options.port 2657 | } 2658 | }); 2659 | if (options.localAddress) { 2660 | connectOptions.localAddress = options.localAddress; 2661 | } 2662 | if (connectOptions.proxyAuth) { 2663 | connectOptions.headers = connectOptions.headers || {}; 2664 | connectOptions.headers['Proxy-Authorization'] = 'Basic ' + 2665 | new Buffer(connectOptions.proxyAuth).toString('base64'); 2666 | } 2667 | 2668 | debug('making CONNECT request'); 2669 | var connectReq = self.request(connectOptions); 2670 | connectReq.useChunkedEncodingByDefault = false; // for v0.6 2671 | connectReq.once('response', onResponse); // for v0.6 2672 | connectReq.once('upgrade', onUpgrade); // for v0.6 2673 | connectReq.once('connect', onConnect); // for v0.7 or later 2674 | connectReq.once('error', onError); 2675 | connectReq.end(); 2676 | 2677 | function onResponse(res) { 2678 | // Very hacky. This is necessary to avoid http-parser leaks. 2679 | res.upgrade = true; 2680 | } 2681 | 2682 | function onUpgrade(res, socket, head) { 2683 | // Hacky. 2684 | process.nextTick(function() { 2685 | onConnect(res, socket, head); 2686 | }); 2687 | } 2688 | 2689 | function onConnect(res, socket, head) { 2690 | connectReq.removeAllListeners(); 2691 | socket.removeAllListeners(); 2692 | 2693 | if (res.statusCode !== 200) { 2694 | debug('tunneling socket could not be established, statusCode=%d', 2695 | res.statusCode); 2696 | socket.destroy(); 2697 | var error = new Error('tunneling socket could not be established, ' + 2698 | 'statusCode=' + res.statusCode); 2699 | error.code = 'ECONNRESET'; 2700 | options.request.emit('error', error); 2701 | self.removeSocket(placeholder); 2702 | return; 2703 | } 2704 | if (head.length > 0) { 2705 | debug('got illegal response body from proxy'); 2706 | socket.destroy(); 2707 | var error = new Error('got illegal response body from proxy'); 2708 | error.code = 'ECONNRESET'; 2709 | options.request.emit('error', error); 2710 | self.removeSocket(placeholder); 2711 | return; 2712 | } 2713 | debug('tunneling connection has established'); 2714 | self.sockets[self.sockets.indexOf(placeholder)] = socket; 2715 | return cb(socket); 2716 | } 2717 | 2718 | function onError(cause) { 2719 | connectReq.removeAllListeners(); 2720 | 2721 | debug('tunneling socket could not be established, cause=%s\n', 2722 | cause.message, cause.stack); 2723 | var error = new Error('tunneling socket could not be established, ' + 2724 | 'cause=' + cause.message); 2725 | error.code = 'ECONNRESET'; 2726 | options.request.emit('error', error); 2727 | self.removeSocket(placeholder); 2728 | } 2729 | }; 2730 | 2731 | TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { 2732 | var pos = this.sockets.indexOf(socket) 2733 | if (pos === -1) { 2734 | return; 2735 | } 2736 | this.sockets.splice(pos, 1); 2737 | 2738 | var pending = this.requests.shift(); 2739 | if (pending) { 2740 | // If we have pending requests and a socket gets closed a new one 2741 | // needs to be created to take over in the pool for the one that closed. 2742 | this.createSocket(pending, function(socket) { 2743 | pending.request.onSocket(socket); 2744 | }); 2745 | } 2746 | }; 2747 | 2748 | function createSecureSocket(options, cb) { 2749 | var self = this; 2750 | TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { 2751 | var hostHeader = options.request.getHeader('host'); 2752 | var tlsOptions = mergeOptions({}, self.options, { 2753 | socket: socket, 2754 | servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host 2755 | }); 2756 | 2757 | // 0 is dummy port for v0.6 2758 | var secureSocket = tls.connect(0, tlsOptions); 2759 | self.sockets[self.sockets.indexOf(socket)] = secureSocket; 2760 | cb(secureSocket); 2761 | }); 2762 | } 2763 | 2764 | 2765 | function toOptions(host, port, localAddress) { 2766 | if (typeof host === 'string') { // since v0.10 2767 | return { 2768 | host: host, 2769 | port: port, 2770 | localAddress: localAddress 2771 | }; 2772 | } 2773 | return host; // for v0.11 or later 2774 | } 2775 | 2776 | function mergeOptions(target) { 2777 | for (var i = 1, len = arguments.length; i < len; ++i) { 2778 | var overrides = arguments[i]; 2779 | if (typeof overrides === 'object') { 2780 | var keys = Object.keys(overrides); 2781 | for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { 2782 | var k = keys[j]; 2783 | if (overrides[k] !== undefined) { 2784 | target[k] = overrides[k]; 2785 | } 2786 | } 2787 | } 2788 | } 2789 | return target; 2790 | } 2791 | 2792 | 2793 | var debug; 2794 | if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { 2795 | debug = function() { 2796 | var args = Array.prototype.slice.call(arguments); 2797 | if (typeof args[0] === 'string') { 2798 | args[0] = 'TUNNEL: ' + args[0]; 2799 | } else { 2800 | args.unshift('TUNNEL:'); 2801 | } 2802 | console.error.apply(console, args); 2803 | } 2804 | } else { 2805 | debug = function() {}; 2806 | } 2807 | exports.debug = debug; // for test 2808 | 2809 | 2810 | /***/ }), 2811 | 2812 | /***/ 491: 2813 | /***/ ((module) => { 2814 | 2815 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("assert"); 2816 | 2817 | /***/ }), 2818 | 2819 | /***/ 81: 2820 | /***/ ((module) => { 2821 | 2822 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("child_process"); 2823 | 2824 | /***/ }), 2825 | 2826 | /***/ 361: 2827 | /***/ ((module) => { 2828 | 2829 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("events"); 2830 | 2831 | /***/ }), 2832 | 2833 | /***/ 147: 2834 | /***/ ((module) => { 2835 | 2836 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("fs"); 2837 | 2838 | /***/ }), 2839 | 2840 | /***/ 685: 2841 | /***/ ((module) => { 2842 | 2843 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("http"); 2844 | 2845 | /***/ }), 2846 | 2847 | /***/ 687: 2848 | /***/ ((module) => { 2849 | 2850 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("https"); 2851 | 2852 | /***/ }), 2853 | 2854 | /***/ 808: 2855 | /***/ ((module) => { 2856 | 2857 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("net"); 2858 | 2859 | /***/ }), 2860 | 2861 | /***/ 37: 2862 | /***/ ((module) => { 2863 | 2864 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("os"); 2865 | 2866 | /***/ }), 2867 | 2868 | /***/ 17: 2869 | /***/ ((module) => { 2870 | 2871 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("path"); 2872 | 2873 | /***/ }), 2874 | 2875 | /***/ 576: 2876 | /***/ ((module) => { 2877 | 2878 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("string_decoder"); 2879 | 2880 | /***/ }), 2881 | 2882 | /***/ 512: 2883 | /***/ ((module) => { 2884 | 2885 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("timers"); 2886 | 2887 | /***/ }), 2888 | 2889 | /***/ 404: 2890 | /***/ ((module) => { 2891 | 2892 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("tls"); 2893 | 2894 | /***/ }), 2895 | 2896 | /***/ 837: 2897 | /***/ ((module) => { 2898 | 2899 | module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("util"); 2900 | 2901 | /***/ }) 2902 | 2903 | /******/ }); 2904 | /************************************************************************/ 2905 | /******/ // The module cache 2906 | /******/ var __webpack_module_cache__ = {}; 2907 | /******/ 2908 | /******/ // The require function 2909 | /******/ function __nccwpck_require__(moduleId) { 2910 | /******/ // Check if module is in cache 2911 | /******/ var cachedModule = __webpack_module_cache__[moduleId]; 2912 | /******/ if (cachedModule !== undefined) { 2913 | /******/ return cachedModule.exports; 2914 | /******/ } 2915 | /******/ // Create a new module (and put it into the cache) 2916 | /******/ var module = __webpack_module_cache__[moduleId] = { 2917 | /******/ // no module.id needed 2918 | /******/ // no module.loaded needed 2919 | /******/ exports: {} 2920 | /******/ }; 2921 | /******/ 2922 | /******/ // Execute the module function 2923 | /******/ var threw = true; 2924 | /******/ try { 2925 | /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__); 2926 | /******/ threw = false; 2927 | /******/ } finally { 2928 | /******/ if(threw) delete __webpack_module_cache__[moduleId]; 2929 | /******/ } 2930 | /******/ 2931 | /******/ // Return the exports of the module 2932 | /******/ return module.exports; 2933 | /******/ } 2934 | /******/ 2935 | /************************************************************************/ 2936 | /******/ /* webpack/runtime/compat get default export */ 2937 | /******/ (() => { 2938 | /******/ // getDefaultExport function for compatibility with non-harmony modules 2939 | /******/ __nccwpck_require__.n = (module) => { 2940 | /******/ var getter = module && module.__esModule ? 2941 | /******/ () => (module['default']) : 2942 | /******/ () => (module); 2943 | /******/ __nccwpck_require__.d(getter, { a: getter }); 2944 | /******/ return getter; 2945 | /******/ }; 2946 | /******/ })(); 2947 | /******/ 2948 | /******/ /* webpack/runtime/define property getters */ 2949 | /******/ (() => { 2950 | /******/ // define getter functions for harmony exports 2951 | /******/ __nccwpck_require__.d = (exports, definition) => { 2952 | /******/ for(var key in definition) { 2953 | /******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { 2954 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 2955 | /******/ } 2956 | /******/ } 2957 | /******/ }; 2958 | /******/ })(); 2959 | /******/ 2960 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ 2961 | /******/ (() => { 2962 | /******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 2963 | /******/ })(); 2964 | /******/ 2965 | /******/ /* webpack/runtime/compat */ 2966 | /******/ 2967 | /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1) + "/"; 2968 | /******/ 2969 | /************************************************************************/ 2970 | var __webpack_exports__ = {}; 2971 | // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 2972 | (() => { 2973 | /* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(186); 2974 | /* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(_actions_core__WEBPACK_IMPORTED_MODULE_0__); 2975 | /* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(514); 2976 | /* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nccwpck_require__.n(_actions_exec__WEBPACK_IMPORTED_MODULE_1__); 2977 | var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { 2978 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 2979 | return new (P || (P = Promise))(function (resolve, reject) { 2980 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 2981 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 2982 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 2983 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 2984 | }); 2985 | }; 2986 | 2987 | 2988 | function run() { 2989 | return __awaiter(this, void 0, void 0, function* () { 2990 | const port = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput('port'); 2991 | let runArguments = [ 2992 | "run", "-d", "-p", `${port}:12321`, 2993 | "--name", "cache_proxy", 2994 | "--env", "ACTIONS_CACHE_URL", 2995 | "--env", "ACTIONS_RUNTIME_URL", 2996 | "--env", "ACTIONS_RUNTIME_TOKEN", 2997 | "ghcr.io/cirruslabs/actions-http-cache-proxy:latest" 2998 | ]; 2999 | try { 3000 | yield (0,_actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec)(`"docker"`, runArguments); 3001 | } 3002 | catch (e) { 3003 | _actions_core__WEBPACK_IMPORTED_MODULE_0__.error(e); 3004 | } 3005 | }); 3006 | } 3007 | run(); 3008 | 3009 | })(); 3010 | 3011 | --------------------------------------------------------------------------------