Skip to content

Commit 7bb0c1f

Browse files
committed
WIP - adding log level input and allowing job to fail
1 parent 53b1f52 commit 7bb0c1f

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

.github/actions/clippy-annotation-reporter/action.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ inputs:
1515
description: 'Base branch to compare against'
1616
required: false
1717
default: 'origin/main'
18+
log_level:
19+
description: 'Log level (error, warn, info, debug, trace)'
20+
required: false
21+
default: 'info'
1822

1923
runs:
2024
using: 'composite'
@@ -39,14 +43,6 @@ runs:
3943
shell: bash
4044
run: |
4145
FILE_PATH="data-pipeline/src/trace_exporter/mod.rs"
42-
43-
echo "Direct branch comparison for $FILE_PATH:"
44-
echo "==== BASE BRANCH ===="
45-
git show "origin/main:$FILE_PATH" | grep -c "#\[allow(clippy::unwrap_used"
46-
47-
echo "==== HEAD BRANCH ===="
48-
git show "HEAD:$FILE_PATH" | grep -c "#\[allow(clippy::unwrap_used"
49-
5046
- name: Run annotation reporter
5147
shell: bash
5248
run: |

.github/actions/clippy-annotation-reporter/src/analyzer.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
99
use anyhow::{Context as _, Result};
1010
use log::{debug, error, info};
11-
use octocrab::params::pulls::MediaType::Raw;
1211
use octocrab::Octocrab;
1312
use regex::Regex;
1413
use std::collections::{HashMap, HashSet};

.github/actions/clippy-annotation-reporter/src/commenter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! including finding existing comments and updating or creating comments.
88
99
use anyhow::{Context as _, Result};
10-
use log::{debug, error, info};
10+
use log::{error, info};
1111
use octocrab::Octocrab;
1212

1313
/// Post or update a comment on a PR with the given report

.github/actions/clippy-annotation-reporter/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
22
// SPDX-License-Identifier: Apache-2.0
33

4+
use std::env;
45
use anyhow::{Context as _, Result};
56
use log::info;
67
use octocrab::Octocrab;
@@ -15,6 +16,13 @@ use crate::report_generator::generate_report;
1516

1617
#[tokio::main]
1718
async fn main() -> Result<()> {
19+
let log_level = env::var("INPUT_LOG_LEVEL").unwrap_or_else(|_| "info".to_string());
20+
21+
// Set RUST_LOG if not already set
22+
if env::var("RUST_LOG").is_err() {
23+
env::set_var("RUST_LOG", &log_level);
24+
}
25+
1826
env_logger::init();
1927

2028
info!("Clippy Annotation Reporter starting...");

.github/workflows/clippy-annotation-reporter.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ permissions:
1010
jobs:
1111
clippy-annotation-reporter:
1212
runs-on: ubuntu-latest
13+
continue-on-error: true
1314
env:
1415
CARGO_TERM_COLOR: always
1516
steps:
@@ -33,3 +34,4 @@ jobs:
3334
with:
3435
github-token: "${{ secrets.GITHUB_TOKEN }}"
3536
allow-annotation-rules: "expect_used, panic, todo, unimplemented, unwrap_used"
37+
log_level: 'info'

0 commit comments

Comments
 (0)