Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@actions/core logging - extract AnnotationProperties from Error instances #1696

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

JamesMGreene
Copy link
Contributor

@JamesMGreene JamesMGreene commented Mar 28, 2024

Background

While improving a logging situation in actions/configure-pages, I had the idea that it might be nice if the @actions/core module's error, warning, and notice commands would implicitly extract their optional AnnotationProperties metadata parameter from the stack traces of the sometimes-provided Error instance parameter. 💡

This PR is my rough cut at what that might look like. 💝

Totally open to revisions, refactoring, etc. 👂🏻


Edit: I updated the behavior for defaulting the properties parameter such that I think this could probably be considered a non-breaking change. 🤞🏻


ℹ️ Clarification after chatting with @joshmgross a bit: this behavior will create an annotation for whatever action/step is utilizing the @actions/core module for logging. That may or may not align with the intended use of annotations, which commonly point to files that are present within the consuming repository. That said, it does still successfully display an annotation in the workflow summary (although the link it generates won't match any target if the file isn't in the repo):

annotation display with fake file

@JamesMGreene JamesMGreene requested a review from a team as a code owner March 28, 2024 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant