[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.
This commit is contained in:
Earl Warren 2024-03-30 13:35:56 +01:00
parent 0761207cc2
commit d8ab364889
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -33,17 +33,8 @@ jobs:
if: > if: >
!startsWith(vars.ROLE, 'forgejo-') && ( !startsWith(vars.ROLE, 'forgejo-') && (
github.event.pull_request.merged github.event.pull_request.merged
&& ( &&
( contains(toJSON(github.event.pull_request.labels), 'backport/v')
github.event.action == 'closed' &&
contains(toJSON(github.event.pull_request.labels), 'backport/v')
)
||
(
github.event.action == 'labeled' &&
contains(github.event.label.name, 'backport/v')
)
)
) )
runs-on: docker runs-on: docker
container: container: