-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--watch #30
--watch #30
Conversation
@jnewland this is awesome! I'm very excited to add this...i'll review this week. |
@cplee right on no rush at all! 👍I'm happy to iterate on this PR in any way too: don't be shy with your review. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good...couple minor changes please.
for folderWatcher.IsRunning() { | ||
for changes := range folderWatcher.ChangeDetails() { | ||
log.Debugf("%s", changes.String()) | ||
fn() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the fn
parameter for this watchAndRun
function should be fn func() error
and then use the return of that function to be the return for watchAndRun
to avoid swallowing the error.
@@ -52,34 +56,91 @@ func newRunCommand(runnerConfig *actions.RunnerConfig) func(*cobra.Command, []st | |||
runnerConfig.EventName = args[0] | |||
} | |||
|
|||
// create the runner | |||
runner, err := actions.NewRunner(runnerConfig) | |||
err := parseAndRun(cmd, runnerConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about moving this below as an else { }
after the if watch {}
?
- Replace `go-git` with a forked version in `go.mod` Signed-off-by: Bo-Yi.Wu <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Reviewed-on: https://gitea.com/gitea/act/pulls/30 Reviewed-by: Lunny Xiao <[email protected]> Co-authored-by: Bo-Yi.Wu <[email protected]> Co-committed-by: Bo-Yi.Wu <[email protected]>
This PR adds support for a
--watch
or-w
flag toact
. When provided,act
doesn't exit after the first run, but instead runs a goroutine that watches the local directory for changes (ignoring files in.gitignore
). When changes are detected, the workflow file is parsed and run again.A redux of #29, this time without conflicts.