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

feat: github actions logging #752

Merged
merged 6 commits into from Jul 19, 2022
Merged

feat: github actions logging #752

merged 6 commits into from Jul 19, 2022

Conversation

nhedger
Copy link
Contributor

@nhedger nhedger commented Jul 9, 2022

This PR adds support for logging in GitHub Actions runners using annotations.

Description

When the GITHUB_ACTIONS environment variable is set, instead of logging a message with console.log, a GitHub Actions workflow command is used to log the message.

Copy link
Member

@joaomoreno joaomoreno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool idea! But I don't think it warrants bringing in additional dependencies. Luckily we can achieve the same by simply outputting in their expected format: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-notice-message

@nhedger
Copy link
Contributor Author

nhedger commented Jul 15, 2022

I actually went without the dependency in the first place but realized that it contains a function for escaping the data and thought that using it would keep it more consistent.

https://github.com/actions/toolkit/blob/c5278cdd088a8ed6a87dbd5c80d7c1ae03beb6e5/packages/core/src/command.ts#L80-L85

I'm happy to remove the dependency and import that single function if you still think importing the dependency is overkill.

@joaomoreno
Copy link
Member

joaomoreno commented Jul 17, 2022

Yeah, it's definitely better to avoid the extra dependency. It also seems that all we need escaping is the odd %.

src/util.ts Outdated Show resolved Hide resolved
Co-authored-by: João Moreno <mail@joaomoreno.com>
@joaomoreno joaomoreno self-assigned this Jul 19, 2022
@joaomoreno joaomoreno merged commit 9c50aa6 into microsoft:main Jul 19, 2022
@github-actions
Copy link

🎉 This PR is included in version 2.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nhedger nhedger deleted the feat/github-actions-messages branch July 19, 2022 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants