Emit GitHub Actions workflow commands for all diagnostics. Each diagnostic is printed as a `::error` or `::warning` line so that GitHub Actions surfaces them as inline annotations on pull request diffs. See:
(file_diagnostics: &[(String, Vec<FileDiagnostic>)])
| 781 | /// GitHub Actions surfaces them as inline annotations on pull request diffs. |
| 782 | /// See: <https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions> |
| 783 | fn print_github_annotations(file_diagnostics: &[(String, Vec<FileDiagnostic>)]) { |
| 784 | for (path, diagnostics) in file_diagnostics { |
| 785 | for diag in diagnostics { |
| 786 | let level = match diag.severity { |
| 787 | DiagnosticSeverity::ERROR => "error", |
| 788 | DiagnosticSeverity::WARNING => "warning", |
| 789 | _ => "notice", |
| 790 | }; |
| 791 | let message = format_github_message(&diag.message); |
| 792 | let title = diag.identifier.as_deref().unwrap_or(""); |
| 793 | if title.is_empty() { |
| 794 | println!( |
| 795 | "::{level} file={path},line={line},col=0::{message}", |
| 796 | line = diag.line, |
| 797 | ); |
| 798 | } else { |
| 799 | println!( |
| 800 | "::{level} file={path},line={line},col=0,title={title}::{message}", |
| 801 | line = diag.line, |
| 802 | ); |
| 803 | } |
| 804 | } |
| 805 | } |
| 806 | } |
| 807 | |
| 808 | /// Format a message for GitHub Actions workflow commands. |
| 809 | /// |
no test coverage detected