Commit 20430d00 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'fix/readme-from-main' into 'master'

fix: get README from default branch instead of latest tag

See merge request to-be-continuous/doc!30
parents b6cc06c0 ff74dea9
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ function maybe_process_template() {
  project_id=$(echo "$project_json" | jq -r .id)
  project_name=$(echo "$project_json" | jq -r .path)
  project_path=$(echo "$project_json" | jq -r .path_with_namespace)
  project_default_branch=$(echo "$project_json" | jq -r .default_branch)

  # get tags (latest first, oldest last)
  all_tags=$(curl -sSf -H "$AUTH_HEADER" "$API_URL/projects/$project_id/repository/tags?per_page=100" | jq -r '.[].name' | sort -rV)
@@ -79,9 +80,9 @@ function maybe_process_template() {
      # add additional info
      echo "$template_json" | jq ". + $add_info_json" > "$target_dir/template.json"
     
      # get README file from latest tag
      # get README file from default branch
      log_info " ... downloading README.md to \\e[33;1m$DOC_OUT/ref/$project_name.md\\e[0m..."
      curl -s -H "$AUTH_HEADER" --output "$DOC_OUT/ref/$project_name.md" "$API_URL/projects/$project_id/repository/files/README.md/raw?ref=$tag"
      curl -s -H "$AUTH_HEADER" --output "$DOC_OUT/ref/$project_name.md" "$API_URL/projects/$project_id/repository/files/README.md/raw?ref=$project_default_branch"

      # add entry to TOC
      case "$template_kind" in