Re: [PATCH v2 1/2] CI: limit GitHub Actions to designated branches
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 6, 2020, 03:56 UTC
- Message-ID
- <xmqqr1vx90mt.fsf@gitster.c.googlers.com>
- In-Reply-To
- <20200506004612.GE927@danh.dev>
Đoàn Trần Công Danh <congdanhqx@gmail.com> writes:
Show 11 quoted lines
> diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches > index 8686318550..8175424929 100644 > --- a/Documentation/SubmittingPatches > +++ b/Documentation/SubmittingPatches > @@ -82,6 +82,18 @@ Alternately, you can u > on Linux, macOS, and Windows) by pushing into a branch in your fork > or opening a GitHub's Pull Request against > https://github.com/git/git.git or a fork of that repository. > +In the event that you only want to trigger GitHub Actions for specific > +refname, you can create an executable file named `allow-ref` in > +`refs/ci/config`. Those below steps may help you:
"These steps below" or "The follwoing steps", perhaps.
Show 5 quoted lines
> +-------------- > +$ git checkout --orphan ci-config > +$ cp contrib/ci-config-allow-ref allow-ref > +$ $EDITOR allow-ref > +$ git rm -rf .
This sounds horrible. You just nuked the entire files in the working tree you use for your everyday Git hacking to edit a single file.
> +$ git commit allow-ref
If allow-ref were added to the index before this "git commit", the previous "git rm -rf ." would have removed it. Since the surviving allow-ref file must have been untracked, this "git commit" would not commit anything. Forgot to "git add"?
> +$ git push <your-fork> HEAD:refs/ci/config > +--------------
Show 11 quoted lines
> Do not forget to update the documentation to describe the updated > behavior and make sure that the resulting documentation set formats > diff --git a/contrib/ci-config-allow-ref b/contrib/ci-config-allow-ref > new file mode 100755 > index 0000000000..b53e9ddbd0 > --- /dev/null > +++ b/contrib/ci-config-allow-ref > @@ -0,0 +1,9 @@ > +#!/bin/sh > +# Sample filter for GitHub Actions > +# GitHub Actions will run if and only if this script exit with zero status
s/exit/exits/;
As the instruction above says, we should set the example and describe the behaviour we implemented initially. Something as basic like ...
# Build any branch other than those whose name begins with "no-ci"
Show 6 quoted lines
> + > +REFNAME="$1" > + > +case "$REFNAME" in > +refs/heads/no-ci*) exit 1 ;; > +esac