diff --git a/scripts/compare-actions.sh b/scripts/compare-actions.sh index d8efa8d..7c154d6 100755 --- a/scripts/compare-actions.sh +++ b/scripts/compare-actions.sh @@ -10,7 +10,12 @@ OUTDATED_COUNT=0 : >actions-outdated.txt while IFS='|' read -r action current_sha current_tag latest_sha latest_tag; do - if [[ "$current_sha" != "$latest_sha" ]]; then + # Flag outdated on SHA mismatch OR on tag mismatch when SHAs coincide + # (e.g. pin comment says "# v1" but latest release is "v1.0.0" — same + # commit today because v1 floats, but the pin label is stale; refresh + # it to the exact release name so consumers see what version they're on). + if [[ "$current_sha" != "$latest_sha" ]] || + { [[ -n "$current_tag" ]] && [[ -n "$latest_tag" ]] && [[ "$current_tag" != "$latest_tag" ]]; }; then echo " Outdated: ${action} ${current_tag:-unknown} -> ${latest_tag}" echo "${action}|${current_sha}|${current_tag}|${latest_sha}|${latest_tag}" >>actions-outdated.txt ((OUTDATED_COUNT++)) || true diff --git a/tests/compare-actions.bats b/tests/compare-actions.bats index ac29e6f..c719e85 100644 --- a/tests/compare-actions.bats +++ b/tests/compare-actions.bats @@ -38,3 +38,40 @@ EOF [[ "$output" != *"actions/setup-node"* ]] assert_output_contains "has_outdated=true" } + +@test "compare-actions: flags outdated when SHAs match but tags differ (floating pin behind exact release)" { + cat > actions-latest.txt < actions-latest.txt < current_tag is empty. Only SHA comparison matters. + cat > actions-latest.txt <