@@ -235,6 +235,62 @@ describe("create-component-deployments action", () => {
235235 expect ( deployStep ?. status ) . toBe ( 0 ) ;
236236 } ) ;
237237
238+ it ( "should ignore deps advanced on target branch after the feature branch was created" , async ( ) => {
239+ // Simulate a stale feature branch: target branch moves on (backbeat bumped)
240+ // while the feature branch only touches sorbet. Diff should be vs the
241+ // merge-base, not the target tip, so backbeat must not be deployed.
242+ nock ( "http://api.github.com" ) . delete ( "/installation/token" ) . reply ( 204 ) . persist ( ) ;
243+
244+ const repoPath = github . repo . getPath ( "zenko" ) ;
245+ await exec ( `git -C ${ repoPath } checkout development/2.11` ) ;
246+ await exec ( `yq -i '.backbeat.tag = "9.3.5"' ${ repoPath } /solution/deps.yaml` ) ;
247+ await exec ( `git -C ${ repoPath } commit -m "bump backbeat on target" -- solution/deps.yaml` ) ;
248+ await exec ( `git -C ${ repoPath } push origin development/2.11` ) ;
249+ await exec ( `git -C ${ repoPath } checkout improvement/ZENKO-5210` ) ;
250+
251+ act . setEnv ( "GITHUB_SHA" , await getCommitHash ( ) ) ;
252+ act . setInput ( "target-branch" , "development/2.11" ) ;
253+
254+ const result = await act . runEvent ( "workflow_dispatch" , {
255+ logFile : process . env . ACT_LOG ? path . join ( __dirname , "act-delta-stale.log" ) : undefined ,
256+ mockApi : [
257+ moctokit . rest . apps . getRepoInstallation ( ) . reply ( {
258+ status : 200 ,
259+ data : { id : 1 , app_id : 12345 , app_slug : "test-app" } ,
260+ repeat : 5 ,
261+ } ) ,
262+ moctokit . rest . apps . createInstallationAccessToken ( ) . reply ( {
263+ status : 201 ,
264+ data : { token : "ghs_fake_token" } ,
265+ repeat : 5 ,
266+ } ) ,
267+
268+ // Only sorbet should be deployed (merge-base diff). Backbeat
269+ // differs vs target tip but was not touched by the feature
270+ // branch, so no mock for it.
271+ moctokit . rest . repos . createDeployment ( {
272+ owner : "scality" ,
273+ repo : "sorbet" ,
274+ ref : "v1.2.2" ,
275+ ...commonDeploymentParams ,
276+ } ) . reply ( { status : 201 , data : { id : 101 } } ) ,
277+
278+ moctokit . rest . repos . createDeploymentStatus ( {
279+ owner : "scality" ,
280+ repo : "sorbet" ,
281+ deployment_id : 101 ,
282+ state : "in_progress" ,
283+ log_url : "https://github.com/scality/zenko/actions/runs/1" ,
284+ description : "Zenko CI running" ,
285+ } ) . reply ( { status : 201 , data : { id : 1 } } ) ,
286+ ] ,
287+ bind : true ,
288+ } ) ;
289+
290+ expect ( findStep ( result , "Filter to changed dependencies" ) ?. status ) . toBe ( 0 ) ;
291+ expect ( findStep ( result , "Create or update deployments" ) ?. status ) . toBe ( 0 ) ;
292+ } ) ;
293+
238294 it ( "should skip deployments when no deps changed" , async ( ) => {
239295 // Point to the same branch — no diff, so no components
240296 act . setInput ( "target-branch" , "improvement/ZENKO-5210" ) ;
0 commit comments