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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 06, 2020 at 09:31:25AM -0700, Junio C Hamano wrote:

> Đoàn Trần Công Danh  <congdanhqx@xxxxxxxxx> writes:
> 
> > On 2020-05-05 20:56:58-0700, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> >> Đoàn Trần Công Danh  <congdanhqx@xxxxxxxxx> writes:
> >> > +--------------
> >> > +$ 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.
> >
> > It isn't that horrible as it sounds. It only removes the files that are
> > currently added in index, which is the same with tracked files in old
> > branch, and we can get it back by switching back to old branch.
> >
> > I decided to make an orphanage branch because I would like to save
> > time and network bandwidth for the "check-ci" jobs.
> 
> I didn't say it is wrong to record a tree with a single file
> (allow-ref) in a commit that is pointed by the ci-config ref.
> 
> I would have expected you to create such a commit in an otherwise
> empty repository, and push into your fork of Git at GitHub.  That
> way, you won't have to checkout and/or refresh the index all of the
> 3800+ files.

Yeah, I agree that all of the mechanisms for dealing with the unrelated
history are somewhat awkward. Another issue is that you can't just:

  git clone --single-branch -b refs/ci/config my-config

to work on it, because "-b" wants only heads or tags (we could address
that by putting it in refs/heads/ci-config or similar).

If we do go the javascript route, perhaps it would make sense for
refs/ci/config to be a single blob containing a snippet of javascript
with several functions. And then we could just eval() that and call the
appropriate functions (if defined).

Then a sample can live in the main repo with something like:

  # This file contains functions which will be run by the GitHub
  # Actions CI script.
  #
  # You may customize it for your own fork by modifying it on any branch
  # you like, and installing with:
  #
  #  git push <remote> $(git rev-parse HEAD:ci/config):refs/ci/config
  #
  # [allow_ref() sample definition and documentation....]

That sidesteps most of those issues.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux