Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Add event, schedule and manual workflow triggers

eb07ff5696e0d83201215966e3ea1e6a24467581 · Keenan Nemetz · 8d ago · parent 1cde8b9e

Add event, schedule and manual workflow triggers

Workflows can now react to change requests, issues, comments, cron
schedules and manual runs, and a push trigger can filter by the paths it
changed. Branch and tag patterns gain ! exclusion.

Event runs are pinned with a JSON payload and the runner exposes it as
VOLE_EVENT, VOLE_EVENT_ACTION and VOLE_EVENT_PATH. Change-request runs
check out the base tip and carry the head and changed files, so an event
never executes an unapproved contributor commit.

Workflow dispatch resolves typed inputs and is available from the
workflows page and `vole workflow dispatch`. Deduplication now includes
an occurrence so the same commit can run for a later event or schedule
slot while a push remains idempotent.

Part of: #138

client/remote.go +36

@@ -6,6 +6,7 @@ import (
6 6 "net/url"
7 7 "os"
8 8 "os/exec"
9 "sort"
9 10 "strings"
10 11 )
11 12
@@ -303,3 +304,38 @@ func MergeChange(gitDir, remote, id string) (string, error) {
303 304 }
304 305 return strings.TrimSpace(out), nil
305 306 }
307
308 // DispatchWorkflow queues a manual run of a workflow that declares
309 // workflow_dispatch. It is a write to the instance's queue, so the CLI asks over
310 // the same key-authenticated channel it pushes with; the server resolves the
311 // workflow, validates the inputs and checks the maintainer capability.
312 func DispatchWorkflow(gitDir, remote, workflow, ref string, inputs map[string]string) (string, error) {
313 host, port, path, err := SSHTarget(gitDir, remote)
314 if err != nil {
315 return "", err
316 }
317 if RepoNameFromPath(path) == "" {
318 return "", fmt.Errorf("%s does not name a repository", remote)
319 }
320 if ref == "" {
321 ref = "-"
322 }
323 args := []string{"vole-workflow-dispatch", path, workflow, ref}
324 names := make([]string, 0, len(inputs))
325 for name := range inputs {
326 names = append(names, name)
327 }
328 sort.Strings(names)
329 for _, name := range names {
330 args = append(args, name+"="+inputs[name])
331 }
332 quoted := make([]string, len(args))
333 for i, arg := range args {
334 quoted[i] = quoteSSHArg(arg)
335 }
336 out, err := RunSSH(host, port, strings.Join(quoted, " "))
337 if err != nil {
338 return "", err
339 }
340 return strings.TrimSpace(out), nil
341 }