-
Notifications
You must be signed in to change notification settings - Fork 2
feat: make cli available as gh action #16
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
also generate basic metrics for consumption
5a4e42c to
abe72ba
Compare
abe72ba to
3521da4
Compare
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.
mrge found 9 issues across 7 files. View them in mrge.io
| echo "### Overall Statistics" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Total Tests:** \`$total\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Pass Rate:** \`$pass_percentage%\`" > $GITHUB_STEP_SUMMARY |
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.
Using > operator instead of >> will overwrite the entire job summary instead of appending to it, losing previously written content.
|
|
||
| func main() { | ||
| fmt.Print(strings.TrimLeft(banner, "\n")) | ||
| time.Sleep(1 * time.Microsecond) |
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.
Unexplained sleep added with no clear purpose. The 1 microsecond duration is so small it's functionally insignificant and likely won't have the intended effect.
| Args: cobra.ExactArgs(0), | ||
| Run: func(cmd *cobra.Command, args []string) { | ||
| if err := client.SendReports(fernUrl, projectName, filePattern, tags, verbose); err != nil { | ||
| metricsPath := "test/static/fern_test_run_metrics.txt" |
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.
Hardcoded file path could cause issues in different environments or when the code is run from different directories
| Args: cobra.ExactArgs(0), | ||
| Run: func(cmd *cobra.Command, args []string) { | ||
| if err := client.SendReports(fernUrl, projectName, filePattern, tags, verbose); err != nil { | ||
| metricsPath := "test/static/fern_test_run_metrics.txt" |
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.
No directory existence check before writing to the metrics file
| Run: func(cmd *cobra.Command, args []string) { | ||
| if err := client.SendReports(fernUrl, projectName, filePattern, tags, verbose); err != nil { | ||
| metricsPath := "test/static/fern_test_run_metrics.txt" | ||
| if err := client.SendReports(fernUrl, projectName, filePattern, tags, verbose, metricsPath); err != nil { |
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.
New parameter added without making it configurable via CLI flags
| log.Default().Printf("Total tests failed: %d\n", failed) | ||
| log.Default().Printf("Total tests skipped: %d\n", skipped) | ||
|
|
||
| if file, err := os.Create(metricsFilePath); err != nil { |
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.
File handling doesn't properly check WriteString errors or use defer for closing
| - name: Run Tests | ||
| ... | ||
| - name: Report tests to fern | ||
| uses: guidewire-oss/fern-junit-client@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.
Using 'latest' tag for GitHub Actions can lead to unexpected behavior when breaking changes are introduced
| url: 'https://fern.mydomain.com' | ||
| file-pattern: 'tests/*.xml' | ||
| project-name: 'My Service' | ||
| tags: 'cpu,' |
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.
Trailing comma in tags list looks like a typo and could be confusing to users
| with: | ||
| url: 'https://fern.mydomain.com' | ||
| file-pattern: 'tests/*.xml' | ||
| project-name: 'My Service' |
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.
Project identification appears inconsistent between CLI and GitHub Action examples
also generate basic metrics for consumption