Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@ Go [read the full docs](https://www.iffycan.com/lin/linlib.html), but here's a h
Other helpful hints:

- Sequences can include other sequences, thus chaining them together. See the `includes` param.

# GitHub Actions

When run on a Github Actions runner, step output will be put into folds by default. To disable this, set `LIN_DISABLE_FOLDS=true`
1 change: 1 addition & 0 deletions changes/new-Fold-output-in-20250813-101858.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fold output in Github Actions
10 changes: 10 additions & 0 deletions src/linpkg/linlib.nim
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ proc stamp(d:Duration):string =
proc run*(lin:Lin, args:openArray[string]):bool =
addExitProc(resetAttributes)

let isGITHUBACTIONS = getEnv("GITHUB_ACTIONS") == "true"
let doGithubActionsGrouping = isGITHUBACTIONS and getEnv("LIN_DISABLE_FOLDS") == ""
let steps = lin.collectSteps(args)
let grand_start = getTime()
result = true
Expand All @@ -314,6 +316,10 @@ proc run*(lin:Lin, args:openArray[string]):bool =
res:RunStatus
start = getTime()
step_total: Duration
if doGithubActionsGrouping:
stderr.writeLine &"::group::{fq_stepnumber} {step.fullname}"
stdout.flushFile()
stderr.flushFile()
stderr.styledWrite(styleDim, "[lin] ")
stderr.styledWriteLine(styleReverse, &"{fq_stepnumber} {step.fullname}")
try:
Expand Down Expand Up @@ -348,6 +354,10 @@ proc run*(lin:Lin, args:openArray[string]):bool =
color = fgCyan
code = "skipped"

if doGithubActionsGrouping:
stderr.flushFile()
stderr.writeLine "::endgroup::"
stdout.flushFile()
stderr.styledWrite(styleDim, "[lin] ")
stderr.styledWrite(color, styleReverse, &"{fq_stepnumber} {step.fullname}")
stderr.styledWriteLine(color, &" done {code} {step_total.stamp} {msg}")
Expand Down
Loading