-
Notifications
You must be signed in to change notification settings - Fork 34
Add new 'test' command for single workflow local execution with act #820
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
Conversation
Co-authored-by: pelikhan <[email protected]>
pelikhan
left a comment
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.
- compile the agentic workflow with safe-outputs set to staged if any
cmd/gh-aw/main.go
Outdated
|
|
||
| // Add flags to test command | ||
| testCmd.Flags().StringP("event", "e", "workflow_dispatch", "Event type to simulate (workflow_dispatch, push, pull_request, etc.)") | ||
| testCmd.Flags().StringP("platform", "p", "", "Platform mapping for act (e.g., ubuntu-latest=catthehacker/ubuntu:act-latest)") |
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.
@copilot remove platform flag
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.
Done! Removed platform flag from test command. The flag is no longer available in the CLI interface. Commit: 81cb6fd
cmd/gh-aw/main.go
Outdated
| // Add flags to test command | ||
| testCmd.Flags().StringP("event", "e", "workflow_dispatch", "Event type to simulate (workflow_dispatch, push, pull_request, etc.)") | ||
| testCmd.Flags().StringP("platform", "p", "", "Platform mapping for act (e.g., ubuntu-latest=catthehacker/ubuntu:act-latest)") | ||
| testCmd.Flags().Bool("dry-run", false, "Dry run - show what would be executed without running") |
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.
@copilot remove dry-run flag
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.
Done! Removed dry-run flag from test command. The flag is no longer available in the CLI interface. Commit: 81cb6fd
… force staged mode Co-authored-by: pelikhan <[email protected]>
Done! Added SetForceStaged() method to the compiler and modified CompileWorkflowForTesting() to automatically set safe-outputs to staged mode when any safe-outputs configuration exists. This ensures local testing is safe. Commit: 81cb6fd Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: pelikhan <[email protected]>
pkg/cli/test.go
Outdated
| } | ||
|
|
||
| // Install act via GitHub CLI extension | ||
| fmt.Println(console.FormatProgressMessage("Installing act via GitHub CLI extension...")) |
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.
@copilot Ask user to install act extension and fail.
Provide instructions so that the user can copy/paste the command to install act.
Do not install act automatically.
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.
Updated the checkActInstalled function to fail when act is not installed and provide clear copy/paste installation instructions instead of attempting automatic installation. The function now displays both GitHub CLI extension installation command (gh extension install https://github.com/nektos/act) and manual installation URL. Commit: 4391e2c
…tructions Co-authored-by: pelikhan <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Untested but the need for a better dev loop is definitely something I would like to address. |
|
@copilot merge origin/main and fix tests |
…ged with env/github-token features
Completed! Successfully merged origin/main and resolved all merge conflicts. The SetForceStaged functionality for test command now works alongside the new env and github-token features from main. All tests pass and agent-finish validation completed successfully. Commit: e597d9d Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot run "gh-aw test dev" and report output |
Running The command correctly detected that the |
gh extension install https://github.com/nektos/act
|
Co-authored-by: pelikhan <[email protected]>
|
@colipot run test command for dev
|
…cks in workflow testing
This PR implements a new
testcommand that allows users to run a single agentic workflow locally using Docker and the nektos/act tool, addressing the need for local testing and development of workflows before deploying them to GitHub Actions.What's Changed
The new
testcommand provides a streamlined local testing solution with the following capabilities:acttool is available and provides clear installation instructions if needed (no automatic installation)Usage Examples
Implementation Details
pkg/cli/test.gofile for better organizationcheckActInstalled()function provides clear instructions for manual installation via GitHub CLI or direct downloadCompileWorkflowForTesting()function forces safe-outputs to staged mode usingSetForceStaged()compiler methodinstall-acttask usinggh extension install https://github.com/nektos/actand included it as dependency indeps-devTesting
TestWorkflowLocally()function signatureThe command provides a focused, safe approach to local workflow testing with clear user guidance for act installation, and now includes automated installation during development setup.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.