@@ -192,6 +192,41 @@ func TestWorkflowsLayer_Install_ReinstallUpdatesVersion(t *testing.T) {
192192 "re-install should update pinned version" )
193193}
194194
195+ func TestWorkflowsLayer_Install_GitDescribeVersionFallsBackToLatest (t * testing.T ) {
196+ devVersions := []string {
197+ "v0.7.0-58-g4273effb" ,
198+ "v0.7.0-dirty" ,
199+ "v0.7.0-3-g1234567-dirty" ,
200+ "4273effb" ,
201+ "dev" ,
202+ "v1.0.0-rc.1" ,
203+ }
204+ for _ , ver := range devVersions {
205+ t .Run (ver , func (t * testing.T ) {
206+ client := forge .NewFakeClient ()
207+ var buf bytes.Buffer
208+ printer := ui .New (& buf )
209+ layer := NewWorkflowsLayer ("test-org" , client , printer , "admin-user" , ver )
210+
211+ err := layer .Install (context .Background ())
212+ require .NoError (t , err )
213+
214+ var actionContent string
215+ for _ , f := range client .CommittedFiles [0 ].Files {
216+ if f .Path == actionYMLPath {
217+ actionContent = string (f .Content )
218+ break
219+ }
220+ }
221+ require .NotEmpty (t , actionContent , "action.yml should have been written" )
222+ assert .Contains (t , actionContent , "default: latest" ,
223+ "non-release version %q should fall back to latest" , ver )
224+ assert .Contains (t , buf .String (), "not a release" ,
225+ "should warn about non-release version" )
226+ })
227+ }
228+ }
229+
195230func TestWorkflowsLayer_Install_Error (t * testing.T ) {
196231 client := & forge.FakeClient {
197232 Errors : map [string ]error {
0 commit comments