vivo-project / VIVO

VIVO is an extensible semantic web application for research discovery and showcasing scholarly work
http://vivoweb.org
BSD 3-Clause "New" or "Revised" License
205 stars 127 forks source link

GitHub build action improvement for PR #3833

Open chenejac opened 1 year ago

chenejac commented 1 year ago

Is your feature request related to a problem? Please describe. The VIVO build action is always cloning main branch of vivo-project/Vitro repository - https://github.com/vivo-project/VIVO/blob/main/.github/workflows/build.yml#L16. In some cases it is failing, although the pair of VIVO and Vitro PR which are together resolving some issue can build together.

Describe the solution you'd like One solution might be based on naming convention.

A VIVO PR is defined by using source repository owner/organization, source repository name (VIVO), and source branch name, on target repository owner/organization, target repository name (VIVO), and target branch name. For instance, in the case of this PR:

source repository owner/organization = TAMULib
source repository name = VIVO
source branch name = issue-3767
target repository owner/organization = vivo-project
target repository name = VIVO
target branch name = main

The line https://github.com/vivo-project/VIVO/blob/main/.github/workflows/build.yml#L16 should be replaced with script representing the following pseudo code:

  1. try git clone -b {source branch name} --single-branch https://github.com/{source repository owner/organization}/Vitro.git ../Vitro
  2. if not exist try git clone -b {target branch name} --single-branch https://github.com/{target repository owner/organization}/Vitro.git ../Vitro
  3. if not exist try git clone -b https://github.com/{target repository owner/organization}/Vitro.git ../Vitro

LIMITATION: Naming convention is needed:

  1. Pairs of branches with same names in VIVO and Vitro repositories are needed, e.g. VIVO i18n-redesign, Vitro i18n-redesign, VIVO issue-3767, Vitro issue-3767, etc.
  2. Repositories names should be VIVO and Vitro
  3. If naming convention is broken, the github action might fail, for instance for this pair of PRs - VIVO PR, Vitro PR

Describe alternatives you've considered

  1. Parameters for GitHub action
  2. Vitro as a submodule in VIVO
chenejac commented 1 year ago

I believe the following variables can be used for pull_requests - github.ref, github.base_ref, github.head_ref.

Can we make one generic solution working building for push, pull_request and workflow_dispatch by using naming convention? Or we need different GitHub actions for build?