-
Notifications
You must be signed in to change notification settings - Fork 6
Add preview and publication URL support to DAK LM and JSON generation #174
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: litlfred <662242+litlfred@users.noreply.github.com>
|
Utilize the new workflow called publication release. If branchbnqme.is attern release-* then once it finishes ghbuiild successlly.deploted, it should kick off a pulll request to smart-html for that release of that repo if a PR has an already been created and is open. PR should be generated by adding content of smart,-YYY/gh-pages/branches/release-XXX to dir -YYY of smart-html repo. |
|
merge upstream @copilot |
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.
Pull Request Overview
This PR implements comprehensive preview and publication URL handling for Digital Adaptation Kit (DAK) repositories, adding URL configuration fields and branch-aware URL selection logic to support both WHO and non-WHO repositories.
- Enhanced DAK JSON generation with
previewUrlandcanonicalUrlfields alongside branch-aware URL selection - Created shared DAK URL utilities for consistent URL generation across build scripts
- Updated PR comment scripts to use DAK-aware URL generation with graceful fallbacks
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
input/scripts/pr_comment_start.py |
Updated to use DAK-aware URL generation with fallback to GitHub Pages patterns |
input/scripts/pr_comment_finish.py |
Updated to use DAK-aware URL generation with fallback to GitHub Pages patterns |
input/scripts/generate_dak_from_sushi.py |
Enhanced with URL generation logic supporting WHO/non-WHO repos and branch-based selection |
input/scripts/dak_url_utils.py |
New utility module providing shared DAK URL generation and configuration loading |
input/pagecontent/index.md |
Added comprehensive documentation of DAK URL handling patterns and branch logic |
input/fsh/models/DAK.fsh |
Updated logical model to include previewUrl and canonicalUrl fields |
dak.json |
Updated with new URL fields and corrected publication URL protocol |
.github/workflows/ghbuild.yml |
Enhanced workflow to regenerate DAK config with current branch context |
| def generate_publication_url(repo_name: str, canonical_url: str) -> str: | ||
| """Generate publication URL based on repository ownership and name.""" | ||
| # Check if this is a WorldHealthOrganization repository | ||
| if os.getenv('GITHUB_REPOSITORY', '').startswith('WorldHealthOrganization/'): |
Copilot
AI
Oct 9, 2025
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.
The hardcoded organization name 'WorldHealthOrganization/' should be extracted to a constant or configuration to improve maintainability and make it easier to adapt for other organizations.
| profile, repo = github_repo.split('/') | ||
| base_url = f"https://{profile}.github.io/{repo}" | ||
| else: | ||
| base_url = "https://worldhealthorganization.github.io/smart-base" |
Copilot
AI
Oct 9, 2025
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.
The hardcoded fallback URL should be extracted to a constant or made configurable to avoid magic strings in the code.
This PR implements comprehensive preview and publication URL handling for Digital Adaptation Kit (DAK) repositories as requested in the issue.
Key Changes
Enhanced DAK JSON Generation
previewUrlandcanonicalUrlfields to the DAK JSON structurehttps://smart.who.int/{stub}where{stub}is the repository name with anysmart-prefix removedrelease-*), preview URLs for development branchesNew DAK URL Utilities
input/scripts/dak_url_utils.pywith shared URL generation logicGitHub Workflow Integration
.github/workflows/ghbuild.ymlto regenerate DAK configuration with current branch contextdak.jsonPR Comment Script Updates
pr_comment_start.pyandpr_comment_finish.pyto use DAK-aware URL generationLogical Model & Documentation
input/fsh/models/DAK.fshto includepreviewUrlandcanonicalUrlfieldsinput/pagecontent/index.mdwith comprehensive DAK URL handling explanationURL Patterns
WHO Repositories:
https://smart.who.int/base(forsmart-baserepo)https://worldhealthorganization.github.io/smart-baseNon-WHO Repositories:
sushi-config.yamlor GitHub Pages fallbackBranch Logic:
release-*): Use publication URL for canonical referencesThe implementation is backward-compatible and maintains all existing functionality while adding the requested DAK-specific URL capabilities.
Fixes #173.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.