diff --git a/.github/workflows/sync-from-upstream.yaml b/.github/workflows/sync-from-upstream.yaml index 160e0ee..65568bb 100644 --- a/.github/workflows/sync-from-upstream.yaml +++ b/.github/workflows/sync-from-upstream.yaml @@ -70,6 +70,7 @@ jobs: outputs: entries: ${{ steps.changelogger.outputs.entries }} drift: ${{ steps.values_drift.outputs.drift }} + title: ${{ steps.detect.outputs.title }} steps: - name: Generate token id: generate_token @@ -150,7 +151,20 @@ jobs: in_deps && /name:/ { print $NF } ' "${CHART_YAML}") + # Read a subchart's version, preferring appVersion and falling back to + # version when appVersion is not set. $2 skips any trailing "# VERSION" comment. + chart_version() { + awk ' + /^appVersion:/ { appv = $2 } + /^version:/ { ver = $2 } + END { print (appv != "" ? appv : ver) } + ' + } + entries_file=$(mktemp) + changed_names=() + first_dep="" + first_ver="" while IFS= read -r dep; do subchart="${{ steps.chart.outputs.chart_dir }}/charts/${dep}/Chart.yaml" if [[ ! -f "${subchart}" ]]; then @@ -158,11 +172,10 @@ jobs: continue fi - new_version=$(grep -E "^appVersion:" "${subchart}" | awk '{print $NF}' || true) - old_version=$(git show origin/main:"${subchart}" 2>/dev/null \ - | grep -E "^appVersion:" | awk '{print $NF}' || true) + new_version=$(chart_version < "${subchart}") + old_version=$(git show origin/main:"${subchart}" 2>/dev/null | chart_version || true) - # Strip surrounding quotes Helm allows around appVersion (e.g. "0.44.0"). + # Strip surrounding quotes Helm allows around the version (e.g. "0.44.0"). new_version="${new_version//[\"\']/}" old_version="${old_version//[\"\']/}" @@ -173,9 +186,30 @@ jobs: [[ "${new_version}" != v* ]] && new_version="v${new_version}" echo "- Updated \`${dep}\` to upstream version \`${new_version}\`." >> "${entries_file}" + changed_names+=("${dep}") + if [[ ${#changed_names[@]} -eq 1 ]]; then + first_dep="${dep}" + first_ver="${new_version}" + fi done <<< "${deps}" echo "entries_file=${entries_file}" >> "$GITHUB_OUTPUT" + + # Build a descriptive PR title from the changed dependencies. One dep gets + # its version; a few are listed by name; many collapse to a count. + count=${#changed_names[@]} + title="" + if (( count == 1 )); then + title="chore(chart): update ${first_dep} to ${first_ver} from upstream" + elif (( count >= 2 && count <= 3 )); then + joined=$(printf '%s, ' "${changed_names[@]}"); joined="${joined%, }" + title="chore(chart): update ${joined} from upstream" + elif (( count > 3 )); then + title="chore(chart): update ${count} dependencies from upstream" + fi + if [[ -n "${title}" ]]; then + echo "title=${title}" >> "$GITHUB_OUTPUT" + fi - name: Run changelogger id: changelogger run: | @@ -229,6 +263,7 @@ jobs: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} ENTRIES: ${{ needs.sync-and-update.outputs.entries }} DRIFT: ${{ needs.sync-and-update.outputs.drift }} + TITLE: ${{ needs.sync-and-update.outputs.title }} run: | body="" if [[ -n "${ENTRIES}" ]]; then @@ -254,6 +289,11 @@ jobs: body+=$'\n```\n' fi fi + title_args=() + if [[ -n "${TITLE}" ]]; then + title_args=(--title "${TITLE}") + fi gh pr edit '${{ inputs.update_branch }}' \ --repo ${{ github.repository }} \ + "${title_args[@]}" \ --body "${body}" diff --git a/CHANGELOG.md b/CHANGELOG.md index c64b162..e70b1b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), however this project does not use Semantic Versioning and there are no releases. Instead this file uses a date-based structure. +## 2026-07-06 + +### Fixed + +- `sync-from-upstream.yaml` — the dependency-version detection step now falls back to a subchart's `version:` field when `appVersion:` is not set, instead of skipping the dependency. Subcharts vendored without an `appVersion` (e.g. `giantswarm/kyverno-crds`) were always reported as "No version change", so `CHANGELOG.md` was never updated by the automated upstream-sync PR. Extraction also tolerates a trailing `# VERSION` comment on the `version:` line. + +### Changed + +- `sync-from-upstream.yaml` — the automated PR title now names the updated dependencies instead of a static "automated update from upstream". A single change reads `chore(chart): update to from upstream`; two or three list the names; more than three collapse to `chore(chart): update N dependencies from upstream`. + ## 2026-07-02 ### Added