-
Notifications
You must be signed in to change notification settings - Fork 32
Add tooling to generate action.yml from JavaScript modules #5979
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]>
- Created internal/tools/generate-action-metadata Go tool - Implemented JavaScript parsing to extract inputs/outputs - Generated action.yml and README.md for 5 actions (noop, minimize_comment, close_issue, close_pull_request, close_discussion) - Updated dependency mapping in actions_build_command.go - Built actions successfully with make actions-build Co-authored-by: pelikhan <[email protected]>
- Added make generate-action-metadata target - Updated help text in Makefile - Updated actions/README.md with generation instructions - Listed all new actions in Available Actions section - Documented workflow for generating actions from JavaScript modules Co-authored-by: pelikhan <[email protected]>
- Fixed misleading descriptions for close_issue, close_pull_request, close_discussion - Added "Known Limitations" section to generated action READMEs - Documented that generated actions use require() and are reference implementations - Updated both action.yml and README.md files for consistency Co-authored-by: pelikhan <[email protected]>
- Expanded explanation that actions use require() and are NOT self-contained - Explained that require() expects files that don't exist in standard Actions environment - Clarified that actions are reference implementations, not production-ready - Added specific guidance on FILES embedding pattern for production use Co-authored-by: pelikhan <[email protected]>
| @@ -0,0 +1,321 @@ | |||
| // @ts-check | |||
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 actions//src/.js should be gitignored as well. they are code generated.
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 in c0fe099. Added .gitignore patterns for the generated action src directories (noop, minimize_comment, close_issue, close_pull_request, close_discussion). These files are code-generated copies from pkg/workflow/js/*.cjs and are now excluded from git tracking. The files still exist on disk and are regenerated by make generate-action-metadata.
Manually created src files (setup-safe-outputs, setup-safe-inputs) remain tracked since they use the FILES embedding pattern and are not code-generated.
- Added .gitignore patterns for generated action src directories - Removed noop, minimize_comment, close_issue, close_pull_request, close_discussion src files from git tracking - These files are code-generated copies from pkg/workflow/js/*.cjs - Files still exist on disk and are regenerated by make generate-action-metadata - Manually created src files (setup-safe-outputs, setup-safe-inputs) remain tracked Co-authored-by: pelikhan <[email protected]>
actions/close_discussion/action.yml
Outdated
| @@ -0,0 +1,19 @@ | |||
| name: 'Close Discussion' | |||
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 actions.yml are also code generated and should be gitignored.
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 in 23e6b82. Updated .gitignore to ignore entire generated action directories (noop, minimize_comment, close_issue, close_pull_request, close_discussion). This now excludes all code-generated files: action.yml, README.md, index.js, and src/ directories.
All files exist on disk and are regenerated by make generate-action-metadata. Verified that make actions-build and make actions-validate work correctly.
- Updated .gitignore to ignore entire generated action directories (noop, minimize_comment, close_issue, close_pull_request, close_discussion) - Removed action.yml, README.md, index.js, and src/ files from git tracking - These files are all code-generated by 'make generate-action-metadata' - Files exist on disk and are regenerated on demand - Manually created actions (setup-safe-outputs, setup-safe-inputs) remain tracked - Verified: make actions-build and make actions-validate both work correctly Co-authored-by: pelikhan <[email protected]>
✅ Complete: Generate action.yml files for JavaScript modules
internal/tools/generate-action-metadata/core.getInput()calls (inputs)core.setOutput()calls (outputs)action.ymlfiles with proper structureREADME.mdfiles with usage examplessrc/index.jsfiles by copying from pkg/workflow/js/🎉 Implementation Complete
What Was Delivered
✨ Go-based Generation Tool
internal/tools/generate-action-metadata/core.getInput()callscore.setOutput()callsmake generate-action-metadata📦 5 Generated Actions (Proof of Concept)
🔧 Build Infrastructure
pkg/cli/actions_build_command.gomake actions-build✅make actions-validate✅make generate-action-metadata✅📚 Documentation
actions/README.mdwith generation workflow🔒 Git Management
make generate-action-metadataValidation Results
✅ All unit tests pass
✅ All actions validate successfully
✅ All actions build successfully
✅ Code formats correctly
✅ Build completes without errors
✅ Documentation is comprehensive
✅ Generated files properly gitignored
Known Limitations (By Design)
The generated actions use
require()for dependencies, making them reference implementations rather than production-ready actions. This is intentional and documented in each action's README.They serve as:
For production use, actions need conversion to the FILES embedding pattern (see
setup-safe-outputs/src/index.js), which is documented in each README.Usage Guide
Workflow
make generate-action-metadatato create action scaffoldingmake actions-buildto bundle dependenciesmake actions-validateto ensure everything worksFuture Enhancements
Possible improvements for future work:
Files Changed
internal/tools/generate-action-metadata/main.gopkg/cli/generate_action_metadata_command.gopkg/cli/actions_build_command.goMakefileactions/README.md.gitignore(all generated action files now ignored)Note: Generated action files exist on disk but are not tracked in git.
Addresses: #5947
This implementation successfully delivers the requested tooling infrastructure for generating action metadata from JavaScript modules, with 5 working examples as proof of concept. The tool is ready for use and can be extended to generate more actions as needed.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.