Skip to content

--watch#30

Merged
cplee merged 2 commits intonektos:masterfrom
urcomputeringpal:watch
Feb 13, 2019
Merged

--watch#30
cplee merged 2 commits intonektos:masterfrom
urcomputeringpal:watch

Conversation

@jnewland
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread cmd/root.go
for folderWatcher.IsRunning() {
for changes := range folderWatcher.ChangeDetails() {
log.Debugf("%s", changes.String())
fn()
Copy link
Copy Markdown
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.

Comment thread cmd/root.go

// create the runner
runner, err := actions.NewRunner(runnerConfig)
err := parseAndRun(cmd, runnerConfig)
Copy link
Copy Markdown
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 <appleboy.tw@gmail.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/act/pulls/30
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
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