-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Disabling Source Type Override Parameters #64
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,8 @@ async function waitForBuildEndTime(sdk, { id, logs }, nextToken) { | |
|
||
function githubInputs() { | ||
const projectName = core.getInput("project-name", { required: true }); | ||
const disableSourceOverride = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit - For consistency, could you either update this new line to use core.getInput("disable-source-override", {required: false}) === "true", or remove all other { required: false }s from githubInputs()? |
||
core.getInput("disable-source-override") === "true"; | ||
const { owner, repo } = github.context.repo; | ||
const { payload } = github.context; | ||
// The github.context.sha is evaluated on import. | ||
|
@@ -140,6 +142,7 @@ function githubInputs() { | |
sourceVersion, | ||
buildspecOverride, | ||
envPassthrough, | ||
disableSourceOverride, | ||
}; | ||
} | ||
|
||
|
@@ -151,10 +154,15 @@ function inputs2Parameters(inputs) { | |
sourceVersion, | ||
buildspecOverride, | ||
envPassthrough = [], | ||
disableSourceOverride, | ||
} = inputs; | ||
|
||
const sourceTypeOverride = "GITHUB"; | ||
const sourceLocationOverride = `https://github.com/${owner}/${repo}.git`; | ||
const sourceOverride = !disableSourceOverride | ||
? { | ||
sourceTypeOverride: "GITHUB", | ||
sourceLocationOverride: `https://github.com/${owner}/${repo}.git`, | ||
} | ||
: {}; | ||
|
||
const environmentVariablesOverride = Object.entries(process.env) | ||
.filter( | ||
|
@@ -167,8 +175,7 @@ function inputs2Parameters(inputs) { | |
return { | ||
projectName, | ||
sourceVersion, | ||
sourceTypeOverride, | ||
sourceLocationOverride, | ||
...sourceOverride, | ||
buildspecOverride, | ||
environmentVariablesOverride, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66968,6 +66968,51 @@ module.exports = /******/ (function (modules, runtime) { | |
/***/ | ||
}, | ||
|
||
/***/ 2102: /***/ function (__unusedmodule, exports, __webpack_require__) { | ||
"use strict"; | ||
|
||
// For internal use, subject to change. | ||
var __importStar = | ||
(this && this.__importStar) || | ||
function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) | ||
for (var k in mod) | ||
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// We use any as a valid input type | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const fs = __importStar(__webpack_require__(5747)); | ||
const os = __importStar(__webpack_require__(2087)); | ||
const utils_1 = __webpack_require__(5082); | ||
function issueCommand(command, message) { | ||
const filePath = process.env[`GITHUB_${command}`]; | ||
if (!filePath) { | ||
throw new Error( | ||
`Unable to find environment variable for file command ${command}` | ||
); | ||
} | ||
if (!fs.existsSync(filePath)) { | ||
throw new Error(`Missing file at path: ${filePath}`); | ||
} | ||
fs.appendFileSync( | ||
filePath, | ||
`${utils_1.toCommandValue(message)}${os.EOL}`, | ||
{ | ||
encoding: "utf8", | ||
} | ||
); | ||
} | ||
exports.issueCommand = issueCommand; | ||
//# sourceMappingURL=file-command.js.map | ||
|
||
/***/ | ||
}, | ||
|
||
/***/ 2106: /***/ function (module, __unusedexports, __webpack_require__) { | ||
__webpack_require__(3234); | ||
var AWS = __webpack_require__(395); | ||
|
@@ -118516,6 +118561,7 @@ module.exports = /******/ (function (modules, runtime) { | |
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const os = __importStar(__webpack_require__(2087)); | ||
const utils_1 = __webpack_require__(5082); | ||
/** | ||
* Commands | ||
* | ||
|
@@ -118569,13 +118615,15 @@ module.exports = /******/ (function (modules, runtime) { | |
} | ||
} | ||
function escapeData(s) { | ||
return (s || "") | ||
return utils_1 | ||
.toCommandValue(s) | ||
.replace(/%/g, "%25") | ||
.replace(/\r/g, "%0D") | ||
.replace(/\n/g, "%0A"); | ||
} | ||
function escapeProperty(s) { | ||
return (s || "") | ||
return utils_1 | ||
.toCommandValue(s) | ||
.replace(/%/g, "%25") | ||
.replace(/\r/g, "%0D") | ||
.replace(/\n/g, "%0A") | ||
|
@@ -123249,6 +123297,14 @@ module.exports = /******/ (function (modules, runtime) { | |
res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec( | ||
str | ||
); | ||
if (!res) { | ||
res = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec( | ||
str | ||
); | ||
if (res) { | ||
res.pop(); // drop last quote | ||
} | ||
} | ||
|
||
if (res) { | ||
res = /charset=(.*)/i.exec(res.pop()); | ||
|
@@ -124366,7 +124422,7 @@ module.exports = /******/ (function (modules, runtime) { | |
case "error": | ||
reject( | ||
new FetchError( | ||
`redirect mode is set to error: ${request.url}`, | ||
`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, | ||
"no-redirect" | ||
) | ||
); | ||
|
@@ -124414,6 +124470,7 @@ module.exports = /******/ (function (modules, runtime) { | |
body: request.body, | ||
signal: request.signal, | ||
timeout: request.timeout, | ||
size: request.size, | ||
}; | ||
|
||
// HTTP-redirect fetch step 9 | ||
|
@@ -147209,6 +147266,30 @@ module.exports = /******/ (function (modules, runtime) { | |
/***/ | ||
}, | ||
|
||
/***/ 5082: /***/ function (__unusedmodule, exports) { | ||
"use strict"; | ||
|
||
// We use any as a valid input type | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Sanitizes an input into a string so it can be passed into issueCommand safely | ||
* @param input input to sanitize into a string | ||
*/ | ||
function toCommandValue(input) { | ||
if (input === null || input === undefined) { | ||
return ""; | ||
} else if (typeof input === "string" || input instanceof String) { | ||
return input; | ||
} | ||
return JSON.stringify(input); | ||
} | ||
exports.toCommandValue = toCommandValue; | ||
//# sourceMappingURL=utils.js.map | ||
|
||
/***/ | ||
}, | ||
|
||
/***/ 5089: /***/ function (module) { | ||
module.exports = { | ||
version: "2.0", | ||
|
@@ -197787,6 +197868,8 @@ module.exports = /******/ (function (modules, runtime) { | |
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const command_1 = __webpack_require__(4431); | ||
const file_command_1 = __webpack_require__(2102); | ||
const utils_1 = __webpack_require__(5082); | ||
const os = __importStar(__webpack_require__(2087)); | ||
const path = __importStar(__webpack_require__(5622)); | ||
/** | ||
|
@@ -197809,11 +197892,20 @@ module.exports = /******/ (function (modules, runtime) { | |
/** | ||
* Sets env variable for this action and future actions in the job | ||
* @param name the name of the variable to set | ||
* @param val the value of the variable | ||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function exportVariable(name, val) { | ||
process.env[name] = val; | ||
command_1.issueCommand("set-env", { name }, val); | ||
const convertedVal = utils_1.toCommandValue(val); | ||
process.env[name] = convertedVal; | ||
const filePath = process.env["GITHUB_ENV"] || ""; | ||
if (filePath) { | ||
const delimiter = "_GitHubActionsFileCommandDelimeter_"; | ||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; | ||
file_command_1.issueCommand("ENV", commandValue); | ||
} else { | ||
command_1.issueCommand("set-env", { name }, convertedVal); | ||
} | ||
} | ||
exports.exportVariable = exportVariable; | ||
/** | ||
|
@@ -197829,7 +197921,12 @@ module.exports = /******/ (function (modules, runtime) { | |
* @param inputPath | ||
*/ | ||
function addPath(inputPath) { | ||
command_1.issueCommand("add-path", {}, inputPath); | ||
const filePath = process.env["GITHUB_PATH"] || ""; | ||
if (filePath) { | ||
file_command_1.issueCommand("PATH", inputPath); | ||
} else { | ||
command_1.issueCommand("add-path", {}, inputPath); | ||
} | ||
process.env[ | ||
"PATH" | ||
] = `${inputPath}${path.delimiter}${process.env["PATH"]}`; | ||
|
@@ -197855,12 +197952,22 @@ module.exports = /******/ (function (modules, runtime) { | |
* Sets the value of an output. | ||
* | ||
* @param name name of the output to set | ||
* @param value value to store | ||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function setOutput(name, value) { | ||
command_1.issueCommand("set-output", { name }, value); | ||
} | ||
exports.setOutput = setOutput; | ||
/** | ||
* Enables or disables the echoing of commands into stdout for the rest of the step. | ||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. | ||
* | ||
*/ | ||
function setCommandEcho(enabled) { | ||
command_1.issue("echo", enabled ? "on" : "off"); | ||
} | ||
exports.setCommandEcho = setCommandEcho; | ||
//----------------------------------------------------------------------- | ||
// Results | ||
//----------------------------------------------------------------------- | ||
|
@@ -197894,18 +198001,24 @@ module.exports = /******/ (function (modules, runtime) { | |
exports.debug = debug; | ||
/** | ||
* Adds an error issue | ||
* @param message error issue message | ||
* @param message error issue message. Errors will be converted to string via toString() | ||
*/ | ||
function error(message) { | ||
command_1.issue("error", message); | ||
command_1.issue( | ||
"error", | ||
message instanceof Error ? message.toString() : message | ||
); | ||
} | ||
exports.error = error; | ||
/** | ||
* Adds an warning issue | ||
* @param message warning issue message | ||
* @param message warning issue message. Errors will be converted to string via toString() | ||
*/ | ||
function warning(message) { | ||
command_1.issue("warning", message); | ||
command_1.issue( | ||
"warning", | ||
message instanceof Error ? message.toString() : message | ||
); | ||
} | ||
exports.warning = warning; | ||
/** | ||
|
@@ -197962,8 +198075,9 @@ module.exports = /******/ (function (modules, runtime) { | |
* Saves state for current action, the state can only be retrieved by this action's post job execution. | ||
* | ||
* @param name name of the state to store | ||
* @param value value to store | ||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function saveState(name, value) { | ||
command_1.issueCommand("save-state", { name }, value); | ||
} | ||
|
@@ -221066,11 +221180,6 @@ module.exports = /******/ (function (modules, runtime) { | |
bundlesize: [ | ||
{ path: "./dist/octokit-rest.min.js.gz", maxSize: "33 kB" }, | ||
], | ||
_resolved: | ||
"https://registry.npmjs.org/@octokit/rest/-/rest-16.43.1.tgz", | ||
_integrity: | ||
"sha512-gfFKwRT/wFxq5qlNjnW2dh+qh74XgTQ2B179UX5K1HYCluioWj8Ndbgqw2PVqa1NnVJkGHp2ovMpVn/DImlmkw==", | ||
_from: "@octokit/[email protected]", | ||
}; | ||
|
||
/***/ | ||
|
@@ -295206,6 +295315,8 @@ module.exports = /******/ (function (modules, runtime) { | |
|
||
function githubInputs() { | ||
const projectName = core.getInput("project-name", { required: true }); | ||
const disableSourceOverride = | ||
core.getInput("disable-source-override") === "true"; | ||
const { owner, repo } = github.context.repo; | ||
const { payload } = github.context; | ||
// The github.context.sha is evaluated on import. | ||
|
@@ -295236,6 +295347,7 @@ module.exports = /******/ (function (modules, runtime) { | |
sourceVersion, | ||
buildspecOverride, | ||
envPassthrough, | ||
disableSourceOverride, | ||
}; | ||
} | ||
|
||
|
@@ -295247,10 +295359,15 @@ module.exports = /******/ (function (modules, runtime) { | |
sourceVersion, | ||
buildspecOverride, | ||
envPassthrough = [], | ||
disableSourceOverride, | ||
} = inputs; | ||
|
||
const sourceTypeOverride = "GITHUB"; | ||
const sourceLocationOverride = `https://github.com/${owner}/${repo}.git`; | ||
const sourceOverride = !disableSourceOverride | ||
? { | ||
sourceTypeOverride: "GITHUB", | ||
sourceLocationOverride: `https://github.com/${owner}/${repo}.git`, | ||
} | ||
: {}; | ||
|
||
const environmentVariablesOverride = Object.entries(process.env) | ||
.filter( | ||
|
@@ -295263,8 +295380,7 @@ module.exports = /******/ (function (modules, runtime) { | |
return { | ||
projectName, | ||
sourceVersion, | ||
sourceTypeOverride, | ||
sourceLocationOverride, | ||
...sourceOverride, | ||
buildspecOverride, | ||
environmentVariablesOverride, | ||
}; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"if you want to" - typo