mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-06-07 16:56:12 +02:00
Initial impl
This commit is contained in:
parent
f4a8f7a81b
commit
bc921df1ec
11 changed files with 1296 additions and 1055 deletions
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) {
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue