From: Phillip Wood Date: Thu, 07 Sep 2023 10:04:33 GMT Subject: Re: [PATCH 0/2] replacing ci/config/allow-ref with a repo variable Message-ID: In-Reply-To: <20230905072444.GH199565@coredump.intra.peff.net> On 05/09/2023 08:24, Jeff King wrote: > On Mon, Sep 04, 2023 at 10:56:15AM +0100, Phillip Wood wrote: > >>> Yes, I think it would be possible to do something like: >>> >>> if: | >>> (vars.CI_BRANCHES == '' || contains(vars.CI_BRANCHES, github.ref_name)) && >>> !contains(vars.CI_BRANCHES_REJECT, github.ref_name) >>> >>> It doesn't allow globbing, though. Do you need that? >> >> Oh I'd missed that, yes I do. All the globs are prefix matches but I'm not >> sure that helps. > > It does make it easier. There's no globbing function available to us, > but if we know something is a prefix, there's a startsWith() we can use. > It does seem we're getting a combinatorial expansion of things to check, > though: > > - full names to accept > - full names to reject > - prefixes to accept > - prefixes to reject > > I wrote "prefixes" but I'm actually not sure how feasible that is. That > implies iterating over the list of prefixes, which I'm not sure we can > do. I scanned the github documentation the other day and wondered if it would be possible to use with fromJson with a json array to do a prefx match on each element. It all sounds like it is getting a bit complicated though. Best Wishes Phillip > -Peff