nolint:gocyclo
(ctx context.Context, input *Input)
| 389 | |
| 390 | //nolint:gocyclo |
| 391 | func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []string) error { |
| 392 | return func(cmd *cobra.Command, args []string) error { |
| 393 | if input.jsonLogger { |
| 394 | log.SetFormatter(&log.JSONFormatter{}) |
| 395 | } |
| 396 | |
| 397 | if ok, _ := cmd.Flags().GetBool("bug-report"); ok { |
| 398 | ctx, cancel := common.EarlyCancelContext(ctx) |
| 399 | defer cancel() |
| 400 | return bugReport(ctx, cmd.Version) |
| 401 | } |
| 402 | if ok, _ := cmd.Flags().GetBool("man-page"); ok { |
| 403 | return generateManPage(cmd) |
| 404 | } |
| 405 | if input.listOptions { |
| 406 | return listOptions(cmd) |
| 407 | } |
| 408 | |
| 409 | if ret, err := container.GetSocketAndHost(input.containerDaemonSocket); err != nil { |
| 410 | log.Warnf("Couldn't get a valid docker connection: %+v", err) |
| 411 | } else { |
| 412 | os.Setenv("DOCKER_HOST", ret.Host) |
| 413 | input.containerDaemonSocket = ret.Socket |
| 414 | log.Infof("Using docker host '%s', and daemon socket '%s'", ret.Host, ret.Socket) |
| 415 | } |
| 416 | |
| 417 | if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" && input.containerArchitecture == "" { |
| 418 | l := log.New() |
| 419 | l.SetFormatter(&log.TextFormatter{ |
| 420 | DisableQuote: true, |
| 421 | DisableTimestamp: true, |
| 422 | }) |
| 423 | l.Warnf(" \U000026A0 You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. \U000026A0 \n") |
| 424 | } |
| 425 | |
| 426 | log.Debugf("Loading environment from %s", input.Envfile()) |
| 427 | envs := parseEnvs(input.envs) |
| 428 | _ = readEnvs(input.Envfile(), envs) |
| 429 | |
| 430 | log.Debugf("Loading action inputs from %s", input.Inputfile()) |
| 431 | inputs := parseEnvs(input.inputs) |
| 432 | _ = readEnvs(input.Inputfile(), inputs) |
| 433 | |
| 434 | log.Debugf("Loading secrets from %s", input.Secretfile()) |
| 435 | secrets := newSecrets(input.secrets) |
| 436 | _ = readEnvsEx(input.Secretfile(), secrets, true) |
| 437 | |
| 438 | if _, hasGitHubToken := secrets["GITHUB_TOKEN"]; !hasGitHubToken { |
| 439 | ctx, cancel := common.EarlyCancelContext(ctx) |
| 440 | defer cancel() |
| 441 | secrets["GITHUB_TOKEN"], _ = gh.GetToken(ctx, "") |
| 442 | } |
| 443 | |
| 444 | log.Debugf("Loading vars from %s", input.Varfile()) |
| 445 | vars := newSecrets(input.vars) |
| 446 | _ = readEnvs(input.Varfile(), vars) |
| 447 | |
| 448 | matrixes := parseMatrix(input.matrix) |
searching dependent graphs…