Re: [PATCH 0/2] replacing ci/config/allow-ref with a repo variable
- From
Jeff King <peff@peff.net>
- Date
- Sep 5, 2023, 07:24 UTC
- Message-ID
- <20230905072444.GH199565@coredump.intra.peff.net>
- In-Reply-To
- <d3d1109b-3a1f-4e8b-be8d-6581d45f1b81@gmail.com>
On Mon, Sep 04, 2023 at 10:56:15AM +0100, Phillip Wood wrote:
Show 10 quoted lines
> > 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.
-Peff