summaryrefslogtreecommitdiff
path: root/internal/run.go
blob: 417b81bf07829fdf24e3248ba25763333a363b33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package internal

func Run(configFile string) {
	config, err := newConfig(configFile)
	if err != nil {
		panic(err)
	}

	state, err := readState(config)
	if err != nil {
		notifyError(config, err)
	}

	state = execute(state, config)

	if err := state.persist(); err != nil {
		notifyError(config, err)
	}

	if subject, body, doNotify := state.report(); doNotify {
		notify(config, subject, body)
	}
}