H5PT-227 Add optional branch arg to setup#185
Open
SimenBergo wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
H5PT-227 Add optional branch arg to setup
Let
h5p setupclone the target content type from a specific gitbranch instead of only master or a release tag.
Why:
CI needs to test the exact code in an open PR, but setup could
only fetch master/tags, so there was no way to build and serve a
proposed version of a content type. This lets a GitHub Action set up
and run the dev server on a PR branch and execute its e2e tests the
moment a PR is opened, catching regressions before anything is
deployed to a test environment.
How:
The branch is threaded only to the library being set up; its
dependencies still resolve to their normal master/tag versions. The
existing clone() already supports --branch, so this just exposes it.
Download (zip) can't target a branch, so it falls back to clone when a
branch is given. The branch name is validated before it reaches the
git shell command to avoid injection from untrusted PR refs. Both new
params are optional, so existing callers are unaffected.
This is ment to mainly be used in test automation, so another option was considering, adding this logic in the ci-workflows repo. This did seem to violate responsibility splitting though, so it seemed more fitting to add this logic here.
Usage:
h5p setup h5p-true-false '' '' fix/my-bug-branch(version and download left empty; branch is the 4th positional arg)