diff --git a/.github/gallery-agent/helpers.go b/.github/gallery-agent/helpers.go index bc66eebef..ab30ca25f 100644 --- a/.github/gallery-agent/helpers.go +++ b/.github/gallery-agent/helpers.go @@ -170,22 +170,33 @@ func extractDescription(readme string) string { // Replace markdown links `[text](url)` with just `text`. s = regexp.MustCompile(`\[([^\]]+)\]\([^)]+\)`).ReplaceAllString(s, "$1") - // Drop table lines and horizontal rules. + // Drop table lines and horizontal rules, and flatten all leading + // whitespace: generateYAMLEntry embeds this under a `description: |` + // literal block whose indentation is set by the first non-empty line. + // If any line has extra leading whitespace (e.g. from an indented + // `
` block in the original README), YAML will pick + // that up as the block's indent and every later line at a smaller + // indent blows the block scalar. Stripping leading whitespace here + // guarantees uniform 4-space indentation after formatTextContent runs. var kept []string for _, line := range strings.Split(s, "\n") { - t := strings.TrimSpace(line) - if strings.HasPrefix(t, "|") { + t := strings.TrimLeft(line, " \t") + ts := strings.TrimSpace(t) + if strings.HasPrefix(ts, "|") { continue } - if strings.HasPrefix(t, ":--") || strings.HasPrefix(t, "---") || strings.HasPrefix(t, "===") { + if strings.HasPrefix(ts, ":--") || strings.HasPrefix(ts, "---") || strings.HasPrefix(ts, "===") { continue } - kept = append(kept, line) + kept = append(kept, t) } s = strings.Join(kept, "\n") - // Normalise whitespace. + // Normalise whitespace and drop any leading blank lines so the literal + // block in YAML doesn't start with a blank first line (which would + // break the indentation detector the same way). s = cleanTextContent(s) + s = strings.TrimLeft(s, " \t\n") // Truncate at a paragraph boundary around maxLen chars. const maxLen = 1200 diff --git a/.github/workflows/gallery-agent.yaml b/.github/workflows/gallery-agent.yaml index ee791038b..8f3cac9ae 100644 --- a/.github/workflows/gallery-agent.yaml +++ b/.github/workflows/gallery-agent.yaml @@ -52,7 +52,7 @@ jobs: env: GH_TOKEN: ${{ secrets.UPDATE_BOT_TOKEN }} REPO: ${{ github.repository }} - SEARCH: 'chore(model gallery) in:title :robot:' + SEARCH: 'gallery agent in:title' run: | # Walk open gallery-agent PRs and act on maintainer comments: # /gallery-agent blacklist → label `gallery-agent/blacklisted` + close (never repropose) @@ -82,7 +82,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} REPO: ${{ github.repository }} - SEARCH: 'chore(model gallery) in:title :robot:' + SEARCH: 'gallery agent in:title' run: | # Skip set = # URLs from any open gallery-agent PR (avoid duplicate PRs for the same model while one is pending)