Subject: Re: [PATCH v2 1/2] CI: limit GitHub Actions to designated branches

From: Taylor Blau <[email-masked]>
Date: Mon, 4 May 2020 15:58:24 -0600

On Mon, May 04, 2020 at 12:23:11PM -0400, Jeff King wrote:
> On Mon, May 04, 2020 at 10:49:31PM +0700, Đoàn Trần Công Danh wrote:
>
> > diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
> > index fd4df939b5..ea43b03092 100644
> > --- a/.github/workflows/main.yml
> > +++ b/.github/workflows/main.yml
> > @@ -1,6 +1,18 @@
> >  name: CI/PR
> >
> > -on: [push, pull_request]
> > +on:
> > +  pull_request:
> > +    branches:
> > +      - '**'
>
> Doing "**" here makes sense to catch everything (it would be even better
> if we could just say "everything with a pull request" by omitting the
> branch filter entirely, but maybe that's not possible).
>
> > +    tags:
> > +      - '*'
>
> Would we want that here, too? I guess nobody is likely to push
> "foo/v1.2.3".
>
> Or on the flip side, would we want to tighten this? If I push a tag
> "wip", I probably don't want it built. Probably the right rule is
> "annotated tags only", but I suspect that's not possible.
>
> > +  push:
> > +    branches:
> > +      - maint
> > +      - master
> > +      - next
> > +      - jch
> > +      - pu
>
> What happened to "for-ci" (presumably "for-ci/**")?

Huh; I'm not sure that I'm sold on the idea of a 'for-ci' namespace
here. In addition to running 'make test' on patches locally before I
send them, I find it tremendously convenient for GitHub to run them for
me when I push 'tb/' branches up to 'ttaylorr/git'.

So, while the above is more-or-less what I'd expect the monitored list
of branches to look like (at least, ignoring the missing 'for-ci/**'
bits), I wish that I could also build every branch that I push up to my
fork.

Of course, I don't want to maintain a one-patch difference between
ttaylorr/git@master and git/git@master, so I wonder if we could get a
little more creative with these rules and actually run Actions on
*every* branch, but introduce a new first step which stops the rest of
the actions run (so that in practice we're not running CI on
non-integration branches in Junio's tree).

I figure that we need something more flexible than the 'push.branches'
list, but I'd be very curious to hear if something like what I'm
describing is possible.

> -Peff

Thanks,
Taylor