How do I split a single step into multiple sections

I have a step that runs some validation and cross references stuff. It outputs ~10.000 lines and I would like to section this up into multiple sections. The output touches roughly 8 projects and each project contains data for 1-12 languages.

Is there any way I can section up the output so I somehow expand each project and preferably each language inside each project?

Does the step use your own action?
There is a function in action toolkit > core library to wrap chunks of output in foldable groups. You could use it in your JavaScript Action.

const core = require('@actions/core')

// Manually wrap output
core.startGroup('Do some function')
doSomeFunction()
core.endGroup()

// Wrap an asynchronous function call
const result = await core.group('Do something async', async () => {
  const response = await doSomeHTTPRequest()
  return response
})
1 Like

That is pretty neat! but not as of now I’m not using my own action, If I do however this is a great tip!

1 Like

If you have control over the output, you can also use these functions via the :: syntax:
https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#using-workflow-commands-to-access-toolkit-functions

See group and endgroup

3 Likes

Tried this and it worked pretty much as expected. I would have loved to have the options of having groups inside groups but besides that that feature is great!

The output its now readable :smiley:

Thank you!

One little thing would be to add an example to the documentation, it did not take long to figure out but might help the next dev.

Something like:

Grouping output

::group::{Group Heading}
::endgroup::

Creates a group that is expandable in the output, multiple lines can be grouped under a heading

example:

echo "::group::Group Heading"
echo "This will be inside the group"
echo "Second line inside the group"
echo "::endgroup::"
1 Like