Demonstrations
Build Finished Alert
Play alert sound after a build has finished running
This directive is a simple example of how you can use the Github API to trigger a build and then wait for it to finish. Once the build has finished, you will be alerted that it has completed.
Directive
build the master branch and alert me when its done
Demonstration
Custom Tools
To use this directive, add the below custom tools to the Voqal Idle Mode prompt.
### alert_me
```yaml
type: function
function:
name: alert_me
description: Use this tool whenever the developer asks you to alert them.
exec:
command: |
Add-Type -TypeDefinition @"
using System.Media;
public class AudioAlert
{
public static void Play(string path)
{
using (SoundPlayer player = new SoundPlayer(path))
{
player.PlaySync();
}
}
}
"@
[AudioAlert]::Play("$[[project_home]]\.voqal\notifications\alert.wav")
type: powershell
```
### trigger_github_build
```yaml
type: function
function:
name: trigger_github_build
description: Use this tool whenever the developer asks you to trigger a github build. Do not guess branch. Ask if not given.
parameters:
type: object
properties:
branch:
type: string
description: The branch to build.
required:
- branch
exec:
command: gh workflow run build.yml --repo owner/repo --ref $[[branch]]
```
### wait_for_github_builds
```yaml
type: function
function:
name: wait_for_github_builds
description: Use this tool whenever the developer asks you to wait for github builds to finish.
exec:
command: |
Set-Location $[[project_home]]
Start-Sleep -Seconds 10
while ($true) {
$builds = gh run list --status=in_progress --json status
if (-not ($builds | ConvertFrom-Json | Where-Object { $_.status -eq "in_progress" })) {
break
}
Start-Sleep -Seconds 1
}
type: powershell
```
Example Response
### trigger_github_build
```json
{
"branch": "master"
}
```
### wait_for_github_builds
```json
{}
```
### alert_me
```json
{}
```