Merge pull request #1353 from crazy-max/summary-secret-keys

only print secret keys in build summary output
This commit is contained in:
CrazyMax authored and GitHub committed 2025-04-09 18:48:07 +02:00
commit 88844b95d8
5 files changed
+44 -29

No files matched your search

Generated Vendored
+1 -1
View File
@@ -99,5 +99,5 @@ const a=s(57147);const l=s(22037);const c=s(71017);const p=s(6113);const u={fs:a
* @license [MIT]{@link https://github.com/archiverjs/node-zip-stream/blob/master/LICENSE}
* @copyright (c) 2014 Chris Talkington, contributors.
*/
var a=s(73837).inherits;var l=s(25445).ZipArchiveOutputStream;var c=s(25445).ZipArchiveEntry;var p=s(82072);var u=r.exports=function(r){if(!(this instanceof u)){return new u(r)}r=this.options=r||{};r.zlib=r.zlib||{};l.call(this,r);if(typeof r.level==="number"&&r.level>=0){r.zlib.level=r.level;delete r.level}if(!r.forceZip64&&typeof r.zlib.level==="number"&&r.zlib.level===0){r.store=true}r.namePrependSlash=r.namePrependSlash||false;if(r.comment&&r.comment.length>0){this.setComment(r.comment)}};a(u,l);u.prototype._normalizeFileData=function(r){r=p.defaults(r,{type:"file",name:null,namePrependSlash:this.options.namePrependSlash,linkname:null,date:null,mode:null,store:this.options.store,comment:""});var i=r.type==="directory";var s=r.type==="symlink";if(r.name){r.name=p.sanitizePath(r.name);if(!s&&r.name.slice(-1)==="/"){i=true;r.type="directory"}else if(i){r.name+="/"}}if(i||s){r.store=true}r.date=p.dateify(r.date);return r};u.prototype.entry=function(r,i,s){if(typeof s!=="function"){s=this._emitErrorCallback.bind(this)}i=this._normalizeFileData(i);if(i.type!=="file"&&i.type!=="directory"&&i.type!=="symlink"){s(new Error(i.type+" entries not currently supported"));return}if(typeof i.name!=="string"||i.name.length===0){s(new Error("entry name must be a non-empty string value"));return}if(i.type==="symlink"&&typeof i.linkname!=="string"){s(new Error("entry linkname must be a non-empty string value when type equals symlink"));return}var a=new c(i.name);a.setTime(i.date,this.options.forceLocalTime);if(i.namePrependSlash){a.setName(i.name,true)}if(i.store){a.setMethod(0)}if(i.comment.length>0){a.setComment(i.comment)}if(i.type==="symlink"&&typeof i.mode!=="number"){i.mode=40960}if(typeof i.mode==="number"){if(i.type==="symlink"){i.mode|=40960}a.setUnixMode(i.mode)}if(i.type==="symlink"&&typeof i.linkname==="string"){r=Buffer.from(i.linkname)}return l.prototype.entry.call(this,a,r,s)};u.prototype.finalize=function(){this.finish()}},98954:function(r,i,s){"use strict";var a=this&&this.__createBinding||(Object.create?function(r,i,s,a){if(a===undefined)a=s;var l=Object.getOwnPropertyDescriptor(i,s);if(!l||("get"in l?!i.__esModule:l.writable||l.configurable)){l={enumerable:true,get:function(){return i[s]}}}Object.defineProperty(r,a,l)}:function(r,i,s,a){if(a===undefined)a=s;r[a]=i[s]});var l=this&&this.__setModuleDefault||(Object.create?function(r,i){Object.defineProperty(r,"default",{enumerable:true,value:i})}:function(r,i){r["default"]=i});var c=this&&this.__importStar||function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var s in r)if(s!=="default"&&Object.prototype.hasOwnProperty.call(r,s))a(i,r,s);l(i,r);return i};var p=this&&this.__awaiter||function(r,i,s,a){function adopt(r){return r instanceof s?r:new s((function(i){i(r)}))}return new(s||(s=Promise))((function(s,l){function fulfilled(r){try{step(a.next(r))}catch(r){l(r)}}function rejected(r){try{step(a["throw"](r))}catch(r){l(r)}}function step(r){r.done?s(r.value):adopt(r.value).then(fulfilled,rejected)}step((a=a.apply(r,i||[])).next())}))};Object.defineProperty(i,"__esModule",{value:true});i.getArgs=i.sanitizeInputs=i.getInputs=void 0;const u=c(s(42186));const d=c(s(97492));const h=s(57622);const A=s(54051);const g=s(6276);const y=s(28662);function getInputs(){return p(this,void 0,void 0,(function*(){return{"add-hosts":y.Util.getInputList("add-hosts"),allow:y.Util.getInputList("allow"),annotations:y.Util.getInputList("annotations",{ignoreComma:true}),attests:y.Util.getInputList("attests",{ignoreComma:true}),"build-args":y.Util.getInputList("build-args",{ignoreComma:true}),"build-contexts":y.Util.getInputList("build-contexts",{ignoreComma:true}),builder:u.getInput("builder"),"cache-from":y.Util.getInputList("cache-from",{ignoreComma:true}),"cache-to":y.Util.getInputList("cache-to",{ignoreComma:true}),call:u.getInput("call"),"cgroup-parent":u.getInput("cgroup-parent"),context:u.getInput("context")||A.Context.gitContext(),file:u.getInput("file"),labels:y.Util.getInputList("labels",{ignoreComma:true}),load:u.getBooleanInput("load"),network:u.getInput("network"),"no-cache":u.getBooleanInput("no-cache"),"no-cache-filters":y.Util.getInputList("no-cache-filters"),outputs:y.Util.getInputList("outputs",{ignoreComma:true,quote:false}),platforms:y.Util.getInputList("platforms"),provenance:h.Build.getProvenanceInput("provenance"),pull:u.getBooleanInput("pull"),push:u.getBooleanInput("push"),sbom:u.getInput("sbom"),secrets:y.Util.getInputList("secrets",{ignoreComma:true}),"secret-envs":y.Util.getInputList("secret-envs"),"secret-files":y.Util.getInputList("secret-files",{ignoreComma:true}),"shm-size":u.getInput("shm-size"),ssh:y.Util.getInputList("ssh"),tags:y.Util.getInputList("tags"),target:u.getInput("target"),ulimit:y.Util.getInputList("ulimit",{ignoreComma:true}),"github-token":u.getInput("github-token")}}))}i.getInputs=getInputs;function sanitizeInputs(r){const i={};for(const s of Object.keys(r)){if(s==="github-token"){continue}const a=r[s];if(typeof a==="booLine truncated
var a=s(73837).inherits;var l=s(25445).ZipArchiveOutputStream;var c=s(25445).ZipArchiveEntry;var p=s(82072);var u=r.exports=function(r){if(!(this instanceof u)){return new u(r)}r=this.options=r||{};r.zlib=r.zlib||{};l.call(this,r);if(typeof r.level==="number"&&r.level>=0){r.zlib.level=r.level;delete r.level}if(!r.forceZip64&&typeof r.zlib.level==="number"&&r.zlib.level===0){r.store=true}r.namePrependSlash=r.namePrependSlash||false;if(r.comment&&r.comment.length>0){this.setComment(r.comment)}};a(u,l);u.prototype._normalizeFileData=function(r){r=p.defaults(r,{type:"file",name:null,namePrependSlash:this.options.namePrependSlash,linkname:null,date:null,mode:null,store:this.options.store,comment:""});var i=r.type==="directory";var s=r.type==="symlink";if(r.name){r.name=p.sanitizePath(r.name);if(!s&&r.name.slice(-1)==="/"){i=true;r.type="directory"}else if(i){r.name+="/"}}if(i||s){r.store=true}r.date=p.dateify(r.date);return r};u.prototype.entry=function(r,i,s){if(typeof s!=="function"){s=this._emitErrorCallback.bind(this)}i=this._normalizeFileData(i);if(i.type!=="file"&&i.type!=="directory"&&i.type!=="symlink"){s(new Error(i.type+" entries not currently supported"));return}if(typeof i.name!=="string"||i.name.length===0){s(new Error("entry name must be a non-empty string value"));return}if(i.type==="symlink"&&typeof i.linkname!=="string"){s(new Error("entry linkname must be a non-empty string value when type equals symlink"));return}var a=new c(i.name);a.setTime(i.date,this.options.forceLocalTime);if(i.namePrependSlash){a.setName(i.name,true)}if(i.store){a.setMethod(0)}if(i.comment.length>0){a.setComment(i.comment)}if(i.type==="symlink"&&typeof i.mode!=="number"){i.mode=40960}if(typeof i.mode==="number"){if(i.type==="symlink"){i.mode|=40960}a.setUnixMode(i.mode)}if(i.type==="symlink"&&typeof i.linkname==="string"){r=Buffer.from(i.linkname)}return l.prototype.entry.call(this,a,r,s)};u.prototype.finalize=function(){this.finish()}},98954:function(r,i,s){"use strict";var a=this&&this.__createBinding||(Object.create?function(r,i,s,a){if(a===undefined)a=s;var l=Object.getOwnPropertyDescriptor(i,s);if(!l||("get"in l?!i.__esModule:l.writable||l.configurable)){l={enumerable:true,get:function(){return i[s]}}}Object.defineProperty(r,a,l)}:function(r,i,s,a){if(a===undefined)a=s;r[a]=i[s]});var l=this&&this.__setModuleDefault||(Object.create?function(r,i){Object.defineProperty(r,"default",{enumerable:true,value:i})}:function(r,i){r["default"]=i});var c=this&&this.__importStar||function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var s in r)if(s!=="default"&&Object.prototype.hasOwnProperty.call(r,s))a(i,r,s);l(i,r);return i};var p=this&&this.__awaiter||function(r,i,s,a){function adopt(r){return r instanceof s?r:new s((function(i){i(r)}))}return new(s||(s=Promise))((function(s,l){function fulfilled(r){try{step(a.next(r))}catch(r){l(r)}}function rejected(r){try{step(a["throw"](r))}catch(r){l(r)}}function step(r){r.done?s(r.value):adopt(r.value).then(fulfilled,rejected)}step((a=a.apply(r,i||[])).next())}))};Object.defineProperty(i,"__esModule",{value:true});i.getArgs=i.getInputs=void 0;const u=c(s(42186));const d=c(s(97492));const h=s(57622);const A=s(54051);const g=s(6276);const y=s(28662);function getInputs(){return p(this,void 0,void 0,(function*(){return{"add-hosts":y.Util.getInputList("add-hosts"),allow:y.Util.getInputList("allow"),annotations:y.Util.getInputList("annotations",{ignoreComma:true}),attests:y.Util.getInputList("attests",{ignoreComma:true}),"build-args":y.Util.getInputList("build-args",{ignoreComma:true}),"build-contexts":y.Util.getInputList("build-contexts",{ignoreComma:true}),builder:u.getInput("builder"),"cache-from":y.Util.getInputList("cache-from",{ignoreComma:true}),"cache-to":y.Util.getInputList("cache-to",{ignoreComma:true}),call:u.getInput("call"),"cgroup-parent":u.getInput("cgroup-parent"),context:u.getInput("context")||A.Context.gitContext(),file:u.getInput("file"),labels:y.Util.getInputList("labels",{ignoreComma:true}),load:u.getBooleanInput("load"),network:u.getInput("network"),"no-cache":u.getBooleanInput("no-cache"),"no-cache-filters":y.Util.getInputList("no-cache-filters"),outputs:y.Util.getInputList("outputs",{ignoreComma:true,quote:false}),platforms:y.Util.getInputList("platforms"),provenance:h.Build.getProvenanceInput("provenance"),pull:u.getBooleanInput("pull"),push:u.getBooleanInput("push"),sbom:u.getInput("sbom"),secrets:y.Util.getInputList("secrets",{ignoreComma:true}),"secret-envs":y.Util.getInputList("secret-envs"),"secret-files":y.Util.getInputList("secret-files",{ignoreComma:true}),"shm-size":u.getInput("shm-size"),ssh:y.Util.getInputList("ssh"),tags:y.Util.getInputList("tags"),target:u.getInput("target"),ulimit:y.Util.getInputList("ulimit",{ignoreComma:true}),"github-token":u.getInput("github-token")}}))}i.getInputs=getInputs;function getArgs(r,i){return p(this,void 0,void 0,(function*(){const s=d.compile(r.context)({defaultContext:A.Context.gitContext()});return[...yield Line truncated
//# sourceMappingURL=index.js.map
Generated Vendored
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"index.js","names":["__createBinding","this","Object","create","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","get","defineProperty","__exportStar","exports","p","prototype","hasOwnProperty","call","value","client_1","__webpack_require__","client","DefaultArtifactClient","Timestamp","runtime_1","runtime_2","runtime_3","runtime_4","runtime_5","runtime_6","runtime_7","Timestamp$Type","MessageType","constructor","super","no","name","kind","T","now","msg","ms","Date","seconds","PbLong","from","Math","floor","toString","nanos","toDate","message","toNumber","ceil","fromDate","date","getTime","internalJsonWrite","options","parse","Error","z","nanosStr","substring","toISOString","replace","internalJsonRead","json","target","typeofJsonValue","matches","match","Number","isNaN","globalThis","parseInt","repeat","length","MESSAGE_TYPE","reflectionMergePartial","internalBinaryRead","reader","end","pos","fieldNo","wireType","tag","int64","int32","u","readUnknownField","typeName","d","skip","UnknownFieldHandler","onRead","internalBinaryWrite","writer","WireType","Varint","writeUnknownFields","onWrite","BytesValue","StringValue","BoolValue","UInt32Value","Int32Value","UInt64Value","Int64Value","FloatValue","DoubleValue","DoubleValue$Type","refJsonWriter","scalar","refJsonReader","double","Bit64","FloatValue$Type","float","Bit32","Int64Value$Type","ScalarType","INT64","LongType","STRING","UInt64Value$Type","UINT64","uint64","Int32Value$Type","UInt32Value$Type","uint32","BoolValue$Type","bool","StringValue$Type","string","LengthDelimited","BytesValue$Type","Uint8Array","bytes","ArtifactService","DeleteArtifactResponse","DeleteArtifactRequest","GetSignedArtifactURLResponse","GetSignedArtifactURLRequest","ListArtifactsResponse_MonolithArtifact","ListArtifactsResponse","ListArtifactsRequest","FinalizeArtifactResponse","FinalizeArtifactRequest","CreateArtifactResponse","CreateArtifactRequest","FinalizeMigratedArtifactResponse","FinalizeMigratedArtifactRequest","MigrateArtifactResponse","MigrateArtifactRequest","runtime_rpc_1","wrappers_1","wrappers_2","timestamp_1","MigrateArtifactRequest$Type","workflowRunBackendId","expiresAt","fork","join","MigrateArtifactResponse$Type","ok","signedUploadUrl","FinalizeMigratedArtifactRequest$Type","size","FinalizeMigratedArtifactResponse$Type","artifactId","CreateArtifactRequest$Type","workflowJobRunBackendId","version","CreateArtifactResponse$Type","FinalizeArtifactRequest$Type","hash","FinalizeArtifactResponse$Type","ListArtifactsRequest$Type","nameFilter","idFilter","ListArtifactsResponse$Type","artifacts","push","i","ListArtifactsResponse_MonolithArtifact$Type","databaseId","createdAt","digest","GetSignedArtifactURLRequest$Type","GetSignedArtifactURLResponse$Type","signedUrl","DeleteArtifactRequest$Type","DeleteArtifactResponse$Type","ServiceType","I","O","ArtifactServiceClientProtobuf","ArtifactServiceClientJSON","artifact_1","rpc","CreateArtifact","bind","FinalizeArtifact","ListArtifacts","GetSignedArtifactURL","DeleteArtifact","request","data","toJson","useProtoFieldName","emitDefaultValues","promise","then","fromJson","ignoreUnknownFields","toBinary","fromBinary","__awaiter","thisArg","_arguments","P","generator","adopt","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","apply","__rest","s","t","indexOf","getOwnPropertySymbols","propertyIsEnumerable","core_1","config_1","upload_artifact_1","download_artifact_1","delete_artifact_1","get_artifact_1","list_artifacts_1","errors_1","uploadArtifact","files","rootDirectory","isGhes","GHESNotSupportedError","error","warning","downloadArtifact","findBy","repositoryOwner","repositoryName","token","downloadOptions","downloadArtifactPublic","downloadArtifactInternal","listArtifacts","workflowRunId","listArtifactsPublic","latest","listArtifactsInternal","getArtifact","artifactName","getArtifactPublic","getArtifactInternal","deleteArtifact","deleteArtifactPublic","deleteArtifactInternal","github_1","user_agent_1","retry_options_1","utils_1","plugin_request_log_1","plugin_retry_1","artifact_twirp_client_1","util_1","generated_1","_a","retryOpts","requestOpts","getRetryOptions","defaults","opts","log","userAgent","getUserAgentString","previews","retry","github","getOctokit","requestLog","getArtifactResp","deleteArtifactResp","rest","actions","owner","repo","artifact_id","artifact","id","status","InvalidResponseError","headers","artifactClient","internalArtifactTwirpClient","getBackendIdsFromToken","listReq","listRes","ArtifactNotFoundError","sort","a","b","debug","req","res","info","__setModuleDefault","v","__importStar","mod","__importDefault","default","streamExtractExternal","promises_1","crypto","stream","core","httpClient","unzip_stream_1","scrubQueryParameters","url","parsed","URL","search","exists","path","access","code","streamExtract","directory","retryCount","setTimeout","HttpClient","response","statusCode","statusMessLine truncated
{"version":3,"file":"index.js","names":["__createBinding","this","Object","create","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","get","defineProperty","__exportStar","exports","p","prototype","hasOwnProperty","call","value","client_1","__webpack_require__","client","DefaultArtifactClient","Timestamp","runtime_1","runtime_2","runtime_3","runtime_4","runtime_5","runtime_6","runtime_7","Timestamp$Type","MessageType","constructor","super","no","name","kind","T","now","msg","ms","Date","seconds","PbLong","from","Math","floor","toString","nanos","toDate","message","toNumber","ceil","fromDate","date","getTime","internalJsonWrite","options","parse","Error","z","nanosStr","substring","toISOString","replace","internalJsonRead","json","target","typeofJsonValue","matches","match","Number","isNaN","globalThis","parseInt","repeat","length","MESSAGE_TYPE","reflectionMergePartial","internalBinaryRead","reader","end","pos","fieldNo","wireType","tag","int64","int32","u","readUnknownField","typeName","d","skip","UnknownFieldHandler","onRead","internalBinaryWrite","writer","WireType","Varint","writeUnknownFields","onWrite","BytesValue","StringValue","BoolValue","UInt32Value","Int32Value","UInt64Value","Int64Value","FloatValue","DoubleValue","DoubleValue$Type","refJsonWriter","scalar","refJsonReader","double","Bit64","FloatValue$Type","float","Bit32","Int64Value$Type","ScalarType","INT64","LongType","STRING","UInt64Value$Type","UINT64","uint64","Int32Value$Type","UInt32Value$Type","uint32","BoolValue$Type","bool","StringValue$Type","string","LengthDelimited","BytesValue$Type","Uint8Array","bytes","ArtifactService","DeleteArtifactResponse","DeleteArtifactRequest","GetSignedArtifactURLResponse","GetSignedArtifactURLRequest","ListArtifactsResponse_MonolithArtifact","ListArtifactsResponse","ListArtifactsRequest","FinalizeArtifactResponse","FinalizeArtifactRequest","CreateArtifactResponse","CreateArtifactRequest","FinalizeMigratedArtifactResponse","FinalizeMigratedArtifactRequest","MigrateArtifactResponse","MigrateArtifactRequest","runtime_rpc_1","wrappers_1","wrappers_2","timestamp_1","MigrateArtifactRequest$Type","workflowRunBackendId","expiresAt","fork","join","MigrateArtifactResponse$Type","ok","signedUploadUrl","FinalizeMigratedArtifactRequest$Type","size","FinalizeMigratedArtifactResponse$Type","artifactId","CreateArtifactRequest$Type","workflowJobRunBackendId","version","CreateArtifactResponse$Type","FinalizeArtifactRequest$Type","hash","FinalizeArtifactResponse$Type","ListArtifactsRequest$Type","nameFilter","idFilter","ListArtifactsResponse$Type","artifacts","push","i","ListArtifactsResponse_MonolithArtifact$Type","databaseId","createdAt","digest","GetSignedArtifactURLRequest$Type","GetSignedArtifactURLResponse$Type","signedUrl","DeleteArtifactRequest$Type","DeleteArtifactResponse$Type","ServiceType","I","O","ArtifactServiceClientProtobuf","ArtifactServiceClientJSON","artifact_1","rpc","CreateArtifact","bind","FinalizeArtifact","ListArtifacts","GetSignedArtifactURL","DeleteArtifact","request","data","toJson","useProtoFieldName","emitDefaultValues","promise","then","fromJson","ignoreUnknownFields","toBinary","fromBinary","__awaiter","thisArg","_arguments","P","generator","adopt","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","apply","__rest","s","t","indexOf","getOwnPropertySymbols","propertyIsEnumerable","core_1","config_1","upload_artifact_1","download_artifact_1","delete_artifact_1","get_artifact_1","list_artifacts_1","errors_1","uploadArtifact","files","rootDirectory","isGhes","GHESNotSupportedError","error","warning","downloadArtifact","findBy","repositoryOwner","repositoryName","token","downloadOptions","downloadArtifactPublic","downloadArtifactInternal","listArtifacts","workflowRunId","listArtifactsPublic","latest","listArtifactsInternal","getArtifact","artifactName","getArtifactPublic","getArtifactInternal","deleteArtifact","deleteArtifactPublic","deleteArtifactInternal","github_1","user_agent_1","retry_options_1","utils_1","plugin_request_log_1","plugin_retry_1","artifact_twirp_client_1","util_1","generated_1","_a","retryOpts","requestOpts","getRetryOptions","defaults","opts","log","userAgent","getUserAgentString","previews","retry","github","getOctokit","requestLog","getArtifactResp","deleteArtifactResp","rest","actions","owner","repo","artifact_id","artifact","id","status","InvalidResponseError","headers","artifactClient","internalArtifactTwirpClient","getBackendIdsFromToken","listReq","listRes","ArtifactNotFoundError","sort","a","b","debug","req","res","info","__setModuleDefault","v","__importStar","mod","__importDefault","default","streamExtractExternal","promises_1","crypto","stream","core","httpClient","unzip_stream_1","scrubQueryParameters","url","parsed","URL","search","exists","path","access","code","streamExtract","directory","retryCount","setTimeout","HttpClient","response","statusCode","statusMessLine truncated
-19
View File
@@ -81,25 +81,6 @@ export async function getInputs(): Promise<Inputs> {
};
}
export function sanitizeInputs(inputs: Inputs) {
const res = {};
for (const key of Object.keys(inputs)) {
if (key === 'github-token') {
continue;
}
const value: string | string[] | boolean = inputs[key];
if (typeof value === 'boolean' && value === false) {
continue;
} else if (Array.isArray(value) && value.length === 0) {
continue;
} else if (!value) {
continue;
}
res[key] = value;
}
return res;
}
export async function getArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<string>> {
const context = handlebars.compile(inputs.context)({
defaultContext: Context.gitContext()
+2 -2
View File
@@ -24,8 +24,8 @@ actionsToolkit.run(
async () => {
const startedTime = new Date();
const inputs: context.Inputs = await context.getInputs();
stateHelper.setSummaryInputs(inputs);
core.debug(`inputs: ${JSON.stringify(inputs)}`);
stateHelper.setInputs(inputs);
const toolkit = new Toolkit();
@@ -216,7 +216,7 @@ actionsToolkit.run(
await GitHub.writeBuildSummary({
exportRes: exportRes,
uploadRes: uploadRes,
inputs: stateHelper.inputs
inputs: stateHelper.summaryInputs
});
} catch (e) {
core.warning(e.message);
+40 -6
View File
@@ -1,20 +1,18 @@
import * as core from '@actions/core';
import {Inputs, sanitizeInputs} from './context';
import {Build} from '@docker/actions-toolkit/lib/buildx/build';
import {Inputs} from './context';
export const tmpDir = process.env['STATE_tmpDir'] || '';
export const inputs = process.env['STATE_inputs'] ? JSON.parse(process.env['STATE_inputs']) : undefined;
export const buildRef = process.env['STATE_buildRef'] || '';
export const isSummarySupported = !!process.env['STATE_isSummarySupported'];
export const summaryInputs = process.env['STATE_summaryInputs'] ? JSON.parse(process.env['STATE_summaryInputs']) : undefined;
export function setTmpDir(tmpDir: string) {
core.saveState('tmpDir', tmpDir);
}
export function setInputs(inputs: Inputs) {
core.saveState('inputs', JSON.stringify(sanitizeInputs(inputs)));
}
export function setBuildRef(buildRef: string) {
core.saveState('buildRef', buildRef);
}
@@ -22,3 +20,39 @@ export function setBuildRef(buildRef: string) {
export function setSummarySupported() {
core.saveState('isSummarySupported', 'true');
}
export function setSummaryInputs(inputs: Inputs) {
const res = {};
for (const key of Object.keys(inputs)) {
if (key === 'github-token') {
continue;
}
const value: string | string[] | boolean = inputs[key];
if (typeof value === 'boolean' && !value) {
continue;
} else if (Array.isArray(value)) {
if (value.length === 0) {
continue;
} else if (key === 'secrets' && value.length > 0) {
const secretKeys: string[] = [];
for (const secret of value) {
try {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [skey, _] = Build.parseSecretKvp(secret, true);
secretKeys.push(skey);
} catch (err) {
// ignore invalid secret
}
}
if (secretKeys.length > 0) {
res[key] = secretKeys;
}
continue;
}
} else if (!value) {
continue;
}
res[key] = value;
}
core.saveState('summaryInputs', JSON.stringify(res));
}