From 19f7eb657b83dc01d032ba220c2e75f87c69de21 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sat, 30 Mar 2024 13:35:56 +0100 Subject: [PATCH] [CI] allow backports to be launched on merged pull requests The intention was good initially but the expression was wrong for two reasons: * When a pull_request event is received for a labeled action, the match should be github.event.action == 'label_updated' and not 'labeled' * The event does not have a github.event.label field and contains(github.event.label.name, 'backport/v') will always be false. Since the expression is only evaluated in the context of a merged pull request, either because it was just closed or because it was labeled after the fact, the only verification that is needed is to assert that there is at least one `backport/v*` label. --- .forgejo/workflows/backport.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.forgejo/workflows/backport.yml b/.forgejo/workflows/backport.yml index 50e8785c12..10da148eab 100644 --- a/.forgejo/workflows/backport.yml +++ b/.forgejo/workflows/backport.yml @@ -33,17 +33,8 @@ jobs: if: > !startsWith(vars.ROLE, 'forgejo-') && ( github.event.pull_request.merged - && ( - ( - github.event.action == 'closed' && - contains(toJSON(github.event.pull_request.labels), 'backport/v') - ) - || - ( - github.event.action == 'labeled' && - contains(github.event.label.name, 'backport/v') - ) - ) + && + contains(toJSON(github.event.pull_request.labels), 'backport/v') ) runs-on: docker container: