mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-09-16 12:42:22 +08:00
Initial impl
This commit is contained in:
40
src/execution.ts
Normal file
40
src/execution.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import * as exec from "@actions/exec";
|
||||
|
||||
|
||||
export async function execute(executable: string, root: string, argv: string[]): Promise<BuildResult> {
|
||||
|
||||
let publishing = false;
|
||||
let buildScanLink: any = null;
|
||||
|
||||
await exec.exec(executable, argv, {
|
||||
cwd: root,
|
||||
listeners: {
|
||||
stdline: (line: string) => {
|
||||
if (line.startsWith("Publishing build scan...")) {
|
||||
publishing = true;
|
||||
}
|
||||
if (publishing && line.length == 0) {
|
||||
publishing = false
|
||||
}
|
||||
if (publishing && line.startsWith("http")) {
|
||||
buildScanLink = line.trim();
|
||||
publishing = false
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (buildScanLink != null) {
|
||||
return new BuildResultImpl(buildScanLink.toString());
|
||||
}
|
||||
return new BuildResultImpl(null as unknown as string);
|
||||
}
|
||||
|
||||
export interface BuildResult {
|
||||
buildScanUrl: string
|
||||
}
|
||||
|
||||
class BuildResultImpl implements BuildResult {
|
||||
constructor(readonly buildScanUrl: string) {
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user