Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

Make the pin check of bin/verify-importmap real

Guido Boyke08c594474f7e
diff --git a/.github/workflows/importmap-verify.yml b/.github/workflows/importmap-verify.yml
index c912120..2623af0 100644
--- a/.github/workflows/importmap-verify.yml
+++ b/.github/workflows/importmap-verify.yml
@@ -5,6 +5,9 @@ name: Importmap Verification
# but did not trigger the job in doing so and went to main
# unchecked. The list is deliberately written out twice instead of as a
# YAML anchor, because GitHub Actions does not resolve anchors reliably.
+# bin/verify-importmap is in the list for the same reason: its pin check
+# stayed green for every controller until it was fixed, and a fix to it alone
+# would not have run.
on:
# Allows a manual run, even without a matching file change.
workflow_dispatch:
@@ -13,12 +16,14 @@ on:
- 'config/importmap.rb'
- 'app/javascript/controllers/**'
- 'lib/tasks/importmap_*.rake'
+ - 'bin/verify-importmap'
- '.github/workflows/importmap-verify.yml'
pull_request:
paths:
- 'config/importmap.rb'
- 'app/javascript/controllers/**'
- 'lib/tasks/importmap_*.rake'
+ - 'bin/verify-importmap'
- '.github/workflows/importmap-verify.yml'
jobs:
diff --git a/bin/verify-importmap b/bin/verify-importmap
index af99f9a..30633e0 100755
--- a/bin/verify-importmap
+++ b/bin/verify-importmap
@@ -35,7 +35,10 @@ unless has_controllers_index
fail!("controllers/index nicht verfügbar (brauche direkten Pin oder 'controllers' Alias)")
end
-missing = controllers.reject { |m| content.include?("pin '#{m}'") || content.include?("pin_all_from 'app/javascript/controllers'") }
+# Only an explicit pin counts. pin_all_from stands in the development branch of
+# the same file and pins nothing in production; counting it made this check
+# pass for every controller, pinned or not.
+missing = controllers.reject { |m| content.include?("pin '#{m}'") }
if missing.any?
warn "⚠️ Fehlende Pins:"
missing.each { |m| warn " pin '#{m}', to: '#{m}.js'" }