Skip to content

Commit afe4421

Browse files
authored
Fix duplicate version in older releases table (#1972)
* Fix duplicate 1.8.27 entry in older releases listing The version 1.8.27 entry was appended twice to _download-older.yml, causing it to appear as a duplicate row on the download page. * Add yaml12 dependency for structured YAML handling yaml12 will be used in release-notes.R for idempotent updates to _download-older.yml, preventing duplicate entries. * Use yaml12 for idempotent upsert in release-notes.R Replace blind cat(append=TRUE) with yaml12-based read/check/write. The script now parses the existing YAML, checks if the version is already present, and either updates it or appends a new entry. This prevents duplicate entries if the script runs twice.
1 parent 1cf3f47 commit afe4421

4 files changed

Lines changed: 69 additions & 15 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ Depends:
2424
shiny,
2525
tidyverse,
2626
webshot2,
27-
yaml
27+
yaml,
28+
yaml12

docs/download/_download-older.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@
3939
date: 2025-08-29
4040
path: https://github.com/quarto-dev/quarto-cli/releases/tag/v1.7.34
4141
changelog: "[Release Notes](changelog/1.7/)"
42-
- id: version18
43-
title: 1.8.27
44-
date: 2026-01-16
45-
path: https://github.com/quarto-dev/quarto-cli/releases/tag/v1.8.27
46-
changelog: "[Release Notes](changelog/1.8/)"
4742
- id: version18
4843
title: 1.8.27
4944
date: 2026-01-16

renv.lock

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6231,6 +6231,40 @@
62316231
"Maintainer": "Hadley Wickham <[email protected]>",
62326232
"Repository": "P3M"
62336233
},
6234+
"yaml12": {
6235+
"Package": "yaml12",
6236+
"Version": "0.1.0",
6237+
"Source": "Repository",
6238+
"Title": "Fast 'YAML' 1.2 Parser and Formatter",
6239+
"Authors@R": "c( person(\"Tomasz\", \"Kalinowski\", , \"[email protected]\", role = c(\"aut\", \"cre\")), person(\"Posit Software, PBC\", role = c(\"cph\", \"fnd\"), comment = c(ROR = \"03wc8by49\")), person(\"Authors of the dependency Rust crates\", role = \"cph\", comment = \"See inst/AUTHORS and LICENSE.note for vendored Rust dependency authors and licenses.\") )",
6240+
"Description": "A fast, correct, safe, and ergonomic 'YAML' 1.2 parser and generator written in 'Rust'. Convert between 'YAML' and simple 'R' objects with full support for multi-document streams, tags, anchors, and aliases. Offers opt-in handlers for custom tag behavior and round-trips common 'R' data structures. Implements the 'YAML' 1.2.2 specification from the 'YAML' Language Development Team (2021) <https://yaml.org/spec/1.2.2/>. Proudly supported by Posit.",
6241+
"License": "MIT + file LICENSE",
6242+
"URL": "https://posit-dev.github.io/r-yaml12/, https://github.com/posit-dev/r-yaml12",
6243+
"BugReports": "https://github.com/posit-dev/r-yaml12/issues",
6244+
"Depends": [
6245+
"R (>= 4.2)"
6246+
],
6247+
"Suggests": [
6248+
"jsonlite",
6249+
"knitr",
6250+
"rmarkdown",
6251+
"testthat (>= 3.0.0)",
6252+
"waldo",
6253+
"withr"
6254+
],
6255+
"VignetteBuilder": "knitr",
6256+
"Config/Needs/website": "tidyverse/tidytemplate",
6257+
"Config/rextendr/version": "0.4.2.9000",
6258+
"Config/testthat/edition": "3",
6259+
"Config/testthat/parallel": "false",
6260+
"Encoding": "UTF-8",
6261+
"RoxygenNote": "7.3.3",
6262+
"SystemRequirements": "Cargo (Rust's package manager), rustc >= 1.70.0, xz",
6263+
"NeedsCompilation": "yes",
6264+
"Author": "Tomasz Kalinowski [aut, cre], Posit Software, PBC [cph, fnd] (ROR: 03wc8by49), Authors of the dependency Rust crates [cph] (See inst/AUTHORS and LICENSE.note for vendored Rust dependency authors and licenses.)",
6265+
"Maintainer": "Tomasz Kalinowski <[email protected]>",
6266+
"Repository": "P3M"
6267+
},
62346268
"zip": {
62356269
"Package": "zip",
62366270
"Version": "2.3.3",

tools/release-notes.R

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ library(stringr)
33
library(glue)
44
library(jsonlite)
55
library(gh)
6+
library(yaml12)
67

78
downloads <- path("docs", "download")
89

@@ -91,16 +92,39 @@ readLines(prerelease_page) |>
9192

9293
old_abbr <- str_split(major_version, "\\.")[[1]] |> paste0(collapse = "")
9394

94-
# Add new item to download-older listing in docs/download/index.qmd
95+
# Add or update item in download-older listing
96+
older_file <- path(downloads, "_download-older.yml")
97+
98+
# Preserve comment header, parse YAML data
99+
file_lines <- readLines(older_file)
100+
comment_lines <- file_lines[startsWith(file_lines, "#")]
101+
yaml_text <- file_lines[!startsWith(file_lines, "#")]
102+
entries <- parse_yaml(paste(yaml_text, collapse = "\n"))
103+
104+
new_entry <- list(
105+
id = paste0("version", old_abbr),
106+
title = old_release,
107+
date = format(as.Date(old_release_date), "%Y-%m-%d"),
108+
path = paste0("https://github.com/quarto-dev/quarto-cli/releases/tag/v", old_release),
109+
changelog = paste0("[Release Notes](changelog/", major_version, "/)")
110+
)
111+
112+
# Upsert: update existing entry or append new one
113+
existing_idx <- which(vapply(entries, function(e) identical(e$title, old_release), logical(1)))
114+
115+
if (length(existing_idx) > 0) {
116+
entries[[existing_idx[1]]] <- new_entry
117+
cat("Updated version", old_release, "in _download-older.yml\n")
118+
} else {
119+
entries <- c(entries, list(new_entry))
120+
cat("Added version", old_release, "to _download-older.yml\n")
121+
}
95122

96-
glue('
97-
\n- id: version{ old_abbr }
98-
title: { old_release }
99-
date: { format(as.Date(old_release_date), "%Y-%m-%d") }
100-
path: https://github.com/quarto-dev/quarto-cli/releases/tag/v{ old_release }
101-
changelog: "[Release Notes](changelog/{ major_version }/)"
102-
') |>
103-
cat(file = path(downloads, "_download-older.yml"), append = TRUE)
123+
# Write back: comments + formatted YAML
124+
writeLines(
125+
c(comment_lines, format_yaml(entries)),
126+
older_file
127+
)
104128

105129
# Update version for prerelease-docs-url shortcode -------------------------
106130
# _quarto.yml tracks the stable release version. Bumping it here on the

0 commit comments

Comments
 (0)