Skip to content

feat: achieve feature parity with Node.js action#38

Closed
DerekRoberts wants to merge 9 commits intomainfrom
feat/feature-parity
Closed

feat: achieve feature parity with Node.js action#38
DerekRoberts wants to merge 9 commits intomainfrom
feat/feature-parity

Conversation

@DerekRoberts
Copy link
Member

Summary

This PR brings the Java action to full feature parity with the Node.js action, ensuring consistent functionality and user experience across both actions.

Changes

Input Validation (Pattern Parameters)

  • dir: ^[a-zA-Z0-9._/-]+$ - Validates directory paths
  • java-version: ^[0-9]+(\.[0-9]+)*$ - Validates semantic version format
  • java-cache: ^(maven|gradle)$ - Validates package manager
  • java-distribution: ^(temurin|corretto|openjdk|zulu)$ - Validates Java distribution
  • sonar_token: ^[a-zA-Z0-9]{20,}$ - Validates SonarCloud token format
  • diff_branch: ^[a-zA-Z0-9._/-]+$ - Validates branch names
  • repository: ^[a-zA-Z0-9-_]+/[a-zA-Z0-9-_]+$ - Validates org/repo format
  • branch: ^[a-zA-Z0-9._/-]*$ - Validates optional branch names

Enhanced Error Handling

  • Comprehensive troubleshooting steps for Java/Maven/Gradle issues
  • Debug information display including Java, Maven, and Gradle versions
  • Clear error messages with actionable steps
  • File listing to help diagnose missing files
  • Java-specific guidance for common build issues

Workspace Cleanup

  • File ownership reset to prevent permission issues
  • Consistent cleanup behavior matching Node.js action
  • Prevents Docker-related permission problems

Benefits

  • Consistent user experience across Node.js and Java actions
  • Better input validation prevents common configuration errors
  • Enhanced debugging with Java-specific troubleshooting
  • Improved reliability with proper workspace cleanup
  • Future-proof for v2 release alignment

Testing

The existing workflow will validate these changes:

  • Pattern validation will catch invalid inputs
  • Enhanced error handling will provide better debugging
  • Workspace cleanup will prevent permission issues

Related

  • Achieves feature parity with Node.js action
  • Prepares for v2 release alignment
  • Improves overall action reliability and user experience

- Add triggered output to action.yml for downstream workflow orchestration
- Update workflow with matrix testing for trigger behavior verification
- Add outputs section to README with practical examples
- Replace @main with @x.y.z to enforce proper versioning practices
- Use explicit == 'false' conditions for clearer intent
- Follow same patterns as Node.js action for consistency
- Use root directory (.) instead of specific frontend/backend dirs
- Replace complex Maven commands with simple version check
- Focus on testing trigger behavior rather than actual Maven builds
- Avoids dependency on specific project structure in test repo
- Remove complex matrix strategy and trigger verification
- Keep original simple workflow structure
- Just add basic check for triggered output
- Focus on core functionality without overengineering
- Check that triggered output exists and is not empty
- Validate that output is either 'true' or 'false'
- Exit with code 1 if validation fails
- Follow same pattern as Node.js action for consistency
- Single check for valid boolean values covers both empty and invalid cases
- Empty string would fail the boolean check anyway
- Simplified logic while maintaining same validation coverage
- Since we're testing the action itself, it should return true
- Simplified check to just verify != 'true' fails the workflow
- More precise validation for our specific test scenario
- A passing job is sufficient confirmation that the output works
- Just display the output value for visibility
- Remove redundant validation logic
- Keep the echo for visibility
- Add back the != 'true' check that fails the job
- Ensures job fails if output is not working correctly
- Add pattern validation to all inputs for better input validation
- Enhance error handling with comprehensive troubleshooting steps
- Add workspace ownership reset to prevent permission issues
- Match Node.js action functionality for consistent user experience

Input validation patterns:
- dir: alphanumeric, dots, underscores, slashes, hyphens
- java-version: semantic version format
- java-cache: maven or gradle
- java-distribution: temurin, corretto, openjdk, or zulu
- sonar_token: 20+ alphanumeric characters
- diff_branch: branch name format
- repository: org/repo format
- branch: optional branch name format

Enhanced error handling includes:
- Java/Maven/Gradle specific troubleshooting
- Debug information display
- Clear error messages with actionable steps

Workspace cleanup:
- Reset file ownership to prevent permission issues
- Consistent with Node.js action behavior
@DerekRoberts DerekRoberts deleted the feat/feature-parity branch September 13, 2025 18:50
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.

1 participant