Re: [PATCH] ci: avoid unnecessary builds
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Nov 10, 2022, 02:40 UTC
- Message-ID
- <Y2xknh1TqMTdpIxE@nand.local>
- In-Reply-To
- <Y2uygXD7R+fsC0as@coredump.intra.peff.net>
On Wed, Nov 09, 2022 at 09:00:33AM -0500, Jeff King wrote:
Show 16 quoted lines
> On Tue, Nov 08, 2022 at 10:16:15AM +0100, Johannes Schindelin wrote: > > > > As an aside, I wish there was a way to interpret per-repo environment > > > variables in the actual action config. > > > > There kind of is. "Kind of" because it is not _really_ a per-repo variable > > (those do not exist on GitHub), but there are topics you can set. These > > are relatively free-form labels you can attach to _your_ fork, and these > > labels show up below the "About" section and the link to the home page (if > > any) on the right side of your respository. AFAICT these topics are not > > inherited automatically when forking a repository, which is precisely what > > we want. See > > https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/classifying-your-repository-with-topics > > for more details on that. > > Ah, that's very clever, thank you!
Very cute.
Show 14 quoted lines
> For the original problem that motivated me adding ci-config in the first
> place, branch selection, I think we could do this:
>
> if: |
> !contains(join(github.event.repository.topics), 'ci-only-') ||
> contains(github.event.repository.topics, format('ci-only-{0}', github.ref_name))
>
> and then by default we'd continue to build for all pushes, but if you
> add ci-only-foo as a repo topic, then we'd build only refs/heads/foo.
>
> I may see if I can work this into our workflow file. Even if we can't
> get rid of ci-config for the skip-successful-build feature, this would
> still save CPU by dropping even ci-config when the branch should be
> skipped entirely.Yeah. I'd be hesitant to see a bunch of CI configuration knobs get folded into the repository topics feature, but a clear "save CI minutes if we don't care about building these branch(es)" is useful.
Thanks, Taylor