layout_gha for native GitHub Action logging #220
Conversation
|
I have yet to add unit tests etc as I wanted to discuss the PR with you first |
|
|
||
| namespaces_default <- function() { | ||
| has_glue <- requireNamespace("glue", quietly = TRUE) | ||
| is_running_gha <- isTRUE(Sys.getenv("GITHUB_ACTIONS") == "true") && !needs_stdout() |
There was a problem hiding this comment.
I need to think about this one, as I can imagine (and know) folks using logger in GHA writing outside of the GHA logs, although hopefully explicitly setting the layout as well 🤔
Anyway, this is a super cool idea, thank you! I'm traveling/teaching in the next ~48 hours, but I will definitely get back to this PR for a more detailed look on Friday.
There was a problem hiding this comment.
Yeah, I can imagine. Ultimatively it is your call and I understand being weary of messing up peoples current deployment. On the other hand it would be a nice quality-of-life improvement for new projects
thomasp85
left a comment
There was a problem hiding this comment.
It would be nice to also support the summary log that GHA provides, but there is no existing way of specifying a job summary with logger. Is that something you have thought about, or can you see a good interface for such a functionality (maybe in a way that is broader than GHA)
For context, the GHA summary is created by writing to a separate file whose path is given as an environment variable
|
Can I get your eyes on this again when you have the time? |
|
Sorry, I totally missed the reminder on this 🤦 |
This is an attempt to port the functionality in https://github.com/hadley/gha to logger.
The current setup is "invasive" in the sense that if it detects you are running in gha it will default to using
layout_ghaandappender_stderr.Since GHA has fewer log levels than logger, some are getting squashed together silently, but the title will be set to the original log level (except for
TRACEsince the gha debug logger doesn't accept a title).GHA allows you to link the log to a specific file and potential location in the file but since I haven't found a great way to reconcile this with what information logger passes along it is currently unused