Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces post-action hook functionality to the Runner, allowing additional processing steps after each action execution. Key changes include adding hook support via the WithHook option, updating the Runner’s error and done channel handling, and extending test coverage to verify hook behavior and error propagation.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| runner.go | Integrated hook execution logic and refactored error handling using atomic pointers and done channel. |
| runner_test.go | Added tests to verify runner shutdown, error propagation, and hook functionality. |
Comments suppressed due to low confidence (1)
runner_test.go:57
- In TestRunner_Error, the test cancels the context but does not wait for the runner to finish (e.g. by reading from Done()) or assert the error via r.Error(). Consider waiting for the runner to complete and then asserting the error to verify proper error propagation.
cancel()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Post-Action Hook Support
Summary
This PR adds functionality to execute a hook/callback after each action in the Runner. This enhancement allows for post-action processing, enabling better control and monitoring of action execution.
Changes
WithHookDetails
The implementation allows hooks to be registered during Runner creation that will execute after each action completion. The hooks receive the context and can return an error to affect execution flow.
Key Features
Test Coverage
Added comprehensive tests that verify:
Example Usage
Testing
All tests pass, including new test cases covering hook functionality: