Skip to content

[24299] Add fallback branch for master links #1241

Open
emiliocuestaf wants to merge 10 commits intomasterfrom
basic/feature/fallback-branch-for-master-links
Open

[24299] Add fallback branch for master links #1241
emiliocuestaf wants to merge 10 commits intomasterfrom
basic/feature/fallback-branch-for-master-links

Conversation

@emiliocuestaf
Copy link
Copy Markdown
Contributor

@emiliocuestaf emiliocuestaf commented Mar 27, 2026

Description

Fix GitHub links in the documentation to always point to the correct branch instead of defaulting master/main

get_git_branch() now reads READTHEDOCS_VERSION on RTD builds (for branch and tag builds) instead of relying on git name-rev, which returned weird names like "external-1234". There are 3 possible cases for RTD builds now:

  • Branch builds -> Github links refer to the branch itself
  • Tag builds -> Github links refer to the tag itself
  • PR preview builds (VERSION_TYPE=external) now return None and fall back to the default branch as it seemed impossible to get the real branch name.

@Mergifyio backport 3.5.x 3.4.x 3.2.x 2.14.x

Contributor Checklist

  • Commit messages follow the project guidelines.
  • Code snippets related to the added documentation have been provided.
  • Documentation tests pass locally.
  • The Pro version badge has been added if the documented feature is exclusive to Fast DDS Pro.
  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • CI passes without warnings or errors.

Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
@emiliocuestaf emiliocuestaf added this to the v3.6.1 milestone Mar 27, 2026
@emiliocuestaf emiliocuestaf marked this pull request as draft March 30, 2026 05:57
Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
@emiliocuestaf emiliocuestaf force-pushed the basic/feature/fallback-branch-for-master-links branch from e8f5c5b to 8cbee1c Compare March 30, 2026 07:33
@emiliocuestaf emiliocuestaf requested review from richiprosima and removed request for richiprosima March 30, 2026 07:33
Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
@emiliocuestaf emiliocuestaf changed the title Add fallback branch for master links [24299] Add fallback branch for master links Mar 30, 2026
@emiliocuestaf emiliocuestaf marked this pull request as ready for review March 30, 2026 09:19
@emiliocuestaf emiliocuestaf requested review from richiprosima and removed request for richiprosima March 30, 2026 11:01
Copy link
Copy Markdown
Contributor

@raulojeda22 raulojeda22 left a comment

Choose a reason for hiding this comment

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

Nits

docs/conf.py Outdated
# Resolve GitHub link branches: env var → current docs branch → default.
# Computed here so they are available both in the ReadTheDocs clone block and in extlinks.
fastdds_fallback_branch = resolve_fallback_branch("FASTDDS_BRANCH", docs_branch, "master")
fastdds_docs_fallback_branch = docs_branch
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.

To avoid this being None

Suggested change
fastdds_docs_fallback_branch = docs_branch
fastdds_docs_fallback_branch = resolve_fallback_branch("FASTDDS_DOCS_BRANCH", docs_branch, "master")

docs/conf.py Outdated
return None


def resolve_fallback_branch(env_var, docs_branch, default="main"):
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.

Maybe in this repo it makes more sense for the default to be "master"

Suggested change
def resolve_fallback_branch(env_var, docs_branch, default="main"):
def resolve_fallback_branch(env_var, docs_branch, default="master"):

docs/conf.py Outdated
Comment on lines +523 to +528
print("Fallback branches for GitHub links:")
print(' Fast-DDS: "{}"'.format(fastdds_fallback_branch))
print(' Fast-DDS-docs: "{}"'.format(fastdds_docs_fallback_branch))
print(' Fast-DDS-Python: "{}"'.format(fastdds_python_fallback_branch))
print(' Fast-DDS-Gen: "{}"'.format(fastdds_gen_fallback_branch))

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.

This was already printed before

Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.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.

2 participants