mirror of
				https://github.com/threeal/cmake-action.git
				synced 2025-11-04 13:53:41 +00:00 
			
		
		
		
	feat: parse quotation in build-args input
				
					
				
			Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
This commit is contained in:
		
							parent
							
								
									a2e5d22b54
								
							
						
					
					
						commit
						bc6eb9d372
					
				
							
								
								
									
										4
									
								
								dist/action.mjs
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								dist/action.mjs
									
									
									
										generated
									
									
										vendored
									
									
								
							@ -386,9 +386,7 @@ function getContext() {
 | 
			
		||||
        },
 | 
			
		||||
        build: {
 | 
			
		||||
            enabled: getInput("run-build") == "true",
 | 
			
		||||
            args: getInput("build-args")
 | 
			
		||||
                .split(/\s+/)
 | 
			
		||||
                .filter((arg) => arg != ""),
 | 
			
		||||
            args: shellQuoteExports.parse(getInput("build-args")).map((arg) => arg.toString()),
 | 
			
		||||
        },
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -132,11 +132,11 @@ describe("get action context", () => {
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      name: "with additional build arguments specified",
 | 
			
		||||
      inputs: { "build-args": "--target foo\n--parallel  8" },
 | 
			
		||||
      inputs: { "build-args": `--target foo\n--parallel  8 --foo "bar baz"` },
 | 
			
		||||
      expectedContext: {
 | 
			
		||||
        build: {
 | 
			
		||||
          enabled: false,
 | 
			
		||||
          args: ["--target", "foo", "--parallel", "8"],
 | 
			
		||||
          args: ["--target", "foo", "--parallel", "8", "--foo", "bar baz"],
 | 
			
		||||
        },
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
@ -153,7 +153,7 @@ describe("get action context", () => {
 | 
			
		||||
        options: `BUILD_TESTING=ON BUILD_EXAMPLES=ON\nBUILD_DOCS=ON FOO="BAR BAZ"`,
 | 
			
		||||
        args: `-Wdev -Wdeprecated\n--fresh --foo "bar baz"`,
 | 
			
		||||
        "run-build": "true",
 | 
			
		||||
        "build-args": "--target foo\n--parallel  8",
 | 
			
		||||
        "build-args": `--target foo\n--parallel  8 --foo "bar baz"`,
 | 
			
		||||
      },
 | 
			
		||||
      expectedContext: {
 | 
			
		||||
        sourceDir: "project",
 | 
			
		||||
@ -174,7 +174,7 @@ describe("get action context", () => {
 | 
			
		||||
        },
 | 
			
		||||
        build: {
 | 
			
		||||
          enabled: true,
 | 
			
		||||
          args: ["--target", "foo", "--parallel", "8"],
 | 
			
		||||
          args: ["--target", "foo", "--parallel", "8", "--foo", "bar baz"],
 | 
			
		||||
        },
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
@ -53,9 +53,7 @@ export function getContext(): Context {
 | 
			
		||||
    },
 | 
			
		||||
    build: {
 | 
			
		||||
      enabled: getInput("run-build") == "true",
 | 
			
		||||
      args: getInput("build-args")
 | 
			
		||||
        .split(/\s+/)
 | 
			
		||||
        .filter((arg) => arg != ""),
 | 
			
		||||
      args: parse(getInput("build-args")).map((arg) => arg.toString()),
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user