import { parseCSV } from '@google-github-actions/actions-utils' ; param s returns export class Reference { readonly output : string ; readonly project : string ; readonly name : string ; readonly version : string ; constructor ( s ) { const sParts = s . split ( ':' ) ; if ( sParts . length < 2 ) { throw new TypeError ( `Invalid reference "${ s }" - missing destination` ) ; } this . output = sParts [ 0 ] . trim ( ) ; const ref = sParts . slice ( 1 ) . join ( ':' ) ; const refParts = ref . split ( '/' ) ; switch ( refParts . length ) { case 6 : { this . project = refParts [ 1 ] ; this . name = refParts [ 3 ] ; this . version = refParts [ 5 ] ; break ; } case 4 : { this . project = refParts [ 1 ] ; this . name = refParts [ 3 ] ; this . version = 'latest' ; break ; } case 3 : { this . project = refParts [ 0 ] ; this . name = refParts [ 1 ] ; this . version = refParts [ 2 ] ; break ; } case 2 : { this . project = refParts [ 0 ] ; this . name = refParts [ 1 ] ; this . version = 'latest' ; break ; } default : { throw new TypeError ( `Invalid reference "${ s }" - unknown format` ) ; } } } returns public selfLink ( ) { return `projects/${ this . project }/secrets/${ this . name }/versions/${ this . version }` ; } } param input returns export function parseSecretsRefs ( input ) { const secrets = [ ] ; for ( const line of input . split ( /\r|\n/ ) ) { const pieces = parseCSV ( line ) ; for ( const piece of pieces ) { secrets . push ( new Reference ( piece ) ) ; } } return secrets ; }