Max workflow file size?

Is there a maximum size on the workflow file? My workflow file is 890235 bytes (it’s autogenerated from a much smaller template). I’m sure that it’s valid. However, the CI run immediately aborts with the error “every step must define a uses or run key”, without kicking off any jobs. If I remove a few lines of comments (making the file smaller), then this error goes away. This makes me suspect that I’ve run into some sort of limit.

What can I do about this?

@FooBarWidget,

About the size of repository files, you can see “File and repository size limitations”:

  • We recommend repositories remain small, ideally less than 1 GB, and less than 5 GB is strongly recommended.
  • Individual files in a repository are strictly limited to a 100 MB maximum size limit. For more information , see “Working with large files”.

In your case, as a workaround, you can combine some communal sequential run steps within a composite run steps action.
Then in your workflow file, you just need to use this action, instead of directly writing these run steps in the workflow file. This can reduce the size of the workflow file.

890235 bytes isn’t even 1 MB though, so if file size is indeed the problem it’s not because it’s hitting the general file size limitations.

@brightran Thanks for the reply, but those are the limits of files in a repository. What’s the limit of a workflow file for Github Actions?

I thought it’s around 800 KB, but today I ran into a limit again and it seems this time it limits at ~500 KB. I’m now confused about what the actual limits are, and what I can do about them. There’s only so much I can save by using composite steps.

@FooBarWidget,

but those are the limits of files in a repository. What’s the limit of a workflow file for Github Actions?

I can only find the limit for repository files in the docs. There is not any docs mentions the limit for workflow files in the repository. Maybe, the size limit is applied to all the repository files, include the workflow files.

As we can see, your workflow file is even less than 1MB, so it should not exceed the limit.

I even guessed that whether there is any limit for the count of code lines in the workflow files, or the count of jobs and steps in the workflow, but I also did not find any docs mentioned these.

However, as I suggested above, to avoid the workflow files become too heavy, you can combine some steps within an action.