-
-
Notifications
You must be signed in to change notification settings - Fork 463
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(cli): Support GitHub Workflow Commands #681
Conversation
I think so. We could add something like CI {
/// Whether the CI is running in a specific environment, e.g. GitHub, GitLab, etc.
environment_name: Option<String>
}, We could create a new function to read the environment variable: pub(crate) fn new_ci() -> Self {
let environment_name = std::option_env!("GITHUB_ACTIONS").and_then(|value| {
Some(String::from(value))
});
Self {
report_mode: ReportMode::default(),
traversal_mode: TraversalMode::CI {
environment_name
},
max_diagnostics: MAXIMUM_DISPLAYABLE_DIAGNOSTICS,
}
} This will be called in the
I'm not sure what you mean; can you explain? |
Thanks for the feedback. I've updated the PR. However, I created an enum for the known environments (since we have to implement them, we can also name them): pub(crate) enum ExecutionEnvironment {
GitHub,
} I also used
As the workflow commands are just "CSV" 1, we need to escape I still haven't managed to get the diagnostic description due to the printer function using a biome_console We also need to set the env var Footnotes
|
@ematipico the tests are failing due to the workflow commands being emitted because the whole test suite is executed in GH Actions. |
We should disable this functionality in the snapshot tests; as you said, it would create a lot of friction. Although it would be great if we could have some assertions before printing the snapshot, to make sure that the output is correct. We can use the |
@ematipico I've added it to the redaction in a9d5572. There are cases where a workflow command is emitted without a "normal" diagnostic message, which results in the output being empty. To match against current snapshots, I've refactored the method to return an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am delighted to have this feature and merge it! I am sure that we will need more changes, like setting up a github token/permission, because the github action will attempt to write something in CI.
I plan to release a nightly tomorrow and start testing it on other repositories
Summary
See discussion in #441
WIP
Open questions / TODO:
TraversalMode::CI
that states if the cli is running in some CI (determined by the env vars).