Skip to content

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
backstage:mainfrom
CyberCoder-IITM:feat/azure-devops-readme-auto-detect-9188
Open

feat(azure-devops): auto-detect README.md from source-location when readme-path annotation is absent#9703
CyberCoder-IITM wants to merge 7 commits into
backstage:mainfrom
CyberCoder-IITM:feat/azure-devops-readme-auto-detect-9188

Conversation

@CyberCoder-IITM

Copy link
Copy Markdown

Hey, I just made a Pull Request!

This adds automatic README.md detection for the azure-devops-readme plugin
when the dev.azure.com/readme-path annotation is not set. Closes #9188.

In monorepo setups it's common for components to have backstage.io/source-location
set by the discovery processor but no explicit readme-path annotation. Previously
the plugin would just render nothing. Now it derives the README path from the
source-location URL by extracting the path query parameter and resolving
README.md in the same directory as the catalog file.

Non-Azure URLs, missing path params, and malformed values all fall back to
undefined gracefully - existing behavior is completely unchanged.

AI Assistance Disclosure: I used an AI coding assistant to help explore
the codebase and draft parts of this implementation. I have reviewed, tested,
and take full responsibility for all code in this PR, per the project's AI Use Policy.

✔️ Checklist

  • A changeset describing the change and affected packages.
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes) - not applicable, no UI changes
  • All your commits have a Signed-off-by line in the message.

…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>
@backstage-goalie

backstage-goalie Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage-community/plugin-azure-devops-common workspaces/azure-devops/plugins/azure-devops-common patch v0.24.0
@backstage-community/plugin-azure-devops workspaces/azure-devops/plugins/azure-devops patch v0.32.0

)

Signed-off-by: CyberCoder-IITM <127583612+CyberCoder-IITM@users.noreply.github.com>
@CyberCoder-IITM CyberCoder-IITM marked this pull request as ready for review June 25, 2026 21:43
@CyberCoder-IITM CyberCoder-IITM requested review from a team and awanlin as code owners June 25, 2026 21:43
Copilot AI review requested due to automatic review settings June 25, 2026 21:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 compute readmePath when 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 azure-devops-readme: Automatically detect README.md

3 participants