feat(azure-devops): auto-detect README.md from source-location when readme-path annotation is absent#9703
Open
CyberCoder-IITM wants to merge 7 commits into
Conversation
…kstage#9188) Signed-off-by: CyberCoder-IITM <127583612+CyberCoder-IITM@users.noreply.github.com>
Signed-off-by: CyberCoder-IITM <127583612+CyberCoder-IITM@users.noreply.github.com>
…location When dev.azure.com/readme-path annotation is absent, derive the README path from backstage.io/source-location by extracting the Azure DevOps path query parameter and resolving README.md in the same directory as the catalog file. Non-Azure URLs and malformed values fall back gracefully to undefined. Closes backstage#9188 Signed-off-by: CyberCoder-IITM <127583612+CyberCoder-IITM@users.noreply.github.com>
…ge#9188) Covers 8 new cases: explicit annotation takes precedence, catalog-info path derivation, directory paths, trailing slashes, absent annotations, non-Azure URLs, missing path param, and malformed URL graceful failure. 29/29 tests passing with zero regressions. Signed-off-by: CyberCoder-IITM <127583612+CyberCoder-IITM@users.noreply.github.com>
Adds documentation for the automatic README path detection introduced in backstage#9188. When dev.azure.com/readme-path is absent the plugin falls back to backstage.io/source-location to derive the README path. Signed-off-by: CyberCoder-IITM <127583612+CyberCoder-IITM@users.noreply.github.com>
Contributor
Changed Packages
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the azure-devops-readme feature by deriving a default README.md path from backstage.io/source-location when dev.azure.com/readme-path is not provided, improving monorepo ergonomics while keeping existing behavior unchanged when derivation is not possible.
Changes:
- Add
backstage.io/source-location-based fallback to computereadmePathwhen the explicit annotation is absent. - Add unit tests covering the new auto-detection behavior and fallback cases.
- Document the new behavior and publish patch changesets for affected packages.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| workspaces/azure-devops/plugins/azure-devops/README.md | Documents the new README auto-detection behavior and example source-location format. |
| workspaces/azure-devops/plugins/azure-devops-common/src/utils/getAnnotationValuesFromEntity.ts | Implements the readmePath fallback logic derived from backstage.io/source-location. |
| workspaces/azure-devops/plugins/azure-devops-common/src/utils/getAnnotationValuesFromEntity.test.ts | Adds test coverage for the new fallback behavior and failure modes. |
| workspaces/azure-devops/.changeset/shy-bulldogs-grow.md | Patch changeset for documentation update in plugin-azure-devops. |
| workspaces/azure-devops/.changeset/rich-comics-complain.md | Patch changeset for behavior change in plugin-azure-devops-common. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ection - Use exact hostname match (=== dev.azure.com) instead of includes() to prevent matching subdomains like dev.azure.com.evil.example - Guard against lastIndexOf returning -1 when path has no slash, preventing incorrect slice(-1) behavior Signed-off-by: CyberCoder-IITM <127583612+CyberCoder-IITM@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey, I just made a Pull Request!
This adds automatic README.md detection for the
azure-devops-readmepluginwhen the
dev.azure.com/readme-pathannotation is not set. Closes #9188.In monorepo setups it's common for components to have
backstage.io/source-locationset by the discovery processor but no explicit
readme-pathannotation. Previouslythe plugin would just render nothing. Now it derives the README path from the
source-location URL by extracting the
pathquery parameter and resolvingREADME.mdin the same directory as the catalog file.Non-Azure URLs, missing path params, and malformed values all fall back to
undefinedgracefully - existing behavior is completely unchanged.✔️ Checklist
Signed-off-byline in the message.