-
Notifications
You must be signed in to change notification settings - Fork 4
fix: Add index.html redirect, historical version aliases, timestamp placeholder, and bump to 1.3.1 #18
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
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughCI deployment workflow now generates full historical-version files and alias redirects and emits a redirecting Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
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 adds an index.html redirect page to resolve the 404 error when accessing the root URL of the GitHub Pages deployment. The redirect automatically sends visitors to latest.json, ensuring the workflow summary URL is functional.
Key Changes:
- Added HTML redirect page generation in deployment workflow that redirects to
latest.json - Bumped minor version from 1.2 to 1.3 in the token list
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
.github/workflows/deploy.yml |
Added step to generate index.html with meta refresh redirect to latest.json |
tokens/token-list.json |
Bumped minor version from 1.2 to 1.3 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4a84a6f to
e44df88
Compare
This fixes the 404 when clicking the GitHub Pages URL in the workflow summary. The root URL now redirects to latest.json.
e44df88 to
67f620f
Compare
Creates major.minor aliases (e.g., v1.2.json) for all historical versions in the versions/ directory. The highest patch version for each major.minor combination is used for the alias.
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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/deploy.yml (1)
127-139: Minor: Consider a brief inline comment for the semver comparison logic.The nested condition at line 134 (
if [ "$FILE_MINOR" -gt "$CURRENT_M" ] || ([ "$FILE_MINOR" = "$CURRENT_M" ] && [ "$FILE_PATCH" -gt "$CURRENT_P" ])) correctly implements "highest minor.patch within a major version," but a one-line comment explaining this would improve clarity for future maintainers.# Create/update major alias (e.g., v1.json) - only for non-current majors if [ "$FILE_MAJOR" != "$MAJOR" ]; then MAJOR_ALIAS="v${FILE_MAJOR}.json" # Compare as "minor.patch" to find highest version within major CURRENT_MINOR_PATCH=${highest_minor[$FILE_MAJOR]:-"-1.-1"} CURRENT_M=$(echo $CURRENT_MINOR_PATCH | cut -d. -f1) CURRENT_P=$(echo $CURRENT_MINOR_PATCH | cut -d. -f2) + # Update if this version is newer (higher minor, or same minor but higher patch) if [ "$FILE_MINOR" -gt "$CURRENT_M" ] || ([ "$FILE_MINOR" = "$CURRENT_M" ] && [ "$FILE_PATCH" -gt "$CURRENT_P" ]); then cp "$version_file" "dist/${MAJOR_ALIAS}" highest_minor[$FILE_MAJOR]="${FILE_MINOR}.${FILE_PATCH}" echo "Created/updated alias ${MAJOR_ALIAS} from $(basename $version_file)" fi fi
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.github/workflows/deploy.yml(1 hunks)src/schemas/token-list-schema.json(1 hunks)src/validation/validate.ts(1 hunks)tests/validation.test.ts(11 hunks)tokens/token-list.json(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- tokens/token-list.json
🧰 Additional context used
🧬 Code graph analysis (1)
tests/validation.test.ts (2)
src/types/index.ts (1)
TokenList(14-23)src/validation/validate.ts (1)
validateTokenList(17-60)
🔇 Additional comments (4)
.github/workflows/deploy.yml (2)
91-142: ✓ Historical version aliasing logic is correct and well-protected.The semver comparison and aliasing strategy is sound:
- Current version's aliases (v{MAJOR}.json, v{MAJOR}.{MINOR}.json) are created first, then protected from overwrite by historical versions (lines 108, 128)
- Each historical major.minor gets a single highest-patch alias (lines 117–125)
- Each historical major gets a single highest-minor.patch alias, skipped only for the current major (lines 127–139)
- Defensive directory and file existence checks in place
The trace-through: current v1.3.0 creates v1.json/v1.3.json/latest.json; historical v1.2.3 creates only v1.2.json (skips v1.json); historical v0.9.1 creates both v0.9.json and v0.json. Correct precedence.
145-158: ✓ index.html redirect is properly implemented.Valid HTML5 structure with lang="en" (addressing the prior review comment), meta charset, proper http-equiv refresh directive, and fallback link for browsers that don't auto-redirect. Redirect target (latest.json) is correct for serving the root as the latest version.
src/schemas/token-list-schema.json (1)
10-17: LGTM! Schema change allows both placeholder and deployed timestamps.The
oneOfconstraint elegantly handles both scenarios: source files with the placeholder during CI validation, and deployed files with actual RFC 3339 timestamps. This design allows the same schema to validate files at different stages of the deployment pipeline.tests/validation.test.ts (1)
123-143: LGTM! Good test coverage for placeholder enforcement.The new tests appropriately verify that:
- Real ISO 8601 timestamps are rejected (lines 123-132)
- Invalid timestamp strings are rejected (lines 134-143)
This ensures the validation enforces the placeholder in the source file as intended.
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/validation.test.ts (1)
131-140: Consider clarifying the test name.The test name "should reject invalid timestamp format" implies format validation, but the validation logic rejects any value that isn't the exact placeholder string. The test still passes correctly, but the name could be more precise.
- it("should reject invalid timestamp format", async () => { + it("should reject non-placeholder timestamp values", async () => {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/types/index.ts(1 hunks)src/validation/validate.ts(2 hunks)tests/validation.test.ts(11 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/validation.test.ts (2)
src/types/index.ts (2)
TIMESTAMP_PLACEHOLDER(61-61)TokenList(14-23)src/validation/validate.ts (1)
validateTokenList(18-61)
src/validation/validate.ts (1)
src/types/index.ts (1)
TIMESTAMP_PLACEHOLDER(61-61)
🔇 Additional comments (5)
src/validation/validate.ts (2)
11-11: LGTM! Past review feedback addressed.The
TIMESTAMP_PLACEHOLDERis now correctly imported from the shared../typesmodule, eliminating the duplication that was flagged in the previous review.
116-132: Well-documented validation logic.The JSDoc clearly explains the dual-validation approach: the JSON schema allows both formats for consumer flexibility, while this validation script enforces the placeholder for source files. The implementation correctly uses the shared constant.
src/types/index.ts (1)
57-61: Good addition of the shared constant.The
TIMESTAMP_PLACEHOLDERconstant is well-documented and appropriately placed alongside other shared constants likeCHAIN_IDS. This establishes a single source of truth for the placeholder value.tests/validation.test.ts (2)
3-3: Past review feedback addressed.The
TIMESTAMP_PLACEHOLDERis now correctly imported from the shared types module instead of being duplicated locally.
120-129: Good test coverage for placeholder enforcement.This test correctly verifies that real ISO timestamps are rejected, ensuring the source file validation enforces the placeholder requirement.
Problem
https://requestnetwork.github.io/request-token-list/) returns 404 when clicking the GitHub Pages link in the Actions workflow summaryvX.Y.jsonaliases for historical versions (e.g.,v1.1.json,v1.2.json)vX.jsonaliases for historical major versions (e.g.,v0.jsonfor all v0.x.x releases)Solution
index.htmlthat redirects tolatest.json"Set automatically during deployment"in source file (actual timestamp set during deployment)vX.Y.jsonaliases for all historical versions (highest patch wins)vX.jsonaliases for historical major versions (highest minor.patch wins)Version alias example
Given current version
1.3.1and historical versionsv0.5.0,v0.6.0,v0.6.1,v1.0.0,v1.1.0,v1.2.0,v1.2.1:Historical major aliases (
vX.json):v0.json→ points to v0.6.1 (highest v0.x.x)Historical minor aliases (
vX.Y.json):v0.5.json→ points to v0.5.0v0.6.json→ points to v0.6.1 (highest patch)v1.0.json→ points to v1.0.0v1.1.json→ points to v1.1.0v1.2.json→ points to v1.2.1 (highest patch)Current version aliases (always created from current version):
v1.json→ points to v1.3.1 (current)v1.3.json→ points to v1.3.1 (current)Changes
.github/workflows/deploy.yml: Add index.html generation and historical version aliasessrc/schemas/token-list-schema.json: Allow both timestamp formats (placeholder for source, date-time for deployed)src/validation/validate.ts: Enforce timestamp placeholder in source filetests/validation.test.ts: Update tests to use timestamp placeholdertokens/token-list.json: Update timestamp to placeholder, bump version to 1.3.1Summary by CodeRabbit
New Features
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.