feat: add cli option to set concurrent jobs count (#2762)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Bengt Brodersen
2025-05-23 10:05:42 +02:00
committed by GitHub
parent b5469ac4ca
commit 16b86a64a9
3 changed files with 20 additions and 6 deletions

View File

@@ -62,6 +62,7 @@ type Input struct {
useNewActionCache bool
localRepository []string
listOptions bool
concurrentJobs int
}
func (i *Input) resolve(path string) string {

View File

@@ -127,6 +127,7 @@ func createRootCommand(ctx context.Context, input *Input, version string) *cobra
rootCmd.PersistentFlags().BoolVarP(&input.useNewActionCache, "use-new-action-cache", "", false, "Enable using the new Action Cache for storing Actions locally")
rootCmd.PersistentFlags().StringArrayVarP(&input.localRepository, "local-repository", "", []string{}, "Replaces the specified repository and ref with a local folder (e.g. https://github.com/test/test@v0=/home/act/test or test/test@v0=/home/act/test, the latter matches any hosts or protocols)")
rootCmd.PersistentFlags().BoolVar(&input.listOptions, "list-options", false, "Print a json structure of compatible options")
rootCmd.PersistentFlags().IntVar(&input.concurrentJobs, "concurrent-jobs", 0, "Maximum number of concurrent jobs to run. Default is the number of CPUs available.")
rootCmd.SetArgs(args())
return rootCmd
}
@@ -635,6 +636,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
ReplaceGheActionTokenWithGithubCom: input.replaceGheActionTokenWithGithubCom,
Matrix: matrixes,
ContainerNetworkMode: docker_container.NetworkMode(input.networkName),
ConcurrentJobs: input.concurrentJobs,
}
if input.useNewActionCache || len(input.localRepository) > 0 {
if input.actionOfflineMode {