scaffolder-backend-module-regex - add search and extract functionality#8655
scaffolder-backend-module-regex - add search and extract functionality#865522367rh wants to merge 10 commits intobackstage:mainfrom
Conversation
Signed-off-by: Robin Hilton <22367rh@gmail.com>
Changed Packages
|
There was a problem hiding this comment.
Pull request overview
Adds a new regex:search scaffolder action to the scaffolder-backend-module-regex package, enabling regex-based extraction of matches from a specified property across an array of JSON objects and returning enriched objects for downstream template steps.
Changes:
- Registers a new
regex:searchaction alongside the existingregex:replaceaction. - Implements
regex:searchaction logic, examples, and Jest tests. - Updates package docs, API report, and adds a changeset for a minor release.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| workspaces/scaffolder-backend-module-regex/plugins/regex-actions/src/module.ts | Registers the new createSearchAction with the scaffolder extension point. |
| workspaces/scaffolder-backend-module-regex/plugins/regex-actions/src/actions/regex/search.ts | Introduces the regex:search action schema + handler implementation. |
| workspaces/scaffolder-backend-module-regex/plugins/regex-actions/src/actions/regex/search.test.ts | Adds unit tests for the new action behavior. |
| workspaces/scaffolder-backend-module-regex/plugins/regex-actions/src/actions/regex/search.example.ts | Adds scaffolder YAML examples for regex:search. |
| workspaces/scaffolder-backend-module-regex/plugins/regex-actions/src/actions/regex/index.ts | Exports createSearchAction from the regex actions barrel. |
| workspaces/scaffolder-backend-module-regex/plugins/regex-actions/report.api.md | Updates API extractor output to include the new public export. |
| workspaces/scaffolder-backend-module-regex/plugins/regex-actions/README.md | Documents the new action and its inputs/outputs. |
| workspaces/scaffolder-backend-module-regex/.changeset/smooth-cooks-vanish.md | Declares a minor version bump for the added action. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Robin Hilton <22367rh@gmail.com>
Signed-off-by: Robin Hilton <22367rh@gmail.com>
Signed-off-by: Robin Hilton <22367rh@gmail.com>
vinzscam
left a comment
There was a problem hiding this comment.
What's the concrete scaffolder workflow that needs this? The examples (extracting emails from bios, chaining searches for domains) don't look related to scaffolder.
Scaffolder inputs are usually simple values from a form. If you already have an array of objects mid-template, it came from an upstream action, which should return data shaped correctly rather than needing regex post-processing downstream.
My exact use case is to extra Jira Ids from the output of backstage/backstage#33939 which would be the upstream action in my real world scenario. After which the modified object array will be used to trigger further steps downstream. |
…ith the output of backstage/backstage#33939 Signed-off-by: Robin Hilton <22367rh@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ns/src/actions/regex/search.test.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Robin Hilton <22367rh@gmail.com>
…ns/src/actions/regex/search.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Robin Hilton <22367rh@gmail.com>
Signed-off-by: Robin Hilton <22367rh@gmail.com>
Hey, I just made a Pull Request!
I have added the ability for scaffold actions to be able to process an array of objects in order to extract values using a provided regex search pattern from one of the properties and store the matches as a new property on each object in the array.
✔️ Checklist
Signed-off-byline in the message. (more info)