File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,6 +73,18 @@ describe('getInputList', () => {
7373 expect ( res ) . toEqual ( [ 'user/app:cache' , 'type=local,src=path/to/dir' ] ) ;
7474 } ) ;
7575
76+ it ( 'multiline and ignoring comment correctly' , async ( ) => {
77+ setInput ( 'labels' , 'foo=bar\nbar=qux#baz' ) ;
78+ const res = Util . getInputList ( 'labels' ) ;
79+ expect ( res ) . toEqual ( [ 'foo=bar' , 'bar=qux#baz' ] ) ;
80+ } ) ;
81+
82+ it ( 'multiline with comment' , async ( ) => {
83+ setInput ( 'labels' , 'foo=bar\nbar=qux#baz' ) ;
84+ const res = Util . getInputList ( 'labels' , { comment : '#' } ) ;
85+ expect ( res ) . toEqual ( [ 'foo=bar' , 'bar=qux' ] ) ;
86+ } ) ;
87+
7688 it ( 'different new lines and ignoring comma correctly' , async ( ) => {
7789 setInput ( 'cache-from' , 'user/app:cache\r\ntype=local,src=path/to/dir' ) ;
7890 const res = Util . getInputList ( 'cache-from' , { ignoreComma : true } ) ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {parse} from 'csv-parse/sync';
2121
2222export interface InputListOpts {
2323 ignoreComma ?: boolean ;
24+ comment ?: string ;
2425 quote ?: string | boolean | Buffer | null ;
2526}
2627
@@ -36,7 +37,7 @@ export class Util {
3637 const records = parse ( items , {
3738 columns : false ,
3839 relaxQuotes : true ,
39- comment : '#' ,
40+ comment : opts ?. comment ,
4041 relaxColumnCount : true ,
4142 skipEmptyLines : true ,
4243 quote : opts ?. quote
You can’t perform that action at this time.
0 commit comments