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

From: Đoàn Trần Công Danh <[email-masked]>
Date: Tue, 5 May 2020 07:34:38 +0700

On 2020-05-04 12:23:11-0400, Jeff King <[email-masked]> wrote:
> On Mon, May 04, 2020 at 10:49:31PM +0700, Đoàn Trần Công Danh wrote:
> 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).

When I was doing this, I couldn't create a fork of my fork to check
the syntax for GitHub PR. So, I pick a safe step.

Turn out, I can create PR against my own fork.
And, it's possible to omit the branch filter entirely.

> > +    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.

>From my reading, GitHub Actions only accepts filter by refname.

>From GitHub manual, we can limit tags selection by: 
-------------8<------
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index adf8824af1..9bba0ce068 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -11,7 +11,8 @@ on:
       - pu
       - 'for-ci**'
     tags:
-      - '*'
+      - '**'
+      - '!**wip**'
 
 env:
   DEVELOPER: 1
---------------->8-------------

But, I'm running into GitHub internal error with this snippet.
I'll look into it later.

> 
> > +  push:
> > +    branches:
> > +      - maint
> > +      - master
> > +      - next
> > +      - jch
> > +      - pu
> 
> What happened to "for-ci" (presumably "for-ci/**")?

Hm, it was lost when I created a lot of branch for testing and I send the incorrect one out.
It'll be correct next time.

-- 
Danh