Skip to content
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

Merged
merged 2 commits into from
Feb 13, 2019
Merged

--watch #30

merged 2 commits into from
Feb 13, 2019

Conversation

jnewland
Copy link
Contributor

This PR adds support for a --watch or -w flag to act. 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.

@cplee
Copy link
Contributor

cplee commented Feb 11, 2019

@jnewland this is awesome! I'm very excited to add this...i'll review this week.

@jnewland
Copy link
Contributor Author

@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. 😄

Copy link
Contributor

@cplee cplee left a 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()
Copy link
Contributor

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)
Copy link
Contributor

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 {}?

@cplee cplee merged commit e27d5fa into nektos:master Feb 13, 2019
makrsmark pushed a commit to makrsmark/act that referenced this pull request Aug 3, 2023
- 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants