├── .gitignore ├── Gemfile ├── fastlane ├── Pluginfile ├── Matchfile └── Fastfile ├── package.json ├── CHANGELOG.md ├── LICENSE ├── index.js ├── action.yml ├── README.md ├── yarn.lock └── dist └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | yarn-error.log 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') 4 | eval(File.read(plugins_path), binding) if File.exist?(plugins_path) 5 | -------------------------------------------------------------------------------- /fastlane/Pluginfile: -------------------------------------------------------------------------------- 1 | # Autogenerated by fastlane 2 | # 3 | # Ensure this file is checked in to source control! 4 | 5 | gem 'fastlane-plugin-increment_version_code' 6 | gem 'fastlane-plugin-browserstack' -------------------------------------------------------------------------------- /fastlane/Matchfile: -------------------------------------------------------------------------------- 1 | git_url(ENV["MATCH_GIT_URL"]) 2 | 3 | storage_mode("git") 4 | 5 | type(ENV["MATCH_BUILD_TYPE"]) # The default type, can be: appstore, adhoc, enterprise or development 6 | 7 | app_identifier(ENV["IOS_APP_ID"]) if ENV["IOS_APP_ID"] 8 | 9 | keychain_name('ios-build.keychain') 10 | keychain_password('12345678') 11 | 12 | team_id(ENV["TEAM_ID"]) 13 | 14 | # For all available options run `fastlane match --help` 15 | # Remove the # in the beginning of the line to enable the other options 16 | 17 | # The docs are available on https://docs.fastlane.tools/actions/match 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "spark-ios-build-action", 3 | "version": "2.3.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "bundle": "ncc build index.js", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "Edoardo Dusi (https://github.com/sparkfabrik)", 12 | "license": "MIT", 13 | "dependencies": { 14 | "@actions/core": "1.9.1", 15 | "@actions/exec": "1.1.1", 16 | "@actions/github": "5.0.3" 17 | }, 18 | "devDependencies": { 19 | "@vercel/ncc": "0.34.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [2.3.0] - 2023-26-05 4 | 5 | ### Added 6 | 7 | `fastlane-version` input. 8 | 9 | ### Changed 10 | 11 | Fastlane is always installed via `bundler`. 12 | 13 | ## [2.2.0] - 2023-21-02 14 | 15 | ### Changed 16 | 17 | Remove `include_bitcode` parameter (now deprecated). 18 | 19 | ## [2.1.0] - 2023-30-01 20 | 21 | ### Added 22 | 23 | - `fastlane-env` (optional) input: Name of the env file name to pass to fastlane --env 24 | - `ios-app-id` (optional) input: The iOS application identifier; useful to sync a specific provisioning profile 25 | 26 | ## [2.0.0] - 2022-10-06 27 | 28 | Redesign of the Fastlane build and certificate handling. 29 | 30 | ### Breaking 31 | 32 | - This version uses `Match` so you cannot use base64 version of the certificates, instead you need to have a GitHub repo that match will use to store the certificates and an Apple app key. Follow the README to see the new parameters list. 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 SparkFabrik 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 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const core = require("@actions/core"); 2 | const exec = require("@actions/exec"); 3 | 4 | async function run() { 5 | try { 6 | if ( 7 | core.getInput("browserstack-upload").toLowerCase() === "true" && 8 | (!core.getInput("browserstack-username") || !core.getInput("browserstack-access-key")) 9 | ) { 10 | throw new Error("Browserstack username or access key missing."); 11 | } 12 | process.env.INCREMENT_BUILD_NUMBER = core.getInput("increment-build-number"); 13 | process.env.TESTFLIGHT_UPLOAD = core.getInput("upload-to-testflight"); 14 | process.env.PROJECT_PATH = core.getInput("project-path"); 15 | process.env.TEAM_ID = core.getInput("team-id"); 16 | process.env.TEAM_NAME = core.getInput("team-name"); 17 | process.env.WORKSPACE_PATH = core.getInput("workspace-path"); 18 | process.env.EXPORT_METHOD = core.getInput("export-method"); 19 | process.env.CONFIGURATION = core.getInput("configuration"); 20 | process.env.OUTPUT_PATH = core.getInput("output-path"); 21 | process.env.SCHEME = core.getInput("scheme"); 22 | process.env.BROWSERSTACK_UPLOAD = core.getInput("browserstack-upload"); 23 | process.env.BROWSERSTACK_USERNAME = core.getInput("browserstack-username"); 24 | process.env.BROWSERSTACK_ACCESS_KEY = core.getInput("browserstack-access-key"); 25 | process.env.BUILD_PODS = core.getInput("build-pods"); 26 | process.env.PODS_PATH = core.getInput("pods-path"); 27 | process.env.MATCH_PASSWORD = core.getInput("match-password"); 28 | process.env.MATCH_GIT_URL = core.getInput("match-git-url"); 29 | process.env.MATCH_GIT_BASIC_AUTHORIZATION = core.getInput("match-git-basic-authorization"); 30 | process.env.MATCH_BUILD_TYPE = core.getInput("match-build-type"); 31 | process.env.APPLE_KEY_ID = core.getInput("apple-key-id"); 32 | process.env.APPLE_KEY_ISSUER_ID = core.getInput("apple-key-issuer-id"); 33 | process.env.APPLE_KEY_CONTENT = core.getInput("apple-key-content"); 34 | process.env.FASTLANE_VERSION = core.getInput("fastlane-version"); 35 | process.env.FASTLANE_ENV = core.getInput("fastlane-env"); 36 | process.env.IOS_APP_ID = core.getInput("ios-app-id"); 37 | await exec.exec(`bash ${__dirname}/../build.sh`); 38 | } catch (error) { 39 | core.setFailed(error.message); 40 | } 41 | } 42 | 43 | run(); 44 | -------------------------------------------------------------------------------- /fastlane/Fastfile: -------------------------------------------------------------------------------- 1 | default_platform(:ios) 2 | 3 | platform :ios do 4 | before_all do 5 | keychain_password = '12345678' 6 | 7 | create_keychain( 8 | name: "ios-build.keychain", 9 | password: keychain_password, 10 | default_keychain: true, 11 | unlock: true, 12 | timeout: 3600 13 | ) 14 | 15 | if ENV["BUILD_PODS"] == 'true' 16 | cocoapods( 17 | podfile: ENV["PODS_PATH"], 18 | use_bundle_exec: false 19 | ) 20 | end 21 | end 22 | 23 | desc "Build" 24 | lane :build do 25 | api_key = app_store_connect_api_key( 26 | key_id: ENV['APPLE_KEY_ID'], 27 | issuer_id: ENV['APPLE_KEY_ISSUER_ID'], 28 | key_content: ENV['APPLE_KEY_CONTENT'], 29 | in_house: false # optional but may be required if using match/sigh 30 | ) 31 | 32 | use_workspace = !ENV['WORKSPACE_PATH'].empty? 33 | match(type: ENV['MATCH_BUILD_TYPE'], api_key: api_key) 34 | 35 | if ENV['INCREMENT_BUILD_NUMBER'] == 'true' 36 | increment_build_number( 37 | xcodeproj: ENV['PROJECT_PATH'], 38 | build_number: (latest_testflight_build_number( 39 | app_identifier: ENV["IOS_APP_ID"], 40 | api_key: api_key, 41 | team_name: ENV["TEAM_NAME"], 42 | ) + 1).to_s, 43 | ) 44 | end 45 | 46 | build_app( 47 | workspace: use_workspace ? ENV['WORKSPACE_PATH'] : nil, 48 | project: !use_workspace ? ENV['PROJECT_PATH'] : nil, 49 | configuration: ENV['CONFIGURATION'], 50 | scheme: ENV['SCHEME'], 51 | output_directory: File.dirname(ENV['OUTPUT_PATH']), 52 | output_name: File.basename(ENV['OUTPUT_PATH']), 53 | clean: true, 54 | export_method: ENV['EXPORT_METHOD'], 55 | export_team_id: ENV['TEAM_ID'], 56 | silent: true, 57 | export_options: ENV['IOS_APP_ID'] != nil ? { 58 | provisioningProfiles: { 59 | "#{ENV['IOS_APP_ID']}" => "match AppStore #{ENV['IOS_APP_ID']}", 60 | }, 61 | } : nil 62 | ) 63 | 64 | if ENV["BROWSERSTACK_UPLOAD"] == 'true' 65 | upload_to_browserstack_app_live( 66 | browserstack_username: ENV["BROWSERSTACK_USERNAME"], 67 | browserstack_access_key: ENV["BROWSERSTACK_ACCESS_KEY"], 68 | file_path: ENV["OUTPUT_PATH"] 69 | ) 70 | end 71 | 72 | if ENV["TESTFLIGHT_UPLOAD"] == 'true' 73 | upload_to_testflight( 74 | ipa: File.join(File.dirname(ENV['OUTPUT_PATH']), File.basename(ENV['OUTPUT_PATH'])), 75 | api_key: api_key, 76 | app_identifier: ENV['IOS_APP_ID'], 77 | team_name: ENV['TEAM_NAME'], 78 | skip_waiting_for_build_processing: true, 79 | skip_submission: true, 80 | ) 81 | end 82 | end 83 | 84 | after_all do 85 | delete_keychain( 86 | name: "ios-build.keychain" 87 | ) 88 | end 89 | end 90 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: "Build iOS Action" 2 | author: "SparkFabrik" 3 | branding: 4 | icon: "smartphone" 5 | color: "white" 6 | description: "Build iOS project (.xcodeproj, .xcworkspace), export .ipa, optional upload to BrowserStack App Live." 7 | inputs: 8 | upload-to-testflight: 9 | description: "Upload to TestFlight." 10 | required: false 11 | default: false 12 | increment-build-number: 13 | description: "Increment build number." 14 | required: false 15 | default: false 16 | project-path: 17 | description: "Project path" 18 | required: true 19 | team-id: 20 | description: "Team id" 21 | required: true 22 | team-name: 23 | description: "Team name" 24 | required: true 25 | apple-key-id: 26 | description: "Apple key id" 27 | required: true 28 | apple-key-issuer-id: 29 | description: "Apple key issuer id" 30 | required: true 31 | apple-key-content: 32 | description: "Apple key content" 33 | required: true 34 | workspace-path: 35 | description: "Workspace path" 36 | required: false 37 | default: "" 38 | export-method: 39 | description: "Choose app-store, ad-hoc, package, enterprise, development, or developer-id" 40 | required: false 41 | default: "app-store" 42 | configuration: 43 | description: "For example, Debug, Release" 44 | required: false 45 | default: "Release" 46 | output-path: 47 | description: "Output path of ipa" 48 | required: false 49 | default: "output.ipa" 50 | scheme: 51 | description: "Scheme" 52 | required: false 53 | default: "" 54 | update-targets: 55 | description: "Targets to be updated with mobileprovision, code signing identity, etc" 56 | required: false 57 | default: "" 58 | build-pods: 59 | description: "Boolean to tell if `pod install` should be run during build." 60 | required: false 61 | default: false 62 | pods-path: 63 | description: "The path to the Podfile." 64 | required: false 65 | default: "Podfile" 66 | match-password: 67 | description: "The password to decrypt certificates." 68 | required: true 69 | match-git-url: 70 | description: "The git url where match can find the certificates." 71 | required: true 72 | match-git-basic-authorization: 73 | description: "The basic authorization to access the repository." 74 | required: true 75 | match-build-type: 76 | description: "The build type to use when building the app." 77 | required: true 78 | browserstack-upload: 79 | description: "Boolean to tell the Action to upload the .ipa to Browserstack App Live after the build." 80 | required: false 81 | default: false 82 | browserstack-username: 83 | description: "Browserstack username (required if browserstack-upload == true)" 84 | required: false 85 | default: "" 86 | browserstack-access-key: 87 | description: "Browserstack access key (required if browserstack-upload == true)" 88 | required: false 89 | default: "" 90 | fastlane-version: 91 | description: "Specify the Fastlane version you wish to use" 92 | default: "2.213.0" 93 | required: false 94 | fastlane-env: 95 | description: "Name of the env file name to pass to fastlane --env" 96 | required: false 97 | default: "" 98 | ios-app-id: 99 | description: "The iOS application identifier; useful to sync a specific provisioning profile" 100 | required: false 101 | runs: 102 | using: "node16" 103 | main: "dist/index.js" 104 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Build iOS App 2 | 3 | This action builds your iOS project (`.xcodeproj`, `.xcworkspace`) and can export the resulting `.ipa` file as GitHub artifact, with optional automatic upload to BrowserStack AppLive, and optional signed production build with App Store upload. 4 | 5 | Tested with Ionic, React Native and native ios projects. 6 | 7 | ## WARNING v2 has breaking changes and it will break your Actions! 8 | 9 | To keep the old behavior please use the `v1` version. 10 | 11 | `v2.0.0` uses Match to simplify and strengthen the certificates management, and can optionally upload the build to the App Store. 12 | 13 | ## Inputs 14 | 15 | ### `project-path` 16 | 17 | **Required** .xcodeproj path. 18 | 19 | ### `workspace-path` 20 | 21 | .xcworkspace path. Default `""`. 22 | 23 | ### `export-method` 24 | 25 | Choose app-store, `"ad-hoc"`, `"package"` `"enterprise"`, `"development"`, or `"developer-id"`. Default `"app-store"`. 26 | 27 | ### `configuration` 28 | 29 | For example, `"Debug"`, `"Release"`. Default `"Release"`. 30 | 31 | ### `scheme` 32 | 33 | For example, `MyScheme`. 34 | 35 | ### `output-path` 36 | 37 | Output path of ipa. Default `"output.ipa"`. 38 | 39 | ### `team-id` 40 | 41 | **Required** Team id. 42 | 43 | ### `team-name` 44 | 45 | **Required** Team name. 46 | 47 | ### `build-pods` 48 | 49 | Run the `pod install` command during the build (boolean) 50 | 51 | ### `pods-path` 52 | 53 | The path to the Podfile. Default `"Podfile"` 54 | 55 | ### `upload-to-testflight` 56 | 57 | Upload the build to the App Store (boolean) 58 | 59 | ### `increment-build-number` 60 | 61 | Automatically increment the latest build number from TestFlight by one (boolean) 62 | 63 | ### `apple-key-id` 64 | 65 | The Apple Key ID. See https://docs.fastlane.tools/app-store-connect-api/ and https://docs.fastlane.tools/actions/app_store_connect_api_key/ for more examples. 66 | 67 | ### `apple-key-issuer-id` 68 | 69 | The Apple Key Issuer ID. See https://docs.fastlane.tools/app-store-connect-api/ and https://docs.fastlane.tools/actions/app_store_connect_api_key/ for more examples. 70 | 71 | ### `apple-key-content` 72 | 73 | The Apple Key content. See https://docs.fastlane.tools/app-store-connect-api/ and https://docs.fastlane.tools/actions/app_store_connect_api_key/ for more examples. 74 | 75 | ### `match-git-url` 76 | 77 | The GitHub repo URL for storing Match certificates. 78 | See https://docs.fastlane.tools/actions/match/ 79 | 80 | ### `match-git-basic-authorization` 81 | 82 | base64 key to the repo. 83 | Generate it with `echo -n your_github_username:your_personal_access_token | base64` 84 | 85 | ### `match-password` 86 | 87 | The password to decrypt the certificates. 88 | 89 | ### `match-build-type` 90 | 91 | The Match build type (eg. "development") 92 | 93 | ### `browserstack-upload` 94 | 95 | Set this to true to upload the resulting .ipa file to Browserstack App Live right after the build (https://www.browserstack.com/docs/app-live/integrations/fastlane) 96 | 97 | Defaut to false. 98 | 99 | ### `browserstack-username` 100 | 101 | Browserstack username (**required if** browserstack-upload == true) 102 | 103 | ### `browserstack-access-key` 104 | 105 | Browserstack access key (**required if** browserstack-upload == true) 106 | 107 | ### `fastlane-version` 108 | 109 | Fastlane version to be used. If not specified, the default value will be used. 110 | 111 | ### `fastlane-env` 112 | 113 | Name of the env file name to pass to `fastlane --env` 114 | 115 | ### `ios-app-id` 116 | 117 | The iOS application identifier; useful to sync a specific provisioning profile 118 | 119 | ## Contributions Welcome! 120 | 121 | If you have any other inputs you'd like to add, feel free to create PR. 122 | 123 | **NOTE:** Remember to run `yarn install` and `yarn bundle` if you make changes to the `index.js`. 124 | 125 | ## Example usage with a production build uploaded to App Store 126 | 127 | ```yaml 128 | - uses: sparkfabrik/ios-build-action@v2.3.0 129 | with: 130 | upload-to-testflight: true 131 | increment-build-number: true 132 | build-pods: true 133 | pods-path: "ios/Podfile" 134 | configuration: Release 135 | export-method: app-store 136 | workspace-path: ${{ secrets.WORKSPACE_PATH }} 137 | project-path: ${{ secrets.PROJECT_PATH }} 138 | scheme: MyScheme 139 | output-path: build-${{ github.sha }}.ipa 140 | apple-key-id: ${{ secrets.APPLE_KEY_ID }} 141 | apple-key-issuer-id: ${{ secrets.APPLE_KEY_ISSUER_ID }} 142 | apple-key-content: ${{ secrets.APPLE_KEY_CONTENT }} 143 | team-id: ${{ secrets.TEAM_ID }} 144 | team-name: ${{ secrets.TEAM_NAME }} 145 | match-password: ${{ secrets.MATCH_PASSWORD }} 146 | match-git-url: ${{ secrets.MATCH_GIT_URL }} 147 | match-git-basic-authorization: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }} 148 | match-build-type: "appstore" 149 | browserstack-upload: true 150 | browserstack-username: ${{ secrets.BROWSERSTACK_USERNAME }} 151 | browserstack-access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} 152 | fastlane-env: stage 153 | ios-app-id: com.identifier.my_app 154 | ``` 155 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@actions/core@1.9.1": 6 | version "1.9.1" 7 | resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.9.1.tgz#97c0201b1f9856df4f7c3a375cdcdb0c2a2f750b" 8 | integrity sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA== 9 | dependencies: 10 | "@actions/http-client" "^2.0.1" 11 | uuid "^8.3.2" 12 | 13 | "@actions/exec@1.1.1": 14 | version "1.1.1" 15 | resolved "https://registry.yarnpkg.com/@actions/exec/-/exec-1.1.1.tgz#2e43f28c54022537172819a7cf886c844221a611" 16 | integrity sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w== 17 | dependencies: 18 | "@actions/io" "^1.0.1" 19 | 20 | "@actions/github@5.0.3": 21 | version "5.0.3" 22 | resolved "https://registry.yarnpkg.com/@actions/github/-/github-5.0.3.tgz#b305765d6173962d113451ea324ff675aa674f35" 23 | integrity sha512-myjA/pdLQfhUGLtRZC/J4L1RXOG4o6aYdiEq+zr5wVVKljzbFld+xv10k1FX6IkIJtNxbAq44BdwSNpQ015P0A== 24 | dependencies: 25 | "@actions/http-client" "^2.0.1" 26 | "@octokit/core" "^3.6.0" 27 | "@octokit/plugin-paginate-rest" "^2.17.0" 28 | "@octokit/plugin-rest-endpoint-methods" "^5.13.0" 29 | 30 | "@actions/http-client@^2.0.1": 31 | version "2.0.1" 32 | resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-2.0.1.tgz#873f4ca98fe32f6839462a6f046332677322f99c" 33 | integrity sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw== 34 | dependencies: 35 | tunnel "^0.0.6" 36 | 37 | "@actions/io@^1.0.1": 38 | version "1.0.2" 39 | resolved "https://registry.yarnpkg.com/@actions/io/-/io-1.0.2.tgz#2f614b6e69ce14d191180451eb38e6576a6e6b27" 40 | integrity sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg== 41 | 42 | "@octokit/auth-token@^2.4.4": 43 | version "2.5.0" 44 | resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-2.5.0.tgz#27c37ea26c205f28443402477ffd261311f21e36" 45 | integrity sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g== 46 | dependencies: 47 | "@octokit/types" "^6.0.3" 48 | 49 | "@octokit/core@^3.6.0": 50 | version "3.6.0" 51 | resolved "https://registry.yarnpkg.com/@octokit/core/-/core-3.6.0.tgz#3376cb9f3008d9b3d110370d90e0a1fcd5fe6085" 52 | integrity sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q== 53 | dependencies: 54 | "@octokit/auth-token" "^2.4.4" 55 | "@octokit/graphql" "^4.5.8" 56 | "@octokit/request" "^5.6.3" 57 | "@octokit/request-error" "^2.0.5" 58 | "@octokit/types" "^6.0.3" 59 | before-after-hook "^2.2.0" 60 | universal-user-agent "^6.0.0" 61 | 62 | "@octokit/endpoint@^6.0.1": 63 | version "6.0.9" 64 | resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-6.0.9.tgz#c6a772e024202b1bd19ab69f90e0536a2598b13e" 65 | integrity sha512-3VPLbcCuqji4IFTclNUtGdp9v7g+nspWdiCUbK3+iPMjJCZ6LEhn1ts626bWLOn0GiDb6j+uqGvPpqLnY7pBgw== 66 | dependencies: 67 | "@octokit/types" "^5.0.0" 68 | is-plain-object "^5.0.0" 69 | universal-user-agent "^6.0.0" 70 | 71 | "@octokit/graphql@^4.5.8": 72 | version "4.8.0" 73 | resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-4.8.0.tgz#664d9b11c0e12112cbf78e10f49a05959aa22cc3" 74 | integrity sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg== 75 | dependencies: 76 | "@octokit/request" "^5.6.0" 77 | "@octokit/types" "^6.0.3" 78 | universal-user-agent "^6.0.0" 79 | 80 | "@octokit/openapi-types@^11.2.0": 81 | version "11.2.0" 82 | resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-11.2.0.tgz#b38d7fc3736d52a1e96b230c1ccd4a58a2f400a6" 83 | integrity sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA== 84 | 85 | "@octokit/plugin-paginate-rest@^2.17.0": 86 | version "2.17.0" 87 | resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.17.0.tgz#32e9c7cab2a374421d3d0de239102287d791bce7" 88 | integrity sha512-tzMbrbnam2Mt4AhuyCHvpRkS0oZ5MvwwcQPYGtMv4tUa5kkzG58SVB0fcsLulOZQeRnOgdkZWkRUiyBlh0Bkyw== 89 | dependencies: 90 | "@octokit/types" "^6.34.0" 91 | 92 | "@octokit/plugin-rest-endpoint-methods@^5.13.0": 93 | version "5.13.0" 94 | resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.13.0.tgz#8c46109021a3412233f6f50d28786f8e552427ba" 95 | integrity sha512-uJjMTkN1KaOIgNtUPMtIXDOjx6dGYysdIFhgA52x4xSadQCz3b/zJexvITDVpANnfKPW/+E0xkOvLntqMYpviA== 96 | dependencies: 97 | "@octokit/types" "^6.34.0" 98 | deprecation "^2.3.1" 99 | 100 | "@octokit/request-error@^2.0.5", "@octokit/request-error@^2.1.0": 101 | version "2.1.0" 102 | resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-2.1.0.tgz#9e150357831bfc788d13a4fd4b1913d60c74d677" 103 | integrity sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg== 104 | dependencies: 105 | "@octokit/types" "^6.0.3" 106 | deprecation "^2.0.0" 107 | once "^1.4.0" 108 | 109 | "@octokit/request@^5.6.0", "@octokit/request@^5.6.3": 110 | version "5.6.3" 111 | resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.6.3.tgz#19a022515a5bba965ac06c9d1334514eb50c48b0" 112 | integrity sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A== 113 | dependencies: 114 | "@octokit/endpoint" "^6.0.1" 115 | "@octokit/request-error" "^2.1.0" 116 | "@octokit/types" "^6.16.1" 117 | is-plain-object "^5.0.0" 118 | node-fetch "^2.6.7" 119 | universal-user-agent "^6.0.0" 120 | 121 | "@octokit/types@^5.0.0": 122 | version "5.5.0" 123 | resolved "https://registry.yarnpkg.com/@octokit/types/-/types-5.5.0.tgz#e5f06e8db21246ca102aa28444cdb13ae17a139b" 124 | integrity sha512-UZ1pErDue6bZNjYOotCNveTXArOMZQFG6hKJfOnGnulVCMcVVi7YIIuuR4WfBhjo7zgpmzn/BkPDnUXtNx+PcQ== 125 | dependencies: 126 | "@types/node" ">= 8" 127 | 128 | "@octokit/types@^6.0.3", "@octokit/types@^6.16.1", "@octokit/types@^6.34.0": 129 | version "6.34.0" 130 | resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.34.0.tgz#c6021333334d1ecfb5d370a8798162ddf1ae8218" 131 | integrity sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw== 132 | dependencies: 133 | "@octokit/openapi-types" "^11.2.0" 134 | 135 | "@types/node@>= 8": 136 | version "14.14.8" 137 | resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.8.tgz#2127bd81949a95c8b7d3240f3254352d72563aec" 138 | integrity sha512-z/5Yd59dCKI5kbxauAJgw6dLPzW+TNOItNE00PkpzNwUIEwdj/Lsqwq94H5DdYBX7C13aRA0CY32BK76+neEUA== 139 | 140 | "@vercel/ncc@0.34.0": 141 | version "0.34.0" 142 | resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.34.0.tgz#d0139528320e46670d949c82967044a8f66db054" 143 | integrity sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A== 144 | 145 | before-after-hook@^2.2.0: 146 | version "2.2.2" 147 | resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.2.tgz#a6e8ca41028d90ee2c24222f201c90956091613e" 148 | integrity sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ== 149 | 150 | deprecation@^2.0.0, deprecation@^2.3.1: 151 | version "2.3.1" 152 | resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919" 153 | integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== 154 | 155 | is-plain-object@^5.0.0: 156 | version "5.0.0" 157 | resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" 158 | integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== 159 | 160 | node-fetch@^2.6.7: 161 | version "2.6.7" 162 | resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" 163 | integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== 164 | dependencies: 165 | whatwg-url "^5.0.0" 166 | 167 | once@^1.4.0: 168 | version "1.4.0" 169 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" 170 | integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= 171 | dependencies: 172 | wrappy "1" 173 | 174 | tr46@~0.0.3: 175 | version "0.0.3" 176 | resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" 177 | integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= 178 | 179 | tunnel@^0.0.6: 180 | version "0.0.6" 181 | resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c" 182 | integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg== 183 | 184 | universal-user-agent@^6.0.0: 185 | version "6.0.0" 186 | resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee" 187 | integrity sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w== 188 | 189 | uuid@^8.3.2: 190 | version "8.3.2" 191 | resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" 192 | integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== 193 | 194 | webidl-conversions@^3.0.0: 195 | version "3.0.1" 196 | resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" 197 | integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= 198 | 199 | whatwg-url@^5.0.0: 200 | version "5.0.0" 201 | resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" 202 | integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= 203 | dependencies: 204 | tr46 "~0.0.3" 205 | webidl-conversions "^3.0.0" 206 | 207 | wrappy@1: 208 | version "1.0.2" 209 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" 210 | integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= 211 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | /******/ (() => { // webpackBootstrap 2 | /******/ var __webpack_modules__ = ({ 3 | 4 | /***/ 351: 5 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 6 | 7 | "use strict"; 8 | 9 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 10 | if (k2 === undefined) k2 = k; 11 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 12 | }) : (function(o, m, k, k2) { 13 | if (k2 === undefined) k2 = k; 14 | o[k2] = m[k]; 15 | })); 16 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 17 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 18 | }) : function(o, v) { 19 | o["default"] = v; 20 | }); 21 | var __importStar = (this && this.__importStar) || function (mod) { 22 | if (mod && mod.__esModule) return mod; 23 | var result = {}; 24 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 25 | __setModuleDefault(result, mod); 26 | return result; 27 | }; 28 | Object.defineProperty(exports, "__esModule", ({ value: true })); 29 | exports.issue = exports.issueCommand = void 0; 30 | const os = __importStar(__nccwpck_require__(37)); 31 | const utils_1 = __nccwpck_require__(278); 32 | /** 33 | * Commands 34 | * 35 | * Command Format: 36 | * ::name key=value,key=value::message 37 | * 38 | * Examples: 39 | * ::warning::This is the message 40 | * ::set-env name=MY_VAR::some value 41 | */ 42 | function issueCommand(command, properties, message) { 43 | const cmd = new Command(command, properties, message); 44 | process.stdout.write(cmd.toString() + os.EOL); 45 | } 46 | exports.issueCommand = issueCommand; 47 | function issue(name, message = '') { 48 | issueCommand(name, {}, message); 49 | } 50 | exports.issue = issue; 51 | const CMD_STRING = '::'; 52 | class Command { 53 | constructor(command, properties, message) { 54 | if (!command) { 55 | command = 'missing.command'; 56 | } 57 | this.command = command; 58 | this.properties = properties; 59 | this.message = message; 60 | } 61 | toString() { 62 | let cmdStr = CMD_STRING + this.command; 63 | if (this.properties && Object.keys(this.properties).length > 0) { 64 | cmdStr += ' '; 65 | let first = true; 66 | for (const key in this.properties) { 67 | if (this.properties.hasOwnProperty(key)) { 68 | const val = this.properties[key]; 69 | if (val) { 70 | if (first) { 71 | first = false; 72 | } 73 | else { 74 | cmdStr += ','; 75 | } 76 | cmdStr += `${key}=${escapeProperty(val)}`; 77 | } 78 | } 79 | } 80 | } 81 | cmdStr += `${CMD_STRING}${escapeData(this.message)}`; 82 | return cmdStr; 83 | } 84 | } 85 | function escapeData(s) { 86 | return utils_1.toCommandValue(s) 87 | .replace(/%/g, '%25') 88 | .replace(/\r/g, '%0D') 89 | .replace(/\n/g, '%0A'); 90 | } 91 | function escapeProperty(s) { 92 | return utils_1.toCommandValue(s) 93 | .replace(/%/g, '%25') 94 | .replace(/\r/g, '%0D') 95 | .replace(/\n/g, '%0A') 96 | .replace(/:/g, '%3A') 97 | .replace(/,/g, '%2C'); 98 | } 99 | //# sourceMappingURL=command.js.map 100 | 101 | /***/ }), 102 | 103 | /***/ 186: 104 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 105 | 106 | "use strict"; 107 | 108 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 109 | if (k2 === undefined) k2 = k; 110 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 111 | }) : (function(o, m, k, k2) { 112 | if (k2 === undefined) k2 = k; 113 | o[k2] = m[k]; 114 | })); 115 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 116 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 117 | }) : function(o, v) { 118 | o["default"] = v; 119 | }); 120 | var __importStar = (this && this.__importStar) || function (mod) { 121 | if (mod && mod.__esModule) return mod; 122 | var result = {}; 123 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 124 | __setModuleDefault(result, mod); 125 | return result; 126 | }; 127 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 128 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 129 | return new (P || (P = Promise))(function (resolve, reject) { 130 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 131 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 132 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 133 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 134 | }); 135 | }; 136 | Object.defineProperty(exports, "__esModule", ({ value: true })); 137 | 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; 138 | const command_1 = __nccwpck_require__(351); 139 | const file_command_1 = __nccwpck_require__(717); 140 | const utils_1 = __nccwpck_require__(278); 141 | const os = __importStar(__nccwpck_require__(37)); 142 | const path = __importStar(__nccwpck_require__(17)); 143 | const oidc_utils_1 = __nccwpck_require__(41); 144 | /** 145 | * The code to exit an action 146 | */ 147 | var ExitCode; 148 | (function (ExitCode) { 149 | /** 150 | * A code indicating that the action was successful 151 | */ 152 | ExitCode[ExitCode["Success"] = 0] = "Success"; 153 | /** 154 | * A code indicating that the action was a failure 155 | */ 156 | ExitCode[ExitCode["Failure"] = 1] = "Failure"; 157 | })(ExitCode = exports.ExitCode || (exports.ExitCode = {})); 158 | //----------------------------------------------------------------------- 159 | // Variables 160 | //----------------------------------------------------------------------- 161 | /** 162 | * Sets env variable for this action and future actions in the job 163 | * @param name the name of the variable to set 164 | * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify 165 | */ 166 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 167 | function exportVariable(name, val) { 168 | const convertedVal = utils_1.toCommandValue(val); 169 | process.env[name] = convertedVal; 170 | const filePath = process.env['GITHUB_ENV'] || ''; 171 | if (filePath) { 172 | const delimiter = '_GitHubActionsFileCommandDelimeter_'; 173 | const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; 174 | file_command_1.issueCommand('ENV', commandValue); 175 | } 176 | else { 177 | command_1.issueCommand('set-env', { name }, convertedVal); 178 | } 179 | } 180 | exports.exportVariable = exportVariable; 181 | /** 182 | * Registers a secret which will get masked from logs 183 | * @param secret value of the secret 184 | */ 185 | function setSecret(secret) { 186 | command_1.issueCommand('add-mask', {}, secret); 187 | } 188 | exports.setSecret = setSecret; 189 | /** 190 | * Prepends inputPath to the PATH (for this action and future actions) 191 | * @param inputPath 192 | */ 193 | function addPath(inputPath) { 194 | const filePath = process.env['GITHUB_PATH'] || ''; 195 | if (filePath) { 196 | file_command_1.issueCommand('PATH', inputPath); 197 | } 198 | else { 199 | command_1.issueCommand('add-path', {}, inputPath); 200 | } 201 | process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; 202 | } 203 | exports.addPath = addPath; 204 | /** 205 | * Gets the value of an input. 206 | * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed. 207 | * Returns an empty string if the value is not defined. 208 | * 209 | * @param name name of the input to get 210 | * @param options optional. See InputOptions. 211 | * @returns string 212 | */ 213 | function getInput(name, options) { 214 | const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; 215 | if (options && options.required && !val) { 216 | throw new Error(`Input required and not supplied: ${name}`); 217 | } 218 | if (options && options.trimWhitespace === false) { 219 | return val; 220 | } 221 | return val.trim(); 222 | } 223 | exports.getInput = getInput; 224 | /** 225 | * Gets the values of an multiline input. Each value is also trimmed. 226 | * 227 | * @param name name of the input to get 228 | * @param options optional. See InputOptions. 229 | * @returns string[] 230 | * 231 | */ 232 | function getMultilineInput(name, options) { 233 | const inputs = getInput(name, options) 234 | .split('\n') 235 | .filter(x => x !== ''); 236 | return inputs; 237 | } 238 | exports.getMultilineInput = getMultilineInput; 239 | /** 240 | * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. 241 | * Support boolean input list: `true | True | TRUE | false | False | FALSE` . 242 | * The return value is also in boolean type. 243 | * ref: https://yaml.org/spec/1.2/spec.html#id2804923 244 | * 245 | * @param name name of the input to get 246 | * @param options optional. See InputOptions. 247 | * @returns boolean 248 | */ 249 | function getBooleanInput(name, options) { 250 | const trueValue = ['true', 'True', 'TRUE']; 251 | const falseValue = ['false', 'False', 'FALSE']; 252 | const val = getInput(name, options); 253 | if (trueValue.includes(val)) 254 | return true; 255 | if (falseValue.includes(val)) 256 | return false; 257 | throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` + 258 | `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); 259 | } 260 | exports.getBooleanInput = getBooleanInput; 261 | /** 262 | * Sets the value of an output. 263 | * 264 | * @param name name of the output to set 265 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify 266 | */ 267 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 268 | function setOutput(name, value) { 269 | process.stdout.write(os.EOL); 270 | command_1.issueCommand('set-output', { name }, value); 271 | } 272 | exports.setOutput = setOutput; 273 | /** 274 | * Enables or disables the echoing of commands into stdout for the rest of the step. 275 | * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. 276 | * 277 | */ 278 | function setCommandEcho(enabled) { 279 | command_1.issue('echo', enabled ? 'on' : 'off'); 280 | } 281 | exports.setCommandEcho = setCommandEcho; 282 | //----------------------------------------------------------------------- 283 | // Results 284 | //----------------------------------------------------------------------- 285 | /** 286 | * Sets the action status to failed. 287 | * When the action exits it will be with an exit code of 1 288 | * @param message add error issue message 289 | */ 290 | function setFailed(message) { 291 | process.exitCode = ExitCode.Failure; 292 | error(message); 293 | } 294 | exports.setFailed = setFailed; 295 | //----------------------------------------------------------------------- 296 | // Logging Commands 297 | //----------------------------------------------------------------------- 298 | /** 299 | * Gets whether Actions Step Debug is on or not 300 | */ 301 | function isDebug() { 302 | return process.env['RUNNER_DEBUG'] === '1'; 303 | } 304 | exports.isDebug = isDebug; 305 | /** 306 | * Writes debug message to user log 307 | * @param message debug message 308 | */ 309 | function debug(message) { 310 | command_1.issueCommand('debug', {}, message); 311 | } 312 | exports.debug = debug; 313 | /** 314 | * Adds an error issue 315 | * @param message error issue message. Errors will be converted to string via toString() 316 | * @param properties optional properties to add to the annotation. 317 | */ 318 | function error(message, properties = {}) { 319 | command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 320 | } 321 | exports.error = error; 322 | /** 323 | * Adds a warning issue 324 | * @param message warning issue message. Errors will be converted to string via toString() 325 | * @param properties optional properties to add to the annotation. 326 | */ 327 | function warning(message, properties = {}) { 328 | command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 329 | } 330 | exports.warning = warning; 331 | /** 332 | * Adds a notice issue 333 | * @param message notice issue message. Errors will be converted to string via toString() 334 | * @param properties optional properties to add to the annotation. 335 | */ 336 | function notice(message, properties = {}) { 337 | command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); 338 | } 339 | exports.notice = notice; 340 | /** 341 | * Writes info to log with console.log. 342 | * @param message info message 343 | */ 344 | function info(message) { 345 | process.stdout.write(message + os.EOL); 346 | } 347 | exports.info = info; 348 | /** 349 | * Begin an output group. 350 | * 351 | * Output until the next `groupEnd` will be foldable in this group 352 | * 353 | * @param name The name of the output group 354 | */ 355 | function startGroup(name) { 356 | command_1.issue('group', name); 357 | } 358 | exports.startGroup = startGroup; 359 | /** 360 | * End an output group. 361 | */ 362 | function endGroup() { 363 | command_1.issue('endgroup'); 364 | } 365 | exports.endGroup = endGroup; 366 | /** 367 | * Wrap an asynchronous function call in a group. 368 | * 369 | * Returns the same type as the function itself. 370 | * 371 | * @param name The name of the group 372 | * @param fn The function to wrap in the group 373 | */ 374 | function group(name, fn) { 375 | return __awaiter(this, void 0, void 0, function* () { 376 | startGroup(name); 377 | let result; 378 | try { 379 | result = yield fn(); 380 | } 381 | finally { 382 | endGroup(); 383 | } 384 | return result; 385 | }); 386 | } 387 | exports.group = group; 388 | //----------------------------------------------------------------------- 389 | // Wrapper action state 390 | //----------------------------------------------------------------------- 391 | /** 392 | * Saves state for current action, the state can only be retrieved by this action's post job execution. 393 | * 394 | * @param name name of the state to store 395 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify 396 | */ 397 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 398 | function saveState(name, value) { 399 | command_1.issueCommand('save-state', { name }, value); 400 | } 401 | exports.saveState = saveState; 402 | /** 403 | * Gets the value of an state set by this action's main execution. 404 | * 405 | * @param name name of the state to get 406 | * @returns string 407 | */ 408 | function getState(name) { 409 | return process.env[`STATE_${name}`] || ''; 410 | } 411 | exports.getState = getState; 412 | function getIDToken(aud) { 413 | return __awaiter(this, void 0, void 0, function* () { 414 | return yield oidc_utils_1.OidcClient.getIDToken(aud); 415 | }); 416 | } 417 | exports.getIDToken = getIDToken; 418 | /** 419 | * Summary exports 420 | */ 421 | var summary_1 = __nccwpck_require__(327); 422 | Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); 423 | /** 424 | * @deprecated use core.summary 425 | */ 426 | var summary_2 = __nccwpck_require__(327); 427 | Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); 428 | //# sourceMappingURL=core.js.map 429 | 430 | /***/ }), 431 | 432 | /***/ 717: 433 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 434 | 435 | "use strict"; 436 | 437 | // For internal use, subject to change. 438 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 439 | if (k2 === undefined) k2 = k; 440 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 441 | }) : (function(o, m, k, k2) { 442 | if (k2 === undefined) k2 = k; 443 | o[k2] = m[k]; 444 | })); 445 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 446 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 447 | }) : function(o, v) { 448 | o["default"] = v; 449 | }); 450 | var __importStar = (this && this.__importStar) || function (mod) { 451 | if (mod && mod.__esModule) return mod; 452 | var result = {}; 453 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 454 | __setModuleDefault(result, mod); 455 | return result; 456 | }; 457 | Object.defineProperty(exports, "__esModule", ({ value: true })); 458 | exports.issueCommand = void 0; 459 | // We use any as a valid input type 460 | /* eslint-disable @typescript-eslint/no-explicit-any */ 461 | const fs = __importStar(__nccwpck_require__(147)); 462 | const os = __importStar(__nccwpck_require__(37)); 463 | const utils_1 = __nccwpck_require__(278); 464 | function issueCommand(command, message) { 465 | const filePath = process.env[`GITHUB_${command}`]; 466 | if (!filePath) { 467 | throw new Error(`Unable to find environment variable for file command ${command}`); 468 | } 469 | if (!fs.existsSync(filePath)) { 470 | throw new Error(`Missing file at path: ${filePath}`); 471 | } 472 | fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { 473 | encoding: 'utf8' 474 | }); 475 | } 476 | exports.issueCommand = issueCommand; 477 | //# sourceMappingURL=file-command.js.map 478 | 479 | /***/ }), 480 | 481 | /***/ 41: 482 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 483 | 484 | "use strict"; 485 | 486 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 487 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 488 | return new (P || (P = Promise))(function (resolve, reject) { 489 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 490 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 491 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 492 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 493 | }); 494 | }; 495 | Object.defineProperty(exports, "__esModule", ({ value: true })); 496 | exports.OidcClient = void 0; 497 | const http_client_1 = __nccwpck_require__(255); 498 | const auth_1 = __nccwpck_require__(526); 499 | const core_1 = __nccwpck_require__(186); 500 | class OidcClient { 501 | static createHttpClient(allowRetry = true, maxRetry = 10) { 502 | const requestOptions = { 503 | allowRetries: allowRetry, 504 | maxRetries: maxRetry 505 | }; 506 | return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); 507 | } 508 | static getRequestToken() { 509 | const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN']; 510 | if (!token) { 511 | throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable'); 512 | } 513 | return token; 514 | } 515 | static getIDTokenUrl() { 516 | const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']; 517 | if (!runtimeUrl) { 518 | throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable'); 519 | } 520 | return runtimeUrl; 521 | } 522 | static getCall(id_token_url) { 523 | var _a; 524 | return __awaiter(this, void 0, void 0, function* () { 525 | const httpclient = OidcClient.createHttpClient(); 526 | const res = yield httpclient 527 | .getJson(id_token_url) 528 | .catch(error => { 529 | throw new Error(`Failed to get ID Token. \n 530 | Error Code : ${error.statusCode}\n 531 | Error Message: ${error.result.message}`); 532 | }); 533 | const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; 534 | if (!id_token) { 535 | throw new Error('Response json body do not have ID Token field'); 536 | } 537 | return id_token; 538 | }); 539 | } 540 | static getIDToken(audience) { 541 | return __awaiter(this, void 0, void 0, function* () { 542 | try { 543 | // New ID Token is requested from action service 544 | let id_token_url = OidcClient.getIDTokenUrl(); 545 | if (audience) { 546 | const encodedAudience = encodeURIComponent(audience); 547 | id_token_url = `${id_token_url}&audience=${encodedAudience}`; 548 | } 549 | core_1.debug(`ID token url is ${id_token_url}`); 550 | const id_token = yield OidcClient.getCall(id_token_url); 551 | core_1.setSecret(id_token); 552 | return id_token; 553 | } 554 | catch (error) { 555 | throw new Error(`Error message: ${error.message}`); 556 | } 557 | }); 558 | } 559 | } 560 | exports.OidcClient = OidcClient; 561 | //# sourceMappingURL=oidc-utils.js.map 562 | 563 | /***/ }), 564 | 565 | /***/ 327: 566 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 567 | 568 | "use strict"; 569 | 570 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 571 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 572 | return new (P || (P = Promise))(function (resolve, reject) { 573 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 574 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 575 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 576 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 577 | }); 578 | }; 579 | Object.defineProperty(exports, "__esModule", ({ value: true })); 580 | exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; 581 | const os_1 = __nccwpck_require__(37); 582 | const fs_1 = __nccwpck_require__(147); 583 | const { access, appendFile, writeFile } = fs_1.promises; 584 | exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; 585 | exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; 586 | class Summary { 587 | constructor() { 588 | this._buffer = ''; 589 | } 590 | /** 591 | * Finds the summary file path from the environment, rejects if env var is not found or file does not exist 592 | * Also checks r/w permissions. 593 | * 594 | * @returns step summary file path 595 | */ 596 | filePath() { 597 | return __awaiter(this, void 0, void 0, function* () { 598 | if (this._filePath) { 599 | return this._filePath; 600 | } 601 | const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR]; 602 | if (!pathFromEnv) { 603 | throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); 604 | } 605 | try { 606 | yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK); 607 | } 608 | catch (_a) { 609 | throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); 610 | } 611 | this._filePath = pathFromEnv; 612 | return this._filePath; 613 | }); 614 | } 615 | /** 616 | * Wraps content in an HTML tag, adding any HTML attributes 617 | * 618 | * @param {string} tag HTML tag to wrap 619 | * @param {string | null} content content within the tag 620 | * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add 621 | * 622 | * @returns {string} content wrapped in HTML element 623 | */ 624 | wrap(tag, content, attrs = {}) { 625 | const htmlAttrs = Object.entries(attrs) 626 | .map(([key, value]) => ` ${key}="${value}"`) 627 | .join(''); 628 | if (!content) { 629 | return `<${tag}${htmlAttrs}>`; 630 | } 631 | return `<${tag}${htmlAttrs}>${content}`; 632 | } 633 | /** 634 | * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. 635 | * 636 | * @param {SummaryWriteOptions} [options] (optional) options for write operation 637 | * 638 | * @returns {Promise} summary instance 639 | */ 640 | write(options) { 641 | return __awaiter(this, void 0, void 0, function* () { 642 | const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); 643 | const filePath = yield this.filePath(); 644 | const writeFunc = overwrite ? writeFile : appendFile; 645 | yield writeFunc(filePath, this._buffer, { encoding: 'utf8' }); 646 | return this.emptyBuffer(); 647 | }); 648 | } 649 | /** 650 | * Clears the summary buffer and wipes the summary file 651 | * 652 | * @returns {Summary} summary instance 653 | */ 654 | clear() { 655 | return __awaiter(this, void 0, void 0, function* () { 656 | return this.emptyBuffer().write({ overwrite: true }); 657 | }); 658 | } 659 | /** 660 | * Returns the current summary buffer as a string 661 | * 662 | * @returns {string} string of summary buffer 663 | */ 664 | stringify() { 665 | return this._buffer; 666 | } 667 | /** 668 | * If the summary buffer is empty 669 | * 670 | * @returns {boolen} true if the buffer is empty 671 | */ 672 | isEmptyBuffer() { 673 | return this._buffer.length === 0; 674 | } 675 | /** 676 | * Resets the summary buffer without writing to summary file 677 | * 678 | * @returns {Summary} summary instance 679 | */ 680 | emptyBuffer() { 681 | this._buffer = ''; 682 | return this; 683 | } 684 | /** 685 | * Adds raw text to the summary buffer 686 | * 687 | * @param {string} text content to add 688 | * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) 689 | * 690 | * @returns {Summary} summary instance 691 | */ 692 | addRaw(text, addEOL = false) { 693 | this._buffer += text; 694 | return addEOL ? this.addEOL() : this; 695 | } 696 | /** 697 | * Adds the operating system-specific end-of-line marker to the buffer 698 | * 699 | * @returns {Summary} summary instance 700 | */ 701 | addEOL() { 702 | return this.addRaw(os_1.EOL); 703 | } 704 | /** 705 | * Adds an HTML codeblock to the summary buffer 706 | * 707 | * @param {string} code content to render within fenced code block 708 | * @param {string} lang (optional) language to syntax highlight code 709 | * 710 | * @returns {Summary} summary instance 711 | */ 712 | addCodeBlock(code, lang) { 713 | const attrs = Object.assign({}, (lang && { lang })); 714 | const element = this.wrap('pre', this.wrap('code', code), attrs); 715 | return this.addRaw(element).addEOL(); 716 | } 717 | /** 718 | * Adds an HTML list to the summary buffer 719 | * 720 | * @param {string[]} items list of items to render 721 | * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) 722 | * 723 | * @returns {Summary} summary instance 724 | */ 725 | addList(items, ordered = false) { 726 | const tag = ordered ? 'ol' : 'ul'; 727 | const listItems = items.map(item => this.wrap('li', item)).join(''); 728 | const element = this.wrap(tag, listItems); 729 | return this.addRaw(element).addEOL(); 730 | } 731 | /** 732 | * Adds an HTML table to the summary buffer 733 | * 734 | * @param {SummaryTableCell[]} rows table rows 735 | * 736 | * @returns {Summary} summary instance 737 | */ 738 | addTable(rows) { 739 | const tableBody = rows 740 | .map(row => { 741 | const cells = row 742 | .map(cell => { 743 | if (typeof cell === 'string') { 744 | return this.wrap('td', cell); 745 | } 746 | const { header, data, colspan, rowspan } = cell; 747 | const tag = header ? 'th' : 'td'; 748 | const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })); 749 | return this.wrap(tag, data, attrs); 750 | }) 751 | .join(''); 752 | return this.wrap('tr', cells); 753 | }) 754 | .join(''); 755 | const element = this.wrap('table', tableBody); 756 | return this.addRaw(element).addEOL(); 757 | } 758 | /** 759 | * Adds a collapsable HTML details element to the summary buffer 760 | * 761 | * @param {string} label text for the closed state 762 | * @param {string} content collapsable content 763 | * 764 | * @returns {Summary} summary instance 765 | */ 766 | addDetails(label, content) { 767 | const element = this.wrap('details', this.wrap('summary', label) + content); 768 | return this.addRaw(element).addEOL(); 769 | } 770 | /** 771 | * Adds an HTML image tag to the summary buffer 772 | * 773 | * @param {string} src path to the image you to embed 774 | * @param {string} alt text description of the image 775 | * @param {SummaryImageOptions} options (optional) addition image attributes 776 | * 777 | * @returns {Summary} summary instance 778 | */ 779 | addImage(src, alt, options) { 780 | const { width, height } = options || {}; 781 | const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height })); 782 | const element = this.wrap('img', null, Object.assign({ src, alt }, attrs)); 783 | return this.addRaw(element).addEOL(); 784 | } 785 | /** 786 | * Adds an HTML section heading element 787 | * 788 | * @param {string} text heading text 789 | * @param {number | string} [level=1] (optional) the heading level, default: 1 790 | * 791 | * @returns {Summary} summary instance 792 | */ 793 | addHeading(text, level) { 794 | const tag = `h${level}`; 795 | const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag) 796 | ? tag 797 | : 'h1'; 798 | const element = this.wrap(allowedTag, text); 799 | return this.addRaw(element).addEOL(); 800 | } 801 | /** 802 | * Adds an HTML thematic break (
) to the summary buffer 803 | * 804 | * @returns {Summary} summary instance 805 | */ 806 | addSeparator() { 807 | const element = this.wrap('hr', null); 808 | return this.addRaw(element).addEOL(); 809 | } 810 | /** 811 | * Adds an HTML line break (
) to the summary buffer 812 | * 813 | * @returns {Summary} summary instance 814 | */ 815 | addBreak() { 816 | const element = this.wrap('br', null); 817 | return this.addRaw(element).addEOL(); 818 | } 819 | /** 820 | * Adds an HTML blockquote to the summary buffer 821 | * 822 | * @param {string} text quote text 823 | * @param {string} cite (optional) citation url 824 | * 825 | * @returns {Summary} summary instance 826 | */ 827 | addQuote(text, cite) { 828 | const attrs = Object.assign({}, (cite && { cite })); 829 | const element = this.wrap('blockquote', text, attrs); 830 | return this.addRaw(element).addEOL(); 831 | } 832 | /** 833 | * Adds an HTML anchor tag to the summary buffer 834 | * 835 | * @param {string} text link text/content 836 | * @param {string} href hyperlink 837 | * 838 | * @returns {Summary} summary instance 839 | */ 840 | addLink(text, href) { 841 | const element = this.wrap('a', text, { href }); 842 | return this.addRaw(element).addEOL(); 843 | } 844 | } 845 | const _summary = new Summary(); 846 | /** 847 | * @deprecated use `core.summary` 848 | */ 849 | exports.markdownSummary = _summary; 850 | exports.summary = _summary; 851 | //# sourceMappingURL=summary.js.map 852 | 853 | /***/ }), 854 | 855 | /***/ 278: 856 | /***/ ((__unused_webpack_module, exports) => { 857 | 858 | "use strict"; 859 | 860 | // We use any as a valid input type 861 | /* eslint-disable @typescript-eslint/no-explicit-any */ 862 | Object.defineProperty(exports, "__esModule", ({ value: true })); 863 | exports.toCommandProperties = exports.toCommandValue = void 0; 864 | /** 865 | * Sanitizes an input into a string so it can be passed into issueCommand safely 866 | * @param input input to sanitize into a string 867 | */ 868 | function toCommandValue(input) { 869 | if (input === null || input === undefined) { 870 | return ''; 871 | } 872 | else if (typeof input === 'string' || input instanceof String) { 873 | return input; 874 | } 875 | return JSON.stringify(input); 876 | } 877 | exports.toCommandValue = toCommandValue; 878 | /** 879 | * 880 | * @param annotationProperties 881 | * @returns The command properties to send with the actual annotation command 882 | * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 883 | */ 884 | function toCommandProperties(annotationProperties) { 885 | if (!Object.keys(annotationProperties).length) { 886 | return {}; 887 | } 888 | return { 889 | title: annotationProperties.title, 890 | file: annotationProperties.file, 891 | line: annotationProperties.startLine, 892 | endLine: annotationProperties.endLine, 893 | col: annotationProperties.startColumn, 894 | endColumn: annotationProperties.endColumn 895 | }; 896 | } 897 | exports.toCommandProperties = toCommandProperties; 898 | //# sourceMappingURL=utils.js.map 899 | 900 | /***/ }), 901 | 902 | /***/ 514: 903 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 904 | 905 | "use strict"; 906 | 907 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 908 | if (k2 === undefined) k2 = k; 909 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 910 | }) : (function(o, m, k, k2) { 911 | if (k2 === undefined) k2 = k; 912 | o[k2] = m[k]; 913 | })); 914 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 915 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 916 | }) : function(o, v) { 917 | o["default"] = v; 918 | }); 919 | var __importStar = (this && this.__importStar) || function (mod) { 920 | if (mod && mod.__esModule) return mod; 921 | var result = {}; 922 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 923 | __setModuleDefault(result, mod); 924 | return result; 925 | }; 926 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 927 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 928 | return new (P || (P = Promise))(function (resolve, reject) { 929 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 930 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 931 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 932 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 933 | }); 934 | }; 935 | Object.defineProperty(exports, "__esModule", ({ value: true })); 936 | exports.getExecOutput = exports.exec = void 0; 937 | const string_decoder_1 = __nccwpck_require__(576); 938 | const tr = __importStar(__nccwpck_require__(159)); 939 | /** 940 | * Exec a command. 941 | * Output will be streamed to the live console. 942 | * Returns promise with return code 943 | * 944 | * @param commandLine command to execute (can include additional args). Must be correctly escaped. 945 | * @param args optional arguments for tool. Escaping is handled by the lib. 946 | * @param options optional exec options. See ExecOptions 947 | * @returns Promise exit code 948 | */ 949 | function exec(commandLine, args, options) { 950 | return __awaiter(this, void 0, void 0, function* () { 951 | const commandArgs = tr.argStringToArray(commandLine); 952 | if (commandArgs.length === 0) { 953 | throw new Error(`Parameter 'commandLine' cannot be null or empty.`); 954 | } 955 | // Path to tool to execute should be first arg 956 | const toolPath = commandArgs[0]; 957 | args = commandArgs.slice(1).concat(args || []); 958 | const runner = new tr.ToolRunner(toolPath, args, options); 959 | return runner.exec(); 960 | }); 961 | } 962 | exports.exec = exec; 963 | /** 964 | * Exec a command and get the output. 965 | * Output will be streamed to the live console. 966 | * Returns promise with the exit code and collected stdout and stderr 967 | * 968 | * @param commandLine command to execute (can include additional args). Must be correctly escaped. 969 | * @param args optional arguments for tool. Escaping is handled by the lib. 970 | * @param options optional exec options. See ExecOptions 971 | * @returns Promise exit code, stdout, and stderr 972 | */ 973 | function getExecOutput(commandLine, args, options) { 974 | var _a, _b; 975 | return __awaiter(this, void 0, void 0, function* () { 976 | let stdout = ''; 977 | let stderr = ''; 978 | //Using string decoder covers the case where a mult-byte character is split 979 | const stdoutDecoder = new string_decoder_1.StringDecoder('utf8'); 980 | const stderrDecoder = new string_decoder_1.StringDecoder('utf8'); 981 | const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout; 982 | const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr; 983 | const stdErrListener = (data) => { 984 | stderr += stderrDecoder.write(data); 985 | if (originalStdErrListener) { 986 | originalStdErrListener(data); 987 | } 988 | }; 989 | const stdOutListener = (data) => { 990 | stdout += stdoutDecoder.write(data); 991 | if (originalStdoutListener) { 992 | originalStdoutListener(data); 993 | } 994 | }; 995 | const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener }); 996 | const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners })); 997 | //flush any remaining characters 998 | stdout += stdoutDecoder.end(); 999 | stderr += stderrDecoder.end(); 1000 | return { 1001 | exitCode, 1002 | stdout, 1003 | stderr 1004 | }; 1005 | }); 1006 | } 1007 | exports.getExecOutput = getExecOutput; 1008 | //# sourceMappingURL=exec.js.map 1009 | 1010 | /***/ }), 1011 | 1012 | /***/ 159: 1013 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 1014 | 1015 | "use strict"; 1016 | 1017 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 1018 | if (k2 === undefined) k2 = k; 1019 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 1020 | }) : (function(o, m, k, k2) { 1021 | if (k2 === undefined) k2 = k; 1022 | o[k2] = m[k]; 1023 | })); 1024 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 1025 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 1026 | }) : function(o, v) { 1027 | o["default"] = v; 1028 | }); 1029 | var __importStar = (this && this.__importStar) || function (mod) { 1030 | if (mod && mod.__esModule) return mod; 1031 | var result = {}; 1032 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 1033 | __setModuleDefault(result, mod); 1034 | return result; 1035 | }; 1036 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 1037 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 1038 | return new (P || (P = Promise))(function (resolve, reject) { 1039 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 1040 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 1041 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 1042 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 1043 | }); 1044 | }; 1045 | Object.defineProperty(exports, "__esModule", ({ value: true })); 1046 | exports.argStringToArray = exports.ToolRunner = void 0; 1047 | const os = __importStar(__nccwpck_require__(37)); 1048 | const events = __importStar(__nccwpck_require__(361)); 1049 | const child = __importStar(__nccwpck_require__(81)); 1050 | const path = __importStar(__nccwpck_require__(17)); 1051 | const io = __importStar(__nccwpck_require__(436)); 1052 | const ioUtil = __importStar(__nccwpck_require__(962)); 1053 | const timers_1 = __nccwpck_require__(512); 1054 | /* eslint-disable @typescript-eslint/unbound-method */ 1055 | const IS_WINDOWS = process.platform === 'win32'; 1056 | /* 1057 | * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way. 1058 | */ 1059 | class ToolRunner extends events.EventEmitter { 1060 | constructor(toolPath, args, options) { 1061 | super(); 1062 | if (!toolPath) { 1063 | throw new Error("Parameter 'toolPath' cannot be null or empty."); 1064 | } 1065 | this.toolPath = toolPath; 1066 | this.args = args || []; 1067 | this.options = options || {}; 1068 | } 1069 | _debug(message) { 1070 | if (this.options.listeners && this.options.listeners.debug) { 1071 | this.options.listeners.debug(message); 1072 | } 1073 | } 1074 | _getCommandString(options, noPrefix) { 1075 | const toolPath = this._getSpawnFileName(); 1076 | const args = this._getSpawnArgs(options); 1077 | let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool 1078 | if (IS_WINDOWS) { 1079 | // Windows + cmd file 1080 | if (this._isCmdFile()) { 1081 | cmd += toolPath; 1082 | for (const a of args) { 1083 | cmd += ` ${a}`; 1084 | } 1085 | } 1086 | // Windows + verbatim 1087 | else if (options.windowsVerbatimArguments) { 1088 | cmd += `"${toolPath}"`; 1089 | for (const a of args) { 1090 | cmd += ` ${a}`; 1091 | } 1092 | } 1093 | // Windows (regular) 1094 | else { 1095 | cmd += this._windowsQuoteCmdArg(toolPath); 1096 | for (const a of args) { 1097 | cmd += ` ${this._windowsQuoteCmdArg(a)}`; 1098 | } 1099 | } 1100 | } 1101 | else { 1102 | // OSX/Linux - this can likely be improved with some form of quoting. 1103 | // creating processes on Unix is fundamentally different than Windows. 1104 | // on Unix, execvp() takes an arg array. 1105 | cmd += toolPath; 1106 | for (const a of args) { 1107 | cmd += ` ${a}`; 1108 | } 1109 | } 1110 | return cmd; 1111 | } 1112 | _processLineBuffer(data, strBuffer, onLine) { 1113 | try { 1114 | let s = strBuffer + data.toString(); 1115 | let n = s.indexOf(os.EOL); 1116 | while (n > -1) { 1117 | const line = s.substring(0, n); 1118 | onLine(line); 1119 | // the rest of the string ... 1120 | s = s.substring(n + os.EOL.length); 1121 | n = s.indexOf(os.EOL); 1122 | } 1123 | return s; 1124 | } 1125 | catch (err) { 1126 | // streaming lines to console is best effort. Don't fail a build. 1127 | this._debug(`error processing line. Failed with error ${err}`); 1128 | return ''; 1129 | } 1130 | } 1131 | _getSpawnFileName() { 1132 | if (IS_WINDOWS) { 1133 | if (this._isCmdFile()) { 1134 | return process.env['COMSPEC'] || 'cmd.exe'; 1135 | } 1136 | } 1137 | return this.toolPath; 1138 | } 1139 | _getSpawnArgs(options) { 1140 | if (IS_WINDOWS) { 1141 | if (this._isCmdFile()) { 1142 | let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`; 1143 | for (const a of this.args) { 1144 | argline += ' '; 1145 | argline += options.windowsVerbatimArguments 1146 | ? a 1147 | : this._windowsQuoteCmdArg(a); 1148 | } 1149 | argline += '"'; 1150 | return [argline]; 1151 | } 1152 | } 1153 | return this.args; 1154 | } 1155 | _endsWith(str, end) { 1156 | return str.endsWith(end); 1157 | } 1158 | _isCmdFile() { 1159 | const upperToolPath = this.toolPath.toUpperCase(); 1160 | return (this._endsWith(upperToolPath, '.CMD') || 1161 | this._endsWith(upperToolPath, '.BAT')); 1162 | } 1163 | _windowsQuoteCmdArg(arg) { 1164 | // for .exe, apply the normal quoting rules that libuv applies 1165 | if (!this._isCmdFile()) { 1166 | return this._uvQuoteCmdArg(arg); 1167 | } 1168 | // otherwise apply quoting rules specific to the cmd.exe command line parser. 1169 | // the libuv rules are generic and are not designed specifically for cmd.exe 1170 | // command line parser. 1171 | // 1172 | // for a detailed description of the cmd.exe command line parser, refer to 1173 | // http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912 1174 | // need quotes for empty arg 1175 | if (!arg) { 1176 | return '""'; 1177 | } 1178 | // determine whether the arg needs to be quoted 1179 | const cmdSpecialChars = [ 1180 | ' ', 1181 | '\t', 1182 | '&', 1183 | '(', 1184 | ')', 1185 | '[', 1186 | ']', 1187 | '{', 1188 | '}', 1189 | '^', 1190 | '=', 1191 | ';', 1192 | '!', 1193 | "'", 1194 | '+', 1195 | ',', 1196 | '`', 1197 | '~', 1198 | '|', 1199 | '<', 1200 | '>', 1201 | '"' 1202 | ]; 1203 | let needsQuotes = false; 1204 | for (const char of arg) { 1205 | if (cmdSpecialChars.some(x => x === char)) { 1206 | needsQuotes = true; 1207 | break; 1208 | } 1209 | } 1210 | // short-circuit if quotes not needed 1211 | if (!needsQuotes) { 1212 | return arg; 1213 | } 1214 | // the following quoting rules are very similar to the rules that by libuv applies. 1215 | // 1216 | // 1) wrap the string in quotes 1217 | // 1218 | // 2) double-up quotes - i.e. " => "" 1219 | // 1220 | // this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately 1221 | // doesn't work well with a cmd.exe command line. 1222 | // 1223 | // note, replacing " with "" also works well if the arg is passed to a downstream .NET console app. 1224 | // for example, the command line: 1225 | // foo.exe "myarg:""my val""" 1226 | // is parsed by a .NET console app into an arg array: 1227 | // [ "myarg:\"my val\"" ] 1228 | // which is the same end result when applying libuv quoting rules. although the actual 1229 | // command line from libuv quoting rules would look like: 1230 | // foo.exe "myarg:\"my val\"" 1231 | // 1232 | // 3) double-up slashes that precede a quote, 1233 | // e.g. hello \world => "hello \world" 1234 | // hello\"world => "hello\\""world" 1235 | // hello\\"world => "hello\\\\""world" 1236 | // hello world\ => "hello world\\" 1237 | // 1238 | // technically this is not required for a cmd.exe command line, or the batch argument parser. 1239 | // the reasons for including this as a .cmd quoting rule are: 1240 | // 1241 | // a) this is optimized for the scenario where the argument is passed from the .cmd file to an 1242 | // external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule. 1243 | // 1244 | // b) it's what we've been doing previously (by deferring to node default behavior) and we 1245 | // haven't heard any complaints about that aspect. 1246 | // 1247 | // note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be 1248 | // escaped when used on the command line directly - even though within a .cmd file % can be escaped 1249 | // by using %%. 1250 | // 1251 | // the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts 1252 | // the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing. 1253 | // 1254 | // one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would 1255 | // often work, since it is unlikely that var^ would exist, and the ^ character is removed when the 1256 | // variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args 1257 | // to an external program. 1258 | // 1259 | // an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file. 1260 | // % can be escaped within a .cmd file. 1261 | let reverse = '"'; 1262 | let quoteHit = true; 1263 | for (let i = arg.length; i > 0; i--) { 1264 | // walk the string in reverse 1265 | reverse += arg[i - 1]; 1266 | if (quoteHit && arg[i - 1] === '\\') { 1267 | reverse += '\\'; // double the slash 1268 | } 1269 | else if (arg[i - 1] === '"') { 1270 | quoteHit = true; 1271 | reverse += '"'; // double the quote 1272 | } 1273 | else { 1274 | quoteHit = false; 1275 | } 1276 | } 1277 | reverse += '"'; 1278 | return reverse 1279 | .split('') 1280 | .reverse() 1281 | .join(''); 1282 | } 1283 | _uvQuoteCmdArg(arg) { 1284 | // Tool runner wraps child_process.spawn() and needs to apply the same quoting as 1285 | // Node in certain cases where the undocumented spawn option windowsVerbatimArguments 1286 | // is used. 1287 | // 1288 | // Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV, 1289 | // see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details), 1290 | // pasting copyright notice from Node within this function: 1291 | // 1292 | // Copyright Joyent, Inc. and other Node contributors. All rights reserved. 1293 | // 1294 | // Permission is hereby granted, free of charge, to any person obtaining a copy 1295 | // of this software and associated documentation files (the "Software"), to 1296 | // deal in the Software without restriction, including without limitation the 1297 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 1298 | // sell copies of the Software, and to permit persons to whom the Software is 1299 | // furnished to do so, subject to the following conditions: 1300 | // 1301 | // The above copyright notice and this permission notice shall be included in 1302 | // all copies or substantial portions of the Software. 1303 | // 1304 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1305 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1306 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1307 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1308 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 1309 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 1310 | // IN THE SOFTWARE. 1311 | if (!arg) { 1312 | // Need double quotation for empty argument 1313 | return '""'; 1314 | } 1315 | if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) { 1316 | // No quotation needed 1317 | return arg; 1318 | } 1319 | if (!arg.includes('"') && !arg.includes('\\')) { 1320 | // No embedded double quotes or backslashes, so I can just wrap 1321 | // quote marks around the whole thing. 1322 | return `"${arg}"`; 1323 | } 1324 | // Expected input/output: 1325 | // input : hello"world 1326 | // output: "hello\"world" 1327 | // input : hello""world 1328 | // output: "hello\"\"world" 1329 | // input : hello\world 1330 | // output: hello\world 1331 | // input : hello\\world 1332 | // output: hello\\world 1333 | // input : hello\"world 1334 | // output: "hello\\\"world" 1335 | // input : hello\\"world 1336 | // output: "hello\\\\\"world" 1337 | // input : hello world\ 1338 | // output: "hello world\\" - note the comment in libuv actually reads "hello world\" 1339 | // but it appears the comment is wrong, it should be "hello world\\" 1340 | let reverse = '"'; 1341 | let quoteHit = true; 1342 | for (let i = arg.length; i > 0; i--) { 1343 | // walk the string in reverse 1344 | reverse += arg[i - 1]; 1345 | if (quoteHit && arg[i - 1] === '\\') { 1346 | reverse += '\\'; 1347 | } 1348 | else if (arg[i - 1] === '"') { 1349 | quoteHit = true; 1350 | reverse += '\\'; 1351 | } 1352 | else { 1353 | quoteHit = false; 1354 | } 1355 | } 1356 | reverse += '"'; 1357 | return reverse 1358 | .split('') 1359 | .reverse() 1360 | .join(''); 1361 | } 1362 | _cloneExecOptions(options) { 1363 | options = options || {}; 1364 | const result = { 1365 | cwd: options.cwd || process.cwd(), 1366 | env: options.env || process.env, 1367 | silent: options.silent || false, 1368 | windowsVerbatimArguments: options.windowsVerbatimArguments || false, 1369 | failOnStdErr: options.failOnStdErr || false, 1370 | ignoreReturnCode: options.ignoreReturnCode || false, 1371 | delay: options.delay || 10000 1372 | }; 1373 | result.outStream = options.outStream || process.stdout; 1374 | result.errStream = options.errStream || process.stderr; 1375 | return result; 1376 | } 1377 | _getSpawnOptions(options, toolPath) { 1378 | options = options || {}; 1379 | const result = {}; 1380 | result.cwd = options.cwd; 1381 | result.env = options.env; 1382 | result['windowsVerbatimArguments'] = 1383 | options.windowsVerbatimArguments || this._isCmdFile(); 1384 | if (options.windowsVerbatimArguments) { 1385 | result.argv0 = `"${toolPath}"`; 1386 | } 1387 | return result; 1388 | } 1389 | /** 1390 | * Exec a tool. 1391 | * Output will be streamed to the live console. 1392 | * Returns promise with return code 1393 | * 1394 | * @param tool path to tool to exec 1395 | * @param options optional exec options. See ExecOptions 1396 | * @returns number 1397 | */ 1398 | exec() { 1399 | return __awaiter(this, void 0, void 0, function* () { 1400 | // root the tool path if it is unrooted and contains relative pathing 1401 | if (!ioUtil.isRooted(this.toolPath) && 1402 | (this.toolPath.includes('/') || 1403 | (IS_WINDOWS && this.toolPath.includes('\\')))) { 1404 | // prefer options.cwd if it is specified, however options.cwd may also need to be rooted 1405 | this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); 1406 | } 1407 | // if the tool is only a file name, then resolve it from the PATH 1408 | // otherwise verify it exists (add extension on Windows if necessary) 1409 | this.toolPath = yield io.which(this.toolPath, true); 1410 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 1411 | this._debug(`exec tool: ${this.toolPath}`); 1412 | this._debug('arguments:'); 1413 | for (const arg of this.args) { 1414 | this._debug(` ${arg}`); 1415 | } 1416 | const optionsNonNull = this._cloneExecOptions(this.options); 1417 | if (!optionsNonNull.silent && optionsNonNull.outStream) { 1418 | optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); 1419 | } 1420 | const state = new ExecState(optionsNonNull, this.toolPath); 1421 | state.on('debug', (message) => { 1422 | this._debug(message); 1423 | }); 1424 | if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) { 1425 | return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`)); 1426 | } 1427 | const fileName = this._getSpawnFileName(); 1428 | const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); 1429 | let stdbuffer = ''; 1430 | if (cp.stdout) { 1431 | cp.stdout.on('data', (data) => { 1432 | if (this.options.listeners && this.options.listeners.stdout) { 1433 | this.options.listeners.stdout(data); 1434 | } 1435 | if (!optionsNonNull.silent && optionsNonNull.outStream) { 1436 | optionsNonNull.outStream.write(data); 1437 | } 1438 | stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => { 1439 | if (this.options.listeners && this.options.listeners.stdline) { 1440 | this.options.listeners.stdline(line); 1441 | } 1442 | }); 1443 | }); 1444 | } 1445 | let errbuffer = ''; 1446 | if (cp.stderr) { 1447 | cp.stderr.on('data', (data) => { 1448 | state.processStderr = true; 1449 | if (this.options.listeners && this.options.listeners.stderr) { 1450 | this.options.listeners.stderr(data); 1451 | } 1452 | if (!optionsNonNull.silent && 1453 | optionsNonNull.errStream && 1454 | optionsNonNull.outStream) { 1455 | const s = optionsNonNull.failOnStdErr 1456 | ? optionsNonNull.errStream 1457 | : optionsNonNull.outStream; 1458 | s.write(data); 1459 | } 1460 | errbuffer = this._processLineBuffer(data, errbuffer, (line) => { 1461 | if (this.options.listeners && this.options.listeners.errline) { 1462 | this.options.listeners.errline(line); 1463 | } 1464 | }); 1465 | }); 1466 | } 1467 | cp.on('error', (err) => { 1468 | state.processError = err.message; 1469 | state.processExited = true; 1470 | state.processClosed = true; 1471 | state.CheckComplete(); 1472 | }); 1473 | cp.on('exit', (code) => { 1474 | state.processExitCode = code; 1475 | state.processExited = true; 1476 | this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); 1477 | state.CheckComplete(); 1478 | }); 1479 | cp.on('close', (code) => { 1480 | state.processExitCode = code; 1481 | state.processExited = true; 1482 | state.processClosed = true; 1483 | this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); 1484 | state.CheckComplete(); 1485 | }); 1486 | state.on('done', (error, exitCode) => { 1487 | if (stdbuffer.length > 0) { 1488 | this.emit('stdline', stdbuffer); 1489 | } 1490 | if (errbuffer.length > 0) { 1491 | this.emit('errline', errbuffer); 1492 | } 1493 | cp.removeAllListeners(); 1494 | if (error) { 1495 | reject(error); 1496 | } 1497 | else { 1498 | resolve(exitCode); 1499 | } 1500 | }); 1501 | if (this.options.input) { 1502 | if (!cp.stdin) { 1503 | throw new Error('child process missing stdin'); 1504 | } 1505 | cp.stdin.end(this.options.input); 1506 | } 1507 | })); 1508 | }); 1509 | } 1510 | } 1511 | exports.ToolRunner = ToolRunner; 1512 | /** 1513 | * Convert an arg string to an array of args. Handles escaping 1514 | * 1515 | * @param argString string of arguments 1516 | * @returns string[] array of arguments 1517 | */ 1518 | function argStringToArray(argString) { 1519 | const args = []; 1520 | let inQuotes = false; 1521 | let escaped = false; 1522 | let arg = ''; 1523 | function append(c) { 1524 | // we only escape double quotes. 1525 | if (escaped && c !== '"') { 1526 | arg += '\\'; 1527 | } 1528 | arg += c; 1529 | escaped = false; 1530 | } 1531 | for (let i = 0; i < argString.length; i++) { 1532 | const c = argString.charAt(i); 1533 | if (c === '"') { 1534 | if (!escaped) { 1535 | inQuotes = !inQuotes; 1536 | } 1537 | else { 1538 | append(c); 1539 | } 1540 | continue; 1541 | } 1542 | if (c === '\\' && escaped) { 1543 | append(c); 1544 | continue; 1545 | } 1546 | if (c === '\\' && inQuotes) { 1547 | escaped = true; 1548 | continue; 1549 | } 1550 | if (c === ' ' && !inQuotes) { 1551 | if (arg.length > 0) { 1552 | args.push(arg); 1553 | arg = ''; 1554 | } 1555 | continue; 1556 | } 1557 | append(c); 1558 | } 1559 | if (arg.length > 0) { 1560 | args.push(arg.trim()); 1561 | } 1562 | return args; 1563 | } 1564 | exports.argStringToArray = argStringToArray; 1565 | class ExecState extends events.EventEmitter { 1566 | constructor(options, toolPath) { 1567 | super(); 1568 | this.processClosed = false; // tracks whether the process has exited and stdio is closed 1569 | this.processError = ''; 1570 | this.processExitCode = 0; 1571 | this.processExited = false; // tracks whether the process has exited 1572 | this.processStderr = false; // tracks whether stderr was written to 1573 | this.delay = 10000; // 10 seconds 1574 | this.done = false; 1575 | this.timeout = null; 1576 | if (!toolPath) { 1577 | throw new Error('toolPath must not be empty'); 1578 | } 1579 | this.options = options; 1580 | this.toolPath = toolPath; 1581 | if (options.delay) { 1582 | this.delay = options.delay; 1583 | } 1584 | } 1585 | CheckComplete() { 1586 | if (this.done) { 1587 | return; 1588 | } 1589 | if (this.processClosed) { 1590 | this._setResult(); 1591 | } 1592 | else if (this.processExited) { 1593 | this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this); 1594 | } 1595 | } 1596 | _debug(message) { 1597 | this.emit('debug', message); 1598 | } 1599 | _setResult() { 1600 | // determine whether there is an error 1601 | let error; 1602 | if (this.processExited) { 1603 | if (this.processError) { 1604 | 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}`); 1605 | } 1606 | else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) { 1607 | error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`); 1608 | } 1609 | else if (this.processStderr && this.options.failOnStdErr) { 1610 | error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`); 1611 | } 1612 | } 1613 | // clear the timeout 1614 | if (this.timeout) { 1615 | clearTimeout(this.timeout); 1616 | this.timeout = null; 1617 | } 1618 | this.done = true; 1619 | this.emit('done', error, this.processExitCode); 1620 | } 1621 | static HandleTimeout(state) { 1622 | if (state.done) { 1623 | return; 1624 | } 1625 | if (!state.processClosed && state.processExited) { 1626 | const message = `The STDIO streams did not close within ${state.delay / 1627 | 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.`; 1628 | state._debug(message); 1629 | } 1630 | state._setResult(); 1631 | } 1632 | } 1633 | //# sourceMappingURL=toolrunner.js.map 1634 | 1635 | /***/ }), 1636 | 1637 | /***/ 526: 1638 | /***/ (function(__unused_webpack_module, exports) { 1639 | 1640 | "use strict"; 1641 | 1642 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 1643 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 1644 | return new (P || (P = Promise))(function (resolve, reject) { 1645 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 1646 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 1647 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 1648 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 1649 | }); 1650 | }; 1651 | Object.defineProperty(exports, "__esModule", ({ value: true })); 1652 | exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0; 1653 | class BasicCredentialHandler { 1654 | constructor(username, password) { 1655 | this.username = username; 1656 | this.password = password; 1657 | } 1658 | prepareRequest(options) { 1659 | if (!options.headers) { 1660 | throw Error('The request has no headers'); 1661 | } 1662 | options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`; 1663 | } 1664 | // This handler cannot handle 401 1665 | canHandleAuthentication() { 1666 | return false; 1667 | } 1668 | handleAuthentication() { 1669 | return __awaiter(this, void 0, void 0, function* () { 1670 | throw new Error('not implemented'); 1671 | }); 1672 | } 1673 | } 1674 | exports.BasicCredentialHandler = BasicCredentialHandler; 1675 | class BearerCredentialHandler { 1676 | constructor(token) { 1677 | this.token = token; 1678 | } 1679 | // currently implements pre-authorization 1680 | // TODO: support preAuth = false where it hooks on 401 1681 | prepareRequest(options) { 1682 | if (!options.headers) { 1683 | throw Error('The request has no headers'); 1684 | } 1685 | options.headers['Authorization'] = `Bearer ${this.token}`; 1686 | } 1687 | // This handler cannot handle 401 1688 | canHandleAuthentication() { 1689 | return false; 1690 | } 1691 | handleAuthentication() { 1692 | return __awaiter(this, void 0, void 0, function* () { 1693 | throw new Error('not implemented'); 1694 | }); 1695 | } 1696 | } 1697 | exports.BearerCredentialHandler = BearerCredentialHandler; 1698 | class PersonalAccessTokenCredentialHandler { 1699 | constructor(token) { 1700 | this.token = token; 1701 | } 1702 | // currently implements pre-authorization 1703 | // TODO: support preAuth = false where it hooks on 401 1704 | prepareRequest(options) { 1705 | if (!options.headers) { 1706 | throw Error('The request has no headers'); 1707 | } 1708 | options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`; 1709 | } 1710 | // This handler cannot handle 401 1711 | canHandleAuthentication() { 1712 | return false; 1713 | } 1714 | handleAuthentication() { 1715 | return __awaiter(this, void 0, void 0, function* () { 1716 | throw new Error('not implemented'); 1717 | }); 1718 | } 1719 | } 1720 | exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; 1721 | //# sourceMappingURL=auth.js.map 1722 | 1723 | /***/ }), 1724 | 1725 | /***/ 255: 1726 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 1727 | 1728 | "use strict"; 1729 | 1730 | /* eslint-disable @typescript-eslint/no-explicit-any */ 1731 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 1732 | if (k2 === undefined) k2 = k; 1733 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 1734 | }) : (function(o, m, k, k2) { 1735 | if (k2 === undefined) k2 = k; 1736 | o[k2] = m[k]; 1737 | })); 1738 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 1739 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 1740 | }) : function(o, v) { 1741 | o["default"] = v; 1742 | }); 1743 | var __importStar = (this && this.__importStar) || function (mod) { 1744 | if (mod && mod.__esModule) return mod; 1745 | var result = {}; 1746 | if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 1747 | __setModuleDefault(result, mod); 1748 | return result; 1749 | }; 1750 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 1751 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 1752 | return new (P || (P = Promise))(function (resolve, reject) { 1753 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 1754 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 1755 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 1756 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 1757 | }); 1758 | }; 1759 | Object.defineProperty(exports, "__esModule", ({ value: true })); 1760 | exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; 1761 | const http = __importStar(__nccwpck_require__(685)); 1762 | const https = __importStar(__nccwpck_require__(687)); 1763 | const pm = __importStar(__nccwpck_require__(835)); 1764 | const tunnel = __importStar(__nccwpck_require__(294)); 1765 | var HttpCodes; 1766 | (function (HttpCodes) { 1767 | HttpCodes[HttpCodes["OK"] = 200] = "OK"; 1768 | HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; 1769 | HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; 1770 | HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; 1771 | HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; 1772 | HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; 1773 | HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; 1774 | HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; 1775 | HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; 1776 | HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; 1777 | HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; 1778 | HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; 1779 | HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; 1780 | HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; 1781 | HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; 1782 | HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; 1783 | HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; 1784 | HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; 1785 | HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; 1786 | HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; 1787 | HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; 1788 | HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; 1789 | HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; 1790 | HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; 1791 | HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; 1792 | HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; 1793 | HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; 1794 | })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); 1795 | var Headers; 1796 | (function (Headers) { 1797 | Headers["Accept"] = "accept"; 1798 | Headers["ContentType"] = "content-type"; 1799 | })(Headers = exports.Headers || (exports.Headers = {})); 1800 | var MediaTypes; 1801 | (function (MediaTypes) { 1802 | MediaTypes["ApplicationJson"] = "application/json"; 1803 | })(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); 1804 | /** 1805 | * Returns the proxy URL, depending upon the supplied url and proxy environment variables. 1806 | * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 1807 | */ 1808 | function getProxyUrl(serverUrl) { 1809 | const proxyUrl = pm.getProxyUrl(new URL(serverUrl)); 1810 | return proxyUrl ? proxyUrl.href : ''; 1811 | } 1812 | exports.getProxyUrl = getProxyUrl; 1813 | const HttpRedirectCodes = [ 1814 | HttpCodes.MovedPermanently, 1815 | HttpCodes.ResourceMoved, 1816 | HttpCodes.SeeOther, 1817 | HttpCodes.TemporaryRedirect, 1818 | HttpCodes.PermanentRedirect 1819 | ]; 1820 | const HttpResponseRetryCodes = [ 1821 | HttpCodes.BadGateway, 1822 | HttpCodes.ServiceUnavailable, 1823 | HttpCodes.GatewayTimeout 1824 | ]; 1825 | const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; 1826 | const ExponentialBackoffCeiling = 10; 1827 | const ExponentialBackoffTimeSlice = 5; 1828 | class HttpClientError extends Error { 1829 | constructor(message, statusCode) { 1830 | super(message); 1831 | this.name = 'HttpClientError'; 1832 | this.statusCode = statusCode; 1833 | Object.setPrototypeOf(this, HttpClientError.prototype); 1834 | } 1835 | } 1836 | exports.HttpClientError = HttpClientError; 1837 | class HttpClientResponse { 1838 | constructor(message) { 1839 | this.message = message; 1840 | } 1841 | readBody() { 1842 | return __awaiter(this, void 0, void 0, function* () { 1843 | return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { 1844 | let output = Buffer.alloc(0); 1845 | this.message.on('data', (chunk) => { 1846 | output = Buffer.concat([output, chunk]); 1847 | }); 1848 | this.message.on('end', () => { 1849 | resolve(output.toString()); 1850 | }); 1851 | })); 1852 | }); 1853 | } 1854 | } 1855 | exports.HttpClientResponse = HttpClientResponse; 1856 | function isHttps(requestUrl) { 1857 | const parsedUrl = new URL(requestUrl); 1858 | return parsedUrl.protocol === 'https:'; 1859 | } 1860 | exports.isHttps = isHttps; 1861 | class HttpClient { 1862 | constructor(userAgent, handlers, requestOptions) { 1863 | this._ignoreSslError = false; 1864 | this._allowRedirects = true; 1865 | this._allowRedirectDowngrade = false; 1866 | this._maxRedirects = 50; 1867 | this._allowRetries = false; 1868 | this._maxRetries = 1; 1869 | this._keepAlive = false; 1870 | this._disposed = false; 1871 | this.userAgent = userAgent; 1872 | this.handlers = handlers || []; 1873 | this.requestOptions = requestOptions; 1874 | if (requestOptions) { 1875 | if (requestOptions.ignoreSslError != null) { 1876 | this._ignoreSslError = requestOptions.ignoreSslError; 1877 | } 1878 | this._socketTimeout = requestOptions.socketTimeout; 1879 | if (requestOptions.allowRedirects != null) { 1880 | this._allowRedirects = requestOptions.allowRedirects; 1881 | } 1882 | if (requestOptions.allowRedirectDowngrade != null) { 1883 | this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; 1884 | } 1885 | if (requestOptions.maxRedirects != null) { 1886 | this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); 1887 | } 1888 | if (requestOptions.keepAlive != null) { 1889 | this._keepAlive = requestOptions.keepAlive; 1890 | } 1891 | if (requestOptions.allowRetries != null) { 1892 | this._allowRetries = requestOptions.allowRetries; 1893 | } 1894 | if (requestOptions.maxRetries != null) { 1895 | this._maxRetries = requestOptions.maxRetries; 1896 | } 1897 | } 1898 | } 1899 | options(requestUrl, additionalHeaders) { 1900 | return __awaiter(this, void 0, void 0, function* () { 1901 | return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); 1902 | }); 1903 | } 1904 | get(requestUrl, additionalHeaders) { 1905 | return __awaiter(this, void 0, void 0, function* () { 1906 | return this.request('GET', requestUrl, null, additionalHeaders || {}); 1907 | }); 1908 | } 1909 | del(requestUrl, additionalHeaders) { 1910 | return __awaiter(this, void 0, void 0, function* () { 1911 | return this.request('DELETE', requestUrl, null, additionalHeaders || {}); 1912 | }); 1913 | } 1914 | post(requestUrl, data, additionalHeaders) { 1915 | return __awaiter(this, void 0, void 0, function* () { 1916 | return this.request('POST', requestUrl, data, additionalHeaders || {}); 1917 | }); 1918 | } 1919 | patch(requestUrl, data, additionalHeaders) { 1920 | return __awaiter(this, void 0, void 0, function* () { 1921 | return this.request('PATCH', requestUrl, data, additionalHeaders || {}); 1922 | }); 1923 | } 1924 | put(requestUrl, data, additionalHeaders) { 1925 | return __awaiter(this, void 0, void 0, function* () { 1926 | return this.request('PUT', requestUrl, data, additionalHeaders || {}); 1927 | }); 1928 | } 1929 | head(requestUrl, additionalHeaders) { 1930 | return __awaiter(this, void 0, void 0, function* () { 1931 | return this.request('HEAD', requestUrl, null, additionalHeaders || {}); 1932 | }); 1933 | } 1934 | sendStream(verb, requestUrl, stream, additionalHeaders) { 1935 | return __awaiter(this, void 0, void 0, function* () { 1936 | return this.request(verb, requestUrl, stream, additionalHeaders); 1937 | }); 1938 | } 1939 | /** 1940 | * Gets a typed object from an endpoint 1941 | * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise 1942 | */ 1943 | getJson(requestUrl, additionalHeaders = {}) { 1944 | return __awaiter(this, void 0, void 0, function* () { 1945 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1946 | const res = yield this.get(requestUrl, additionalHeaders); 1947 | return this._processResponse(res, this.requestOptions); 1948 | }); 1949 | } 1950 | postJson(requestUrl, obj, additionalHeaders = {}) { 1951 | return __awaiter(this, void 0, void 0, function* () { 1952 | const data = JSON.stringify(obj, null, 2); 1953 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1954 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1955 | const res = yield this.post(requestUrl, data, additionalHeaders); 1956 | return this._processResponse(res, this.requestOptions); 1957 | }); 1958 | } 1959 | putJson(requestUrl, obj, additionalHeaders = {}) { 1960 | return __awaiter(this, void 0, void 0, function* () { 1961 | const data = JSON.stringify(obj, null, 2); 1962 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1963 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1964 | const res = yield this.put(requestUrl, data, additionalHeaders); 1965 | return this._processResponse(res, this.requestOptions); 1966 | }); 1967 | } 1968 | patchJson(requestUrl, obj, additionalHeaders = {}) { 1969 | return __awaiter(this, void 0, void 0, function* () { 1970 | const data = JSON.stringify(obj, null, 2); 1971 | additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 1972 | additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 1973 | const res = yield this.patch(requestUrl, data, additionalHeaders); 1974 | return this._processResponse(res, this.requestOptions); 1975 | }); 1976 | } 1977 | /** 1978 | * Makes a raw http request. 1979 | * All other methods such as get, post, patch, and request ultimately call this. 1980 | * Prefer get, del, post and patch 1981 | */ 1982 | request(verb, requestUrl, data, headers) { 1983 | return __awaiter(this, void 0, void 0, function* () { 1984 | if (this._disposed) { 1985 | throw new Error('Client has already been disposed.'); 1986 | } 1987 | const parsedUrl = new URL(requestUrl); 1988 | let info = this._prepareRequest(verb, parsedUrl, headers); 1989 | // Only perform retries on reads since writes may not be idempotent. 1990 | const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) 1991 | ? this._maxRetries + 1 1992 | : 1; 1993 | let numTries = 0; 1994 | let response; 1995 | do { 1996 | response = yield this.requestRaw(info, data); 1997 | // Check if it's an authentication challenge 1998 | if (response && 1999 | response.message && 2000 | response.message.statusCode === HttpCodes.Unauthorized) { 2001 | let authenticationHandler; 2002 | for (const handler of this.handlers) { 2003 | if (handler.canHandleAuthentication(response)) { 2004 | authenticationHandler = handler; 2005 | break; 2006 | } 2007 | } 2008 | if (authenticationHandler) { 2009 | return authenticationHandler.handleAuthentication(this, info, data); 2010 | } 2011 | else { 2012 | // We have received an unauthorized response but have no handlers to handle it. 2013 | // Let the response return to the caller. 2014 | return response; 2015 | } 2016 | } 2017 | let redirectsRemaining = this._maxRedirects; 2018 | while (response.message.statusCode && 2019 | HttpRedirectCodes.includes(response.message.statusCode) && 2020 | this._allowRedirects && 2021 | redirectsRemaining > 0) { 2022 | const redirectUrl = response.message.headers['location']; 2023 | if (!redirectUrl) { 2024 | // if there's no location to redirect to, we won't 2025 | break; 2026 | } 2027 | const parsedRedirectUrl = new URL(redirectUrl); 2028 | if (parsedUrl.protocol === 'https:' && 2029 | parsedUrl.protocol !== parsedRedirectUrl.protocol && 2030 | !this._allowRedirectDowngrade) { 2031 | 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.'); 2032 | } 2033 | // we need to finish reading the response before reassigning response 2034 | // which will leak the open socket. 2035 | yield response.readBody(); 2036 | // strip authorization header if redirected to a different hostname 2037 | if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { 2038 | for (const header in headers) { 2039 | // header names are case insensitive 2040 | if (header.toLowerCase() === 'authorization') { 2041 | delete headers[header]; 2042 | } 2043 | } 2044 | } 2045 | // let's make the request with the new redirectUrl 2046 | info = this._prepareRequest(verb, parsedRedirectUrl, headers); 2047 | response = yield this.requestRaw(info, data); 2048 | redirectsRemaining--; 2049 | } 2050 | if (!response.message.statusCode || 2051 | !HttpResponseRetryCodes.includes(response.message.statusCode)) { 2052 | // If not a retry code, return immediately instead of retrying 2053 | return response; 2054 | } 2055 | numTries += 1; 2056 | if (numTries < maxTries) { 2057 | yield response.readBody(); 2058 | yield this._performExponentialBackoff(numTries); 2059 | } 2060 | } while (numTries < maxTries); 2061 | return response; 2062 | }); 2063 | } 2064 | /** 2065 | * Needs to be called if keepAlive is set to true in request options. 2066 | */ 2067 | dispose() { 2068 | if (this._agent) { 2069 | this._agent.destroy(); 2070 | } 2071 | this._disposed = true; 2072 | } 2073 | /** 2074 | * Raw request. 2075 | * @param info 2076 | * @param data 2077 | */ 2078 | requestRaw(info, data) { 2079 | return __awaiter(this, void 0, void 0, function* () { 2080 | return new Promise((resolve, reject) => { 2081 | function callbackForResult(err, res) { 2082 | if (err) { 2083 | reject(err); 2084 | } 2085 | else if (!res) { 2086 | // If `err` is not passed, then `res` must be passed. 2087 | reject(new Error('Unknown error')); 2088 | } 2089 | else { 2090 | resolve(res); 2091 | } 2092 | } 2093 | this.requestRawWithCallback(info, data, callbackForResult); 2094 | }); 2095 | }); 2096 | } 2097 | /** 2098 | * Raw request with callback. 2099 | * @param info 2100 | * @param data 2101 | * @param onResult 2102 | */ 2103 | requestRawWithCallback(info, data, onResult) { 2104 | if (typeof data === 'string') { 2105 | if (!info.options.headers) { 2106 | info.options.headers = {}; 2107 | } 2108 | info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); 2109 | } 2110 | let callbackCalled = false; 2111 | function handleResult(err, res) { 2112 | if (!callbackCalled) { 2113 | callbackCalled = true; 2114 | onResult(err, res); 2115 | } 2116 | } 2117 | const req = info.httpModule.request(info.options, (msg) => { 2118 | const res = new HttpClientResponse(msg); 2119 | handleResult(undefined, res); 2120 | }); 2121 | let socket; 2122 | req.on('socket', sock => { 2123 | socket = sock; 2124 | }); 2125 | // If we ever get disconnected, we want the socket to timeout eventually 2126 | req.setTimeout(this._socketTimeout || 3 * 60000, () => { 2127 | if (socket) { 2128 | socket.end(); 2129 | } 2130 | handleResult(new Error(`Request timeout: ${info.options.path}`)); 2131 | }); 2132 | req.on('error', function (err) { 2133 | // err has statusCode property 2134 | // res should have headers 2135 | handleResult(err); 2136 | }); 2137 | if (data && typeof data === 'string') { 2138 | req.write(data, 'utf8'); 2139 | } 2140 | if (data && typeof data !== 'string') { 2141 | data.on('close', function () { 2142 | req.end(); 2143 | }); 2144 | data.pipe(req); 2145 | } 2146 | else { 2147 | req.end(); 2148 | } 2149 | } 2150 | /** 2151 | * Gets an http agent. This function is useful when you need an http agent that handles 2152 | * routing through a proxy server - depending upon the url and proxy environment variables. 2153 | * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 2154 | */ 2155 | getAgent(serverUrl) { 2156 | const parsedUrl = new URL(serverUrl); 2157 | return this._getAgent(parsedUrl); 2158 | } 2159 | _prepareRequest(method, requestUrl, headers) { 2160 | const info = {}; 2161 | info.parsedUrl = requestUrl; 2162 | const usingSsl = info.parsedUrl.protocol === 'https:'; 2163 | info.httpModule = usingSsl ? https : http; 2164 | const defaultPort = usingSsl ? 443 : 80; 2165 | info.options = {}; 2166 | info.options.host = info.parsedUrl.hostname; 2167 | info.options.port = info.parsedUrl.port 2168 | ? parseInt(info.parsedUrl.port) 2169 | : defaultPort; 2170 | info.options.path = 2171 | (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); 2172 | info.options.method = method; 2173 | info.options.headers = this._mergeHeaders(headers); 2174 | if (this.userAgent != null) { 2175 | info.options.headers['user-agent'] = this.userAgent; 2176 | } 2177 | info.options.agent = this._getAgent(info.parsedUrl); 2178 | // gives handlers an opportunity to participate 2179 | if (this.handlers) { 2180 | for (const handler of this.handlers) { 2181 | handler.prepareRequest(info.options); 2182 | } 2183 | } 2184 | return info; 2185 | } 2186 | _mergeHeaders(headers) { 2187 | if (this.requestOptions && this.requestOptions.headers) { 2188 | return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {})); 2189 | } 2190 | return lowercaseKeys(headers || {}); 2191 | } 2192 | _getExistingOrDefaultHeader(additionalHeaders, header, _default) { 2193 | let clientHeader; 2194 | if (this.requestOptions && this.requestOptions.headers) { 2195 | clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; 2196 | } 2197 | return additionalHeaders[header] || clientHeader || _default; 2198 | } 2199 | _getAgent(parsedUrl) { 2200 | let agent; 2201 | const proxyUrl = pm.getProxyUrl(parsedUrl); 2202 | const useProxy = proxyUrl && proxyUrl.hostname; 2203 | if (this._keepAlive && useProxy) { 2204 | agent = this._proxyAgent; 2205 | } 2206 | if (this._keepAlive && !useProxy) { 2207 | agent = this._agent; 2208 | } 2209 | // if agent is already assigned use that agent. 2210 | if (agent) { 2211 | return agent; 2212 | } 2213 | const usingSsl = parsedUrl.protocol === 'https:'; 2214 | let maxSockets = 100; 2215 | if (this.requestOptions) { 2216 | maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; 2217 | } 2218 | // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis. 2219 | if (proxyUrl && proxyUrl.hostname) { 2220 | const agentOptions = { 2221 | maxSockets, 2222 | keepAlive: this._keepAlive, 2223 | proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && { 2224 | proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` 2225 | })), { host: proxyUrl.hostname, port: proxyUrl.port }) 2226 | }; 2227 | let tunnelAgent; 2228 | const overHttps = proxyUrl.protocol === 'https:'; 2229 | if (usingSsl) { 2230 | tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; 2231 | } 2232 | else { 2233 | tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; 2234 | } 2235 | agent = tunnelAgent(agentOptions); 2236 | this._proxyAgent = agent; 2237 | } 2238 | // if reusing agent across request and tunneling agent isn't assigned create a new agent 2239 | if (this._keepAlive && !agent) { 2240 | const options = { keepAlive: this._keepAlive, maxSockets }; 2241 | agent = usingSsl ? new https.Agent(options) : new http.Agent(options); 2242 | this._agent = agent; 2243 | } 2244 | // if not using private agent and tunnel agent isn't setup then use global agent 2245 | if (!agent) { 2246 | agent = usingSsl ? https.globalAgent : http.globalAgent; 2247 | } 2248 | if (usingSsl && this._ignoreSslError) { 2249 | // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process 2250 | // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options 2251 | // we have to cast it to any and change it directly 2252 | agent.options = Object.assign(agent.options || {}, { 2253 | rejectUnauthorized: false 2254 | }); 2255 | } 2256 | return agent; 2257 | } 2258 | _performExponentialBackoff(retryNumber) { 2259 | return __awaiter(this, void 0, void 0, function* () { 2260 | retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); 2261 | const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); 2262 | return new Promise(resolve => setTimeout(() => resolve(), ms)); 2263 | }); 2264 | } 2265 | _processResponse(res, options) { 2266 | return __awaiter(this, void 0, void 0, function* () { 2267 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { 2268 | const statusCode = res.message.statusCode || 0; 2269 | const response = { 2270 | statusCode, 2271 | result: null, 2272 | headers: {} 2273 | }; 2274 | // not found leads to null obj returned 2275 | if (statusCode === HttpCodes.NotFound) { 2276 | resolve(response); 2277 | } 2278 | // get the result from the body 2279 | function dateTimeDeserializer(key, value) { 2280 | if (typeof value === 'string') { 2281 | const a = new Date(value); 2282 | if (!isNaN(a.valueOf())) { 2283 | return a; 2284 | } 2285 | } 2286 | return value; 2287 | } 2288 | let obj; 2289 | let contents; 2290 | try { 2291 | contents = yield res.readBody(); 2292 | if (contents && contents.length > 0) { 2293 | if (options && options.deserializeDates) { 2294 | obj = JSON.parse(contents, dateTimeDeserializer); 2295 | } 2296 | else { 2297 | obj = JSON.parse(contents); 2298 | } 2299 | response.result = obj; 2300 | } 2301 | response.headers = res.message.headers; 2302 | } 2303 | catch (err) { 2304 | // Invalid resource (contents not json); leaving result obj null 2305 | } 2306 | // note that 3xx redirects are handled by the http layer. 2307 | if (statusCode > 299) { 2308 | let msg; 2309 | // if exception/error in body, attempt to get better error 2310 | if (obj && obj.message) { 2311 | msg = obj.message; 2312 | } 2313 | else if (contents && contents.length > 0) { 2314 | // it may be the case that the exception is in the body message as string 2315 | msg = contents; 2316 | } 2317 | else { 2318 | msg = `Failed request: (${statusCode})`; 2319 | } 2320 | const err = new HttpClientError(msg, statusCode); 2321 | err.result = response.result; 2322 | reject(err); 2323 | } 2324 | else { 2325 | resolve(response); 2326 | } 2327 | })); 2328 | }); 2329 | } 2330 | } 2331 | exports.HttpClient = HttpClient; 2332 | const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); 2333 | //# sourceMappingURL=index.js.map 2334 | 2335 | /***/ }), 2336 | 2337 | /***/ 835: 2338 | /***/ ((__unused_webpack_module, exports) => { 2339 | 2340 | "use strict"; 2341 | 2342 | Object.defineProperty(exports, "__esModule", ({ value: true })); 2343 | exports.checkBypass = exports.getProxyUrl = void 0; 2344 | function getProxyUrl(reqUrl) { 2345 | const usingSsl = reqUrl.protocol === 'https:'; 2346 | if (checkBypass(reqUrl)) { 2347 | return undefined; 2348 | } 2349 | const proxyVar = (() => { 2350 | if (usingSsl) { 2351 | return process.env['https_proxy'] || process.env['HTTPS_PROXY']; 2352 | } 2353 | else { 2354 | return process.env['http_proxy'] || process.env['HTTP_PROXY']; 2355 | } 2356 | })(); 2357 | if (proxyVar) { 2358 | return new URL(proxyVar); 2359 | } 2360 | else { 2361 | return undefined; 2362 | } 2363 | } 2364 | exports.getProxyUrl = getProxyUrl; 2365 | function checkBypass(reqUrl) { 2366 | if (!reqUrl.hostname) { 2367 | return false; 2368 | } 2369 | const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; 2370 | if (!noProxy) { 2371 | return false; 2372 | } 2373 | // Determine the request port 2374 | let reqPort; 2375 | if (reqUrl.port) { 2376 | reqPort = Number(reqUrl.port); 2377 | } 2378 | else if (reqUrl.protocol === 'http:') { 2379 | reqPort = 80; 2380 | } 2381 | else if (reqUrl.protocol === 'https:') { 2382 | reqPort = 443; 2383 | } 2384 | // Format the request hostname and hostname with port 2385 | const upperReqHosts = [reqUrl.hostname.toUpperCase()]; 2386 | if (typeof reqPort === 'number') { 2387 | upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); 2388 | } 2389 | // Compare request host against noproxy 2390 | for (const upperNoProxyItem of noProxy 2391 | .split(',') 2392 | .map(x => x.trim().toUpperCase()) 2393 | .filter(x => x)) { 2394 | if (upperReqHosts.some(x => x === upperNoProxyItem)) { 2395 | return true; 2396 | } 2397 | } 2398 | return false; 2399 | } 2400 | exports.checkBypass = checkBypass; 2401 | //# sourceMappingURL=proxy.js.map 2402 | 2403 | /***/ }), 2404 | 2405 | /***/ 962: 2406 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 2407 | 2408 | "use strict"; 2409 | 2410 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2411 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 2412 | return new (P || (P = Promise))(function (resolve, reject) { 2413 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 2414 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 2415 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 2416 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 2417 | }); 2418 | }; 2419 | var _a; 2420 | Object.defineProperty(exports, "__esModule", ({ value: true })); 2421 | const assert_1 = __nccwpck_require__(491); 2422 | const fs = __nccwpck_require__(147); 2423 | const path = __nccwpck_require__(17); 2424 | _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; 2425 | exports.IS_WINDOWS = process.platform === 'win32'; 2426 | function exists(fsPath) { 2427 | return __awaiter(this, void 0, void 0, function* () { 2428 | try { 2429 | yield exports.stat(fsPath); 2430 | } 2431 | catch (err) { 2432 | if (err.code === 'ENOENT') { 2433 | return false; 2434 | } 2435 | throw err; 2436 | } 2437 | return true; 2438 | }); 2439 | } 2440 | exports.exists = exists; 2441 | function isDirectory(fsPath, useStat = false) { 2442 | return __awaiter(this, void 0, void 0, function* () { 2443 | const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath); 2444 | return stats.isDirectory(); 2445 | }); 2446 | } 2447 | exports.isDirectory = isDirectory; 2448 | /** 2449 | * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like: 2450 | * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases). 2451 | */ 2452 | function isRooted(p) { 2453 | p = normalizeSeparators(p); 2454 | if (!p) { 2455 | throw new Error('isRooted() parameter "p" cannot be empty'); 2456 | } 2457 | if (exports.IS_WINDOWS) { 2458 | return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello 2459 | ); // e.g. C: or C:\hello 2460 | } 2461 | return p.startsWith('/'); 2462 | } 2463 | exports.isRooted = isRooted; 2464 | /** 2465 | * Recursively create a directory at `fsPath`. 2466 | * 2467 | * This implementation is optimistic, meaning it attempts to create the full 2468 | * path first, and backs up the path stack from there. 2469 | * 2470 | * @param fsPath The path to create 2471 | * @param maxDepth The maximum recursion depth 2472 | * @param depth The current recursion depth 2473 | */ 2474 | function mkdirP(fsPath, maxDepth = 1000, depth = 1) { 2475 | return __awaiter(this, void 0, void 0, function* () { 2476 | assert_1.ok(fsPath, 'a path argument must be provided'); 2477 | fsPath = path.resolve(fsPath); 2478 | if (depth >= maxDepth) 2479 | return exports.mkdir(fsPath); 2480 | try { 2481 | yield exports.mkdir(fsPath); 2482 | return; 2483 | } 2484 | catch (err) { 2485 | switch (err.code) { 2486 | case 'ENOENT': { 2487 | yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1); 2488 | yield exports.mkdir(fsPath); 2489 | return; 2490 | } 2491 | default: { 2492 | let stats; 2493 | try { 2494 | stats = yield exports.stat(fsPath); 2495 | } 2496 | catch (err2) { 2497 | throw err; 2498 | } 2499 | if (!stats.isDirectory()) 2500 | throw err; 2501 | } 2502 | } 2503 | } 2504 | }); 2505 | } 2506 | exports.mkdirP = mkdirP; 2507 | /** 2508 | * Best effort attempt to determine whether a file exists and is executable. 2509 | * @param filePath file path to check 2510 | * @param extensions additional file extensions to try 2511 | * @return if file exists and is executable, returns the file path. otherwise empty string. 2512 | */ 2513 | function tryGetExecutablePath(filePath, extensions) { 2514 | return __awaiter(this, void 0, void 0, function* () { 2515 | let stats = undefined; 2516 | try { 2517 | // test file exists 2518 | stats = yield exports.stat(filePath); 2519 | } 2520 | catch (err) { 2521 | if (err.code !== 'ENOENT') { 2522 | // eslint-disable-next-line no-console 2523 | console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); 2524 | } 2525 | } 2526 | if (stats && stats.isFile()) { 2527 | if (exports.IS_WINDOWS) { 2528 | // on Windows, test for valid extension 2529 | const upperExt = path.extname(filePath).toUpperCase(); 2530 | if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) { 2531 | return filePath; 2532 | } 2533 | } 2534 | else { 2535 | if (isUnixExecutable(stats)) { 2536 | return filePath; 2537 | } 2538 | } 2539 | } 2540 | // try each extension 2541 | const originalFilePath = filePath; 2542 | for (const extension of extensions) { 2543 | filePath = originalFilePath + extension; 2544 | stats = undefined; 2545 | try { 2546 | stats = yield exports.stat(filePath); 2547 | } 2548 | catch (err) { 2549 | if (err.code !== 'ENOENT') { 2550 | // eslint-disable-next-line no-console 2551 | console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); 2552 | } 2553 | } 2554 | if (stats && stats.isFile()) { 2555 | if (exports.IS_WINDOWS) { 2556 | // preserve the case of the actual file (since an extension was appended) 2557 | try { 2558 | const directory = path.dirname(filePath); 2559 | const upperName = path.basename(filePath).toUpperCase(); 2560 | for (const actualName of yield exports.readdir(directory)) { 2561 | if (upperName === actualName.toUpperCase()) { 2562 | filePath = path.join(directory, actualName); 2563 | break; 2564 | } 2565 | } 2566 | } 2567 | catch (err) { 2568 | // eslint-disable-next-line no-console 2569 | console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`); 2570 | } 2571 | return filePath; 2572 | } 2573 | else { 2574 | if (isUnixExecutable(stats)) { 2575 | return filePath; 2576 | } 2577 | } 2578 | } 2579 | } 2580 | return ''; 2581 | }); 2582 | } 2583 | exports.tryGetExecutablePath = tryGetExecutablePath; 2584 | function normalizeSeparators(p) { 2585 | p = p || ''; 2586 | if (exports.IS_WINDOWS) { 2587 | // convert slashes on Windows 2588 | p = p.replace(/\//g, '\\'); 2589 | // remove redundant slashes 2590 | return p.replace(/\\\\+/g, '\\'); 2591 | } 2592 | // remove redundant slashes 2593 | return p.replace(/\/\/+/g, '/'); 2594 | } 2595 | // on Mac/Linux, test the execute bit 2596 | // R W X R W X R W X 2597 | // 256 128 64 32 16 8 4 2 1 2598 | function isUnixExecutable(stats) { 2599 | return ((stats.mode & 1) > 0 || 2600 | ((stats.mode & 8) > 0 && stats.gid === process.getgid()) || 2601 | ((stats.mode & 64) > 0 && stats.uid === process.getuid())); 2602 | } 2603 | //# sourceMappingURL=io-util.js.map 2604 | 2605 | /***/ }), 2606 | 2607 | /***/ 436: 2608 | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 2609 | 2610 | "use strict"; 2611 | 2612 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2613 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 2614 | return new (P || (P = Promise))(function (resolve, reject) { 2615 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 2616 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 2617 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 2618 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 2619 | }); 2620 | }; 2621 | Object.defineProperty(exports, "__esModule", ({ value: true })); 2622 | const childProcess = __nccwpck_require__(81); 2623 | const path = __nccwpck_require__(17); 2624 | const util_1 = __nccwpck_require__(837); 2625 | const ioUtil = __nccwpck_require__(962); 2626 | const exec = util_1.promisify(childProcess.exec); 2627 | /** 2628 | * Copies a file or folder. 2629 | * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js 2630 | * 2631 | * @param source source path 2632 | * @param dest destination path 2633 | * @param options optional. See CopyOptions. 2634 | */ 2635 | function cp(source, dest, options = {}) { 2636 | return __awaiter(this, void 0, void 0, function* () { 2637 | const { force, recursive } = readCopyOptions(options); 2638 | const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null; 2639 | // Dest is an existing file, but not forcing 2640 | if (destStat && destStat.isFile() && !force) { 2641 | return; 2642 | } 2643 | // If dest is an existing directory, should copy inside. 2644 | const newDest = destStat && destStat.isDirectory() 2645 | ? path.join(dest, path.basename(source)) 2646 | : dest; 2647 | if (!(yield ioUtil.exists(source))) { 2648 | throw new Error(`no such file or directory: ${source}`); 2649 | } 2650 | const sourceStat = yield ioUtil.stat(source); 2651 | if (sourceStat.isDirectory()) { 2652 | if (!recursive) { 2653 | throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`); 2654 | } 2655 | else { 2656 | yield cpDirRecursive(source, newDest, 0, force); 2657 | } 2658 | } 2659 | else { 2660 | if (path.relative(source, newDest) === '') { 2661 | // a file cannot be copied to itself 2662 | throw new Error(`'${newDest}' and '${source}' are the same file`); 2663 | } 2664 | yield copyFile(source, newDest, force); 2665 | } 2666 | }); 2667 | } 2668 | exports.cp = cp; 2669 | /** 2670 | * Moves a path. 2671 | * 2672 | * @param source source path 2673 | * @param dest destination path 2674 | * @param options optional. See MoveOptions. 2675 | */ 2676 | function mv(source, dest, options = {}) { 2677 | return __awaiter(this, void 0, void 0, function* () { 2678 | if (yield ioUtil.exists(dest)) { 2679 | let destExists = true; 2680 | if (yield ioUtil.isDirectory(dest)) { 2681 | // If dest is directory copy src into dest 2682 | dest = path.join(dest, path.basename(source)); 2683 | destExists = yield ioUtil.exists(dest); 2684 | } 2685 | if (destExists) { 2686 | if (options.force == null || options.force) { 2687 | yield rmRF(dest); 2688 | } 2689 | else { 2690 | throw new Error('Destination already exists'); 2691 | } 2692 | } 2693 | } 2694 | yield mkdirP(path.dirname(dest)); 2695 | yield ioUtil.rename(source, dest); 2696 | }); 2697 | } 2698 | exports.mv = mv; 2699 | /** 2700 | * Remove a path recursively with force 2701 | * 2702 | * @param inputPath path to remove 2703 | */ 2704 | function rmRF(inputPath) { 2705 | return __awaiter(this, void 0, void 0, function* () { 2706 | if (ioUtil.IS_WINDOWS) { 2707 | // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another 2708 | // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del. 2709 | try { 2710 | if (yield ioUtil.isDirectory(inputPath, true)) { 2711 | yield exec(`rd /s /q "${inputPath}"`); 2712 | } 2713 | else { 2714 | yield exec(`del /f /a "${inputPath}"`); 2715 | } 2716 | } 2717 | catch (err) { 2718 | // if you try to delete a file that doesn't exist, desired result is achieved 2719 | // other errors are valid 2720 | if (err.code !== 'ENOENT') 2721 | throw err; 2722 | } 2723 | // Shelling out fails to remove a symlink folder with missing source, this unlink catches that 2724 | try { 2725 | yield ioUtil.unlink(inputPath); 2726 | } 2727 | catch (err) { 2728 | // if you try to delete a file that doesn't exist, desired result is achieved 2729 | // other errors are valid 2730 | if (err.code !== 'ENOENT') 2731 | throw err; 2732 | } 2733 | } 2734 | else { 2735 | let isDir = false; 2736 | try { 2737 | isDir = yield ioUtil.isDirectory(inputPath); 2738 | } 2739 | catch (err) { 2740 | // if you try to delete a file that doesn't exist, desired result is achieved 2741 | // other errors are valid 2742 | if (err.code !== 'ENOENT') 2743 | throw err; 2744 | return; 2745 | } 2746 | if (isDir) { 2747 | yield exec(`rm -rf "${inputPath}"`); 2748 | } 2749 | else { 2750 | yield ioUtil.unlink(inputPath); 2751 | } 2752 | } 2753 | }); 2754 | } 2755 | exports.rmRF = rmRF; 2756 | /** 2757 | * Make a directory. Creates the full path with folders in between 2758 | * Will throw if it fails 2759 | * 2760 | * @param fsPath path to create 2761 | * @returns Promise 2762 | */ 2763 | function mkdirP(fsPath) { 2764 | return __awaiter(this, void 0, void 0, function* () { 2765 | yield ioUtil.mkdirP(fsPath); 2766 | }); 2767 | } 2768 | exports.mkdirP = mkdirP; 2769 | /** 2770 | * Returns path of a tool had the tool actually been invoked. Resolves via paths. 2771 | * If you check and the tool does not exist, it will throw. 2772 | * 2773 | * @param tool name of the tool 2774 | * @param check whether to check if tool exists 2775 | * @returns Promise path to tool 2776 | */ 2777 | function which(tool, check) { 2778 | return __awaiter(this, void 0, void 0, function* () { 2779 | if (!tool) { 2780 | throw new Error("parameter 'tool' is required"); 2781 | } 2782 | // recursive when check=true 2783 | if (check) { 2784 | const result = yield which(tool, false); 2785 | if (!result) { 2786 | if (ioUtil.IS_WINDOWS) { 2787 | 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.`); 2788 | } 2789 | else { 2790 | 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.`); 2791 | } 2792 | } 2793 | } 2794 | try { 2795 | // build the list of extensions to try 2796 | const extensions = []; 2797 | if (ioUtil.IS_WINDOWS && process.env.PATHEXT) { 2798 | for (const extension of process.env.PATHEXT.split(path.delimiter)) { 2799 | if (extension) { 2800 | extensions.push(extension); 2801 | } 2802 | } 2803 | } 2804 | // if it's rooted, return it if exists. otherwise return empty. 2805 | if (ioUtil.isRooted(tool)) { 2806 | const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); 2807 | if (filePath) { 2808 | return filePath; 2809 | } 2810 | return ''; 2811 | } 2812 | // if any path separators, return empty 2813 | if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) { 2814 | return ''; 2815 | } 2816 | // build the list of directories 2817 | // 2818 | // Note, technically "where" checks the current directory on Windows. From a toolkit perspective, 2819 | // it feels like we should not do this. Checking the current directory seems like more of a use 2820 | // case of a shell, and the which() function exposed by the toolkit should strive for consistency 2821 | // across platforms. 2822 | const directories = []; 2823 | if (process.env.PATH) { 2824 | for (const p of process.env.PATH.split(path.delimiter)) { 2825 | if (p) { 2826 | directories.push(p); 2827 | } 2828 | } 2829 | } 2830 | // return the first match 2831 | for (const directory of directories) { 2832 | const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions); 2833 | if (filePath) { 2834 | return filePath; 2835 | } 2836 | } 2837 | return ''; 2838 | } 2839 | catch (err) { 2840 | throw new Error(`which failed with message ${err.message}`); 2841 | } 2842 | }); 2843 | } 2844 | exports.which = which; 2845 | function readCopyOptions(options) { 2846 | const force = options.force == null ? true : options.force; 2847 | const recursive = Boolean(options.recursive); 2848 | return { force, recursive }; 2849 | } 2850 | function cpDirRecursive(sourceDir, destDir, currentDepth, force) { 2851 | return __awaiter(this, void 0, void 0, function* () { 2852 | // Ensure there is not a run away recursive copy 2853 | if (currentDepth >= 255) 2854 | return; 2855 | currentDepth++; 2856 | yield mkdirP(destDir); 2857 | const files = yield ioUtil.readdir(sourceDir); 2858 | for (const fileName of files) { 2859 | const srcFile = `${sourceDir}/${fileName}`; 2860 | const destFile = `${destDir}/${fileName}`; 2861 | const srcFileStat = yield ioUtil.lstat(srcFile); 2862 | if (srcFileStat.isDirectory()) { 2863 | // Recurse 2864 | yield cpDirRecursive(srcFile, destFile, currentDepth, force); 2865 | } 2866 | else { 2867 | yield copyFile(srcFile, destFile, force); 2868 | } 2869 | } 2870 | // Change the mode for the newly created directory 2871 | yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode); 2872 | }); 2873 | } 2874 | // Buffered file copy 2875 | function copyFile(srcFile, destFile, force) { 2876 | return __awaiter(this, void 0, void 0, function* () { 2877 | if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) { 2878 | // unlink/re-link it 2879 | try { 2880 | yield ioUtil.lstat(destFile); 2881 | yield ioUtil.unlink(destFile); 2882 | } 2883 | catch (e) { 2884 | // Try to override file permission 2885 | if (e.code === 'EPERM') { 2886 | yield ioUtil.chmod(destFile, '0666'); 2887 | yield ioUtil.unlink(destFile); 2888 | } 2889 | // other errors = it doesn't exist, no work to do 2890 | } 2891 | // Copy over symlink 2892 | const symlinkFull = yield ioUtil.readlink(srcFile); 2893 | yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null); 2894 | } 2895 | else if (!(yield ioUtil.exists(destFile)) || force) { 2896 | yield ioUtil.copyFile(srcFile, destFile); 2897 | } 2898 | }); 2899 | } 2900 | //# sourceMappingURL=io.js.map 2901 | 2902 | /***/ }), 2903 | 2904 | /***/ 294: 2905 | /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { 2906 | 2907 | module.exports = __nccwpck_require__(219); 2908 | 2909 | 2910 | /***/ }), 2911 | 2912 | /***/ 219: 2913 | /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2914 | 2915 | "use strict"; 2916 | 2917 | 2918 | var net = __nccwpck_require__(808); 2919 | var tls = __nccwpck_require__(404); 2920 | var http = __nccwpck_require__(685); 2921 | var https = __nccwpck_require__(687); 2922 | var events = __nccwpck_require__(361); 2923 | var assert = __nccwpck_require__(491); 2924 | var util = __nccwpck_require__(837); 2925 | 2926 | 2927 | exports.httpOverHttp = httpOverHttp; 2928 | exports.httpsOverHttp = httpsOverHttp; 2929 | exports.httpOverHttps = httpOverHttps; 2930 | exports.httpsOverHttps = httpsOverHttps; 2931 | 2932 | 2933 | function httpOverHttp(options) { 2934 | var agent = new TunnelingAgent(options); 2935 | agent.request = http.request; 2936 | return agent; 2937 | } 2938 | 2939 | function httpsOverHttp(options) { 2940 | var agent = new TunnelingAgent(options); 2941 | agent.request = http.request; 2942 | agent.createSocket = createSecureSocket; 2943 | agent.defaultPort = 443; 2944 | return agent; 2945 | } 2946 | 2947 | function httpOverHttps(options) { 2948 | var agent = new TunnelingAgent(options); 2949 | agent.request = https.request; 2950 | return agent; 2951 | } 2952 | 2953 | function httpsOverHttps(options) { 2954 | var agent = new TunnelingAgent(options); 2955 | agent.request = https.request; 2956 | agent.createSocket = createSecureSocket; 2957 | agent.defaultPort = 443; 2958 | return agent; 2959 | } 2960 | 2961 | 2962 | function TunnelingAgent(options) { 2963 | var self = this; 2964 | self.options = options || {}; 2965 | self.proxyOptions = self.options.proxy || {}; 2966 | self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; 2967 | self.requests = []; 2968 | self.sockets = []; 2969 | 2970 | self.on('free', function onFree(socket, host, port, localAddress) { 2971 | var options = toOptions(host, port, localAddress); 2972 | for (var i = 0, len = self.requests.length; i < len; ++i) { 2973 | var pending = self.requests[i]; 2974 | if (pending.host === options.host && pending.port === options.port) { 2975 | // Detect the request to connect same origin server, 2976 | // reuse the connection. 2977 | self.requests.splice(i, 1); 2978 | pending.request.onSocket(socket); 2979 | return; 2980 | } 2981 | } 2982 | socket.destroy(); 2983 | self.removeSocket(socket); 2984 | }); 2985 | } 2986 | util.inherits(TunnelingAgent, events.EventEmitter); 2987 | 2988 | TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { 2989 | var self = this; 2990 | var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); 2991 | 2992 | if (self.sockets.length >= this.maxSockets) { 2993 | // We are over limit so we'll add it to the queue. 2994 | self.requests.push(options); 2995 | return; 2996 | } 2997 | 2998 | // If we are under maxSockets create a new one. 2999 | self.createSocket(options, function(socket) { 3000 | socket.on('free', onFree); 3001 | socket.on('close', onCloseOrRemove); 3002 | socket.on('agentRemove', onCloseOrRemove); 3003 | req.onSocket(socket); 3004 | 3005 | function onFree() { 3006 | self.emit('free', socket, options); 3007 | } 3008 | 3009 | function onCloseOrRemove(err) { 3010 | self.removeSocket(socket); 3011 | socket.removeListener('free', onFree); 3012 | socket.removeListener('close', onCloseOrRemove); 3013 | socket.removeListener('agentRemove', onCloseOrRemove); 3014 | } 3015 | }); 3016 | }; 3017 | 3018 | TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { 3019 | var self = this; 3020 | var placeholder = {}; 3021 | self.sockets.push(placeholder); 3022 | 3023 | var connectOptions = mergeOptions({}, self.proxyOptions, { 3024 | method: 'CONNECT', 3025 | path: options.host + ':' + options.port, 3026 | agent: false, 3027 | headers: { 3028 | host: options.host + ':' + options.port 3029 | } 3030 | }); 3031 | if (options.localAddress) { 3032 | connectOptions.localAddress = options.localAddress; 3033 | } 3034 | if (connectOptions.proxyAuth) { 3035 | connectOptions.headers = connectOptions.headers || {}; 3036 | connectOptions.headers['Proxy-Authorization'] = 'Basic ' + 3037 | new Buffer(connectOptions.proxyAuth).toString('base64'); 3038 | } 3039 | 3040 | debug('making CONNECT request'); 3041 | var connectReq = self.request(connectOptions); 3042 | connectReq.useChunkedEncodingByDefault = false; // for v0.6 3043 | connectReq.once('response', onResponse); // for v0.6 3044 | connectReq.once('upgrade', onUpgrade); // for v0.6 3045 | connectReq.once('connect', onConnect); // for v0.7 or later 3046 | connectReq.once('error', onError); 3047 | connectReq.end(); 3048 | 3049 | function onResponse(res) { 3050 | // Very hacky. This is necessary to avoid http-parser leaks. 3051 | res.upgrade = true; 3052 | } 3053 | 3054 | function onUpgrade(res, socket, head) { 3055 | // Hacky. 3056 | process.nextTick(function() { 3057 | onConnect(res, socket, head); 3058 | }); 3059 | } 3060 | 3061 | function onConnect(res, socket, head) { 3062 | connectReq.removeAllListeners(); 3063 | socket.removeAllListeners(); 3064 | 3065 | if (res.statusCode !== 200) { 3066 | debug('tunneling socket could not be established, statusCode=%d', 3067 | res.statusCode); 3068 | socket.destroy(); 3069 | var error = new Error('tunneling socket could not be established, ' + 3070 | 'statusCode=' + res.statusCode); 3071 | error.code = 'ECONNRESET'; 3072 | options.request.emit('error', error); 3073 | self.removeSocket(placeholder); 3074 | return; 3075 | } 3076 | if (head.length > 0) { 3077 | debug('got illegal response body from proxy'); 3078 | socket.destroy(); 3079 | var error = new Error('got illegal response body from proxy'); 3080 | error.code = 'ECONNRESET'; 3081 | options.request.emit('error', error); 3082 | self.removeSocket(placeholder); 3083 | return; 3084 | } 3085 | debug('tunneling connection has established'); 3086 | self.sockets[self.sockets.indexOf(placeholder)] = socket; 3087 | return cb(socket); 3088 | } 3089 | 3090 | function onError(cause) { 3091 | connectReq.removeAllListeners(); 3092 | 3093 | debug('tunneling socket could not be established, cause=%s\n', 3094 | cause.message, cause.stack); 3095 | var error = new Error('tunneling socket could not be established, ' + 3096 | 'cause=' + cause.message); 3097 | error.code = 'ECONNRESET'; 3098 | options.request.emit('error', error); 3099 | self.removeSocket(placeholder); 3100 | } 3101 | }; 3102 | 3103 | TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { 3104 | var pos = this.sockets.indexOf(socket) 3105 | if (pos === -1) { 3106 | return; 3107 | } 3108 | this.sockets.splice(pos, 1); 3109 | 3110 | var pending = this.requests.shift(); 3111 | if (pending) { 3112 | // If we have pending requests and a socket gets closed a new one 3113 | // needs to be created to take over in the pool for the one that closed. 3114 | this.createSocket(pending, function(socket) { 3115 | pending.request.onSocket(socket); 3116 | }); 3117 | } 3118 | }; 3119 | 3120 | function createSecureSocket(options, cb) { 3121 | var self = this; 3122 | TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { 3123 | var hostHeader = options.request.getHeader('host'); 3124 | var tlsOptions = mergeOptions({}, self.options, { 3125 | socket: socket, 3126 | servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host 3127 | }); 3128 | 3129 | // 0 is dummy port for v0.6 3130 | var secureSocket = tls.connect(0, tlsOptions); 3131 | self.sockets[self.sockets.indexOf(socket)] = secureSocket; 3132 | cb(secureSocket); 3133 | }); 3134 | } 3135 | 3136 | 3137 | function toOptions(host, port, localAddress) { 3138 | if (typeof host === 'string') { // since v0.10 3139 | return { 3140 | host: host, 3141 | port: port, 3142 | localAddress: localAddress 3143 | }; 3144 | } 3145 | return host; // for v0.11 or later 3146 | } 3147 | 3148 | function mergeOptions(target) { 3149 | for (var i = 1, len = arguments.length; i < len; ++i) { 3150 | var overrides = arguments[i]; 3151 | if (typeof overrides === 'object') { 3152 | var keys = Object.keys(overrides); 3153 | for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { 3154 | var k = keys[j]; 3155 | if (overrides[k] !== undefined) { 3156 | target[k] = overrides[k]; 3157 | } 3158 | } 3159 | } 3160 | } 3161 | return target; 3162 | } 3163 | 3164 | 3165 | var debug; 3166 | if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { 3167 | debug = function() { 3168 | var args = Array.prototype.slice.call(arguments); 3169 | if (typeof args[0] === 'string') { 3170 | args[0] = 'TUNNEL: ' + args[0]; 3171 | } else { 3172 | args.unshift('TUNNEL:'); 3173 | } 3174 | console.error.apply(console, args); 3175 | } 3176 | } else { 3177 | debug = function() {}; 3178 | } 3179 | exports.debug = debug; // for test 3180 | 3181 | 3182 | /***/ }), 3183 | 3184 | /***/ 491: 3185 | /***/ ((module) => { 3186 | 3187 | "use strict"; 3188 | module.exports = require("assert"); 3189 | 3190 | /***/ }), 3191 | 3192 | /***/ 81: 3193 | /***/ ((module) => { 3194 | 3195 | "use strict"; 3196 | module.exports = require("child_process"); 3197 | 3198 | /***/ }), 3199 | 3200 | /***/ 361: 3201 | /***/ ((module) => { 3202 | 3203 | "use strict"; 3204 | module.exports = require("events"); 3205 | 3206 | /***/ }), 3207 | 3208 | /***/ 147: 3209 | /***/ ((module) => { 3210 | 3211 | "use strict"; 3212 | module.exports = require("fs"); 3213 | 3214 | /***/ }), 3215 | 3216 | /***/ 685: 3217 | /***/ ((module) => { 3218 | 3219 | "use strict"; 3220 | module.exports = require("http"); 3221 | 3222 | /***/ }), 3223 | 3224 | /***/ 687: 3225 | /***/ ((module) => { 3226 | 3227 | "use strict"; 3228 | module.exports = require("https"); 3229 | 3230 | /***/ }), 3231 | 3232 | /***/ 808: 3233 | /***/ ((module) => { 3234 | 3235 | "use strict"; 3236 | module.exports = require("net"); 3237 | 3238 | /***/ }), 3239 | 3240 | /***/ 37: 3241 | /***/ ((module) => { 3242 | 3243 | "use strict"; 3244 | module.exports = require("os"); 3245 | 3246 | /***/ }), 3247 | 3248 | /***/ 17: 3249 | /***/ ((module) => { 3250 | 3251 | "use strict"; 3252 | module.exports = require("path"); 3253 | 3254 | /***/ }), 3255 | 3256 | /***/ 576: 3257 | /***/ ((module) => { 3258 | 3259 | "use strict"; 3260 | module.exports = require("string_decoder"); 3261 | 3262 | /***/ }), 3263 | 3264 | /***/ 512: 3265 | /***/ ((module) => { 3266 | 3267 | "use strict"; 3268 | module.exports = require("timers"); 3269 | 3270 | /***/ }), 3271 | 3272 | /***/ 404: 3273 | /***/ ((module) => { 3274 | 3275 | "use strict"; 3276 | module.exports = require("tls"); 3277 | 3278 | /***/ }), 3279 | 3280 | /***/ 837: 3281 | /***/ ((module) => { 3282 | 3283 | "use strict"; 3284 | module.exports = require("util"); 3285 | 3286 | /***/ }) 3287 | 3288 | /******/ }); 3289 | /************************************************************************/ 3290 | /******/ // The module cache 3291 | /******/ var __webpack_module_cache__ = {}; 3292 | /******/ 3293 | /******/ // The require function 3294 | /******/ function __nccwpck_require__(moduleId) { 3295 | /******/ // Check if module is in cache 3296 | /******/ var cachedModule = __webpack_module_cache__[moduleId]; 3297 | /******/ if (cachedModule !== undefined) { 3298 | /******/ return cachedModule.exports; 3299 | /******/ } 3300 | /******/ // Create a new module (and put it into the cache) 3301 | /******/ var module = __webpack_module_cache__[moduleId] = { 3302 | /******/ // no module.id needed 3303 | /******/ // no module.loaded needed 3304 | /******/ exports: {} 3305 | /******/ }; 3306 | /******/ 3307 | /******/ // Execute the module function 3308 | /******/ var threw = true; 3309 | /******/ try { 3310 | /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__); 3311 | /******/ threw = false; 3312 | /******/ } finally { 3313 | /******/ if(threw) delete __webpack_module_cache__[moduleId]; 3314 | /******/ } 3315 | /******/ 3316 | /******/ // Return the exports of the module 3317 | /******/ return module.exports; 3318 | /******/ } 3319 | /******/ 3320 | /************************************************************************/ 3321 | /******/ /* webpack/runtime/compat */ 3322 | /******/ 3323 | /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; 3324 | /******/ 3325 | /************************************************************************/ 3326 | var __webpack_exports__ = {}; 3327 | // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 3328 | (() => { 3329 | const core = __nccwpck_require__(186); 3330 | const exec = __nccwpck_require__(514); 3331 | 3332 | async function run() { 3333 | try { 3334 | if ( 3335 | core.getInput("browserstack-upload").toLowerCase() === "true" && 3336 | (!core.getInput("browserstack-username") || !core.getInput("browserstack-access-key")) 3337 | ) { 3338 | throw new Error("Browserstack username or access key missing."); 3339 | } 3340 | process.env.INCREMENT_BUILD_NUMBER = core.getInput("increment-build-number"); 3341 | process.env.TESTFLIGHT_UPLOAD = core.getInput("upload-to-testflight"); 3342 | process.env.PROJECT_PATH = core.getInput("project-path"); 3343 | process.env.TEAM_ID = core.getInput("team-id"); 3344 | process.env.TEAM_NAME = core.getInput("team-name"); 3345 | process.env.WORKSPACE_PATH = core.getInput("workspace-path"); 3346 | process.env.EXPORT_METHOD = core.getInput("export-method"); 3347 | process.env.CONFIGURATION = core.getInput("configuration"); 3348 | process.env.OUTPUT_PATH = core.getInput("output-path"); 3349 | process.env.SCHEME = core.getInput("scheme"); 3350 | process.env.BROWSERSTACK_UPLOAD = core.getInput("browserstack-upload"); 3351 | process.env.BROWSERSTACK_USERNAME = core.getInput("browserstack-username"); 3352 | process.env.BROWSERSTACK_ACCESS_KEY = core.getInput("browserstack-access-key"); 3353 | process.env.BUILD_PODS = core.getInput("build-pods"); 3354 | process.env.PODS_PATH = core.getInput("pods-path"); 3355 | process.env.MATCH_PASSWORD = core.getInput("match-password"); 3356 | process.env.MATCH_GIT_URL = core.getInput("match-git-url"); 3357 | process.env.MATCH_GIT_BASIC_AUTHORIZATION = core.getInput("match-git-basic-authorization"); 3358 | process.env.MATCH_BUILD_TYPE = core.getInput("match-build-type"); 3359 | process.env.APPLE_KEY_ID = core.getInput("apple-key-id"); 3360 | process.env.APPLE_KEY_ISSUER_ID = core.getInput("apple-key-issuer-id"); 3361 | process.env.APPLE_KEY_CONTENT = core.getInput("apple-key-content"); 3362 | process.env.FASTLANE_VERSION = core.getInput("fastlane-version"); 3363 | process.env.FASTLANE_ENV = core.getInput("fastlane-env"); 3364 | process.env.IOS_APP_ID = core.getInput("ios-app-id"); 3365 | await exec.exec(`bash ${__dirname}/../build.sh`); 3366 | } catch (error) { 3367 | core.setFailed(error.message); 3368 | } 3369 | } 3370 | 3371 | run(); 3372 | 3373 | })(); 3374 | 3375 | module.exports = __webpack_exports__; 3376 | /******/ })() 3377 | ; --------------------------------------------------------------------------------