-
-
Notifications
You must be signed in to change notification settings - Fork 14
Add workflow input handling and YAML support #37
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
base: main
Are you sure you want to change the base?
Conversation
Updated `GitHubActionsVS.csproj` to include new source files: `StringHelpers.cs`, `YamlHelpers.cs`, `InputMetadata.cs`, and `Workflow.cs`. Added `YamlDotNet` package reference. Introduced `WorkflowInputsDialog.xaml` for user input and modified `GHActionsToolWindow` to integrate this dialog. Added utility classes for Base64 checking and YAML alias resolution. Enhanced input metadata representation and refactored code for improved readability and maintainability.
|
This PR introduces one improvement based on Issue #23 Improvements
Helpers
Notes User Experience Example YAML Tested |
|
thanks @MDrakakis -- acknowledging this PR -- gonna find some time to look at this and run it a bit. THanks for the screenshots of the change too. |
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.
Pull Request Overview
This PR adds comprehensive workflow input handling and YAML support to the GitHub Actions Visual Studio extension. It introduces functionality to parse workflow YAML files, extract input definitions, and present a dialog for users to provide input values when running workflows.
Key changes:
- Added YAML parsing capabilities with YamlDotNet package integration
- Created workflow input dialog UI for user interaction when dispatching workflows
- Implemented helper classes for Base64 detection and YAML node manipulation
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/GitHubActionsVS.csproj |
Added new source files and YamlDotNet package reference |
src/UserControls/WorkflowInputsDialog.xaml |
Dialog UI for collecting workflow input values from users |
src/UserControls/WorkflowInputsDialog.xaml.cs |
Dialog logic with dynamic control creation and validation |
src/ToolWindows/GHActionsToolWindow.xaml.cs |
Enhanced workflow dispatch with input parsing and dialog integration |
src/ToolWindows/GHActionsToolWindow.xaml |
Removed themed TreeView styles |
src/Models/Workflow.cs |
YAML deserialization models for workflow structure |
src/Models/InputMetadata.cs |
Input metadata representation and conversion logic |
src/Helpers/YamlHelpers.cs |
YAML node manipulation utilities |
src/Helpers/StringHelpers.cs |
Base64 validation utility |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| foreach (char c in text) | ||
| { | ||
| if (!(char.IsDigit(c) || c == '-' || c == '.')) | ||
| return false; | ||
| } | ||
| return true; |
Copilot
AI
Oct 2, 2025
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 numeric validation logic has several issues: it allows multiple decimal points (e.g., '1.2.3'), multiple minus signs anywhere in the string (e.g., '1-2-3'), and minus signs in invalid positions (e.g., '12-'). Consider using decimal.TryParse() or implementing proper position-based validation.
| foreach (char c in text) | |
| { | |
| if (!(char.IsDigit(c) || c == '-' || c == '.')) | |
| return false; | |
| } | |
| return true; | |
| decimal dummy; | |
| return decimal.TryParse(text, out dummy); |
| } | ||
| else if (control is ComboBox cb) | ||
| { | ||
| string chosen = null; |
Copilot
AI
Oct 2, 2025
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 variable 'chosen' should be initialized as 'string.Empty' instead of 'null' to avoid potential null reference issues and maintain consistency with the rest of the codebase that uses string.Empty for empty strings.
| string chosen = null; | |
| string chosen = string.Empty; |
| var workflowContent = contents.FirstOrDefault()?.Content; | ||
|
|
||
| if (!string.IsNullOrEmpty(workflowContent) && StringHelpers.IsBase64(workflowContent)) | ||
| workflowContent = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(workflowContent)); |
Copilot
AI
Oct 2, 2025
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 Base64 decoding is not wrapped in a try-catch block. If the Base64 validation is incorrect or the string contains invalid Base64 characters, Convert.FromBase64String() will throw an exception, causing the workflow dispatch to fail.
| workflowContent = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(workflowContent)); | |
| { | |
| try | |
| { | |
| workflowContent = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(workflowContent)); | |
| } | |
| catch (FormatException ex) | |
| { | |
| await _pane.WriteLineAsync($"[{DateTime.UtcNow:o}] Error decoding workflow file content: {ex.Message}"); | |
| workflowContent = null; | |
| } | |
| } |
| @@ -0,0 +1,27 @@ | |||
| namespace GitHubActionsVS.Helpers | |||
| { | |||
| internal class StringHelpers | |||
Copilot
AI
Oct 2, 2025
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 StringHelpers class should be declared as 'static' since all its methods are static. This prevents instantiation and makes the intent clearer.
| internal class StringHelpers | |
| internal static class StringHelpers |
| } | ||
| } | ||
|
|
||
| value = null!; |
Copilot
AI
Oct 2, 2025
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.
[nitpick] Using 'null!' (null-forgiving operator) here is misleading since the method is designed to return false when no value is found. Consider using 'value = default!' or restructuring to avoid the null-forgiving operator.
| value = null!; | |
| value = default; |


Updated
GitHubActionsVS.csprojto include new source files:StringHelpers.cs,YamlHelpers.cs,InputMetadata.cs, andWorkflow.cs. AddedYamlDotNetpackage reference. IntroducedWorkflowInputsDialog.xamlfor user input and modifiedGHActionsToolWindowto integrate this dialog. Added utility classes for Base64 checking and YAML alias resolution. Enhanced input metadata representation and refactored code for improved readability and maintainability.