feat: add flag to always run the checkout action (#1049)

act has a feature that skips the checkout action to do a remote
checkout when a local checkout exists. in some cases, e.g. when
running act in a CI, you always want to clone the repository.
This commit is contained in:
Robert Kowalski
2022-03-21 12:23:06 +01:00
committed by GitHub
parent 4d7107161e
commit f09cdb8443
5 changed files with 9 additions and 1 deletions

View File

@@ -708,6 +708,10 @@ func setActionRuntimeVars(rc *RunContext, env map[string]string) {
}
func (rc *RunContext) localCheckoutPath() (string, bool) {
if rc.Config.NoSkipCheckout {
return "", false
}
ghContext := rc.getGithubContext()
for _, step := range rc.Run.Job().Steps {
if isLocalCheckout(ghContext, step) {

View File

@@ -48,6 +48,7 @@ type Config struct {
ArtifactServerPath string // the path where the artifact server stores uploads
ArtifactServerPort string // the port the artifact server binds to
CompositeRestrictions *model.CompositeRestrictions // describes which features are available in composite actions
NoSkipCheckout bool // do not skip actions/checkout
}
// Resolves the equivalent host path inside the container

View File

@@ -92,7 +92,7 @@ func (sc *StepContext) Executor(ctx context.Context) common.Executor {
remoteAction.URL = rc.Config.GitHubInstance
github := rc.getGithubContext()
if remoteAction.IsCheckout() && isLocalCheckout(github, step) {
if remoteAction.IsCheckout() && isLocalCheckout(github, step) && !rc.Config.NoSkipCheckout {
return func(ctx context.Context) error {
common.Logger(ctx).Debugf("Skipping local actions/checkout because workdir was already copied")
return nil