Skip to content

Commit 91b03cc

Browse files
committed
chore: clean up actions
1 parent 2b97a89 commit 91b03cc

File tree

16 files changed

+38
-58
lines changed

16 files changed

+38
-58
lines changed

.github/actions/Cargo.lock

Lines changed: 15 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[workspace]
55
members = [
66
"ci-shared",
7-
"ci-crates",
7+
"crates-reporter",
88
"clippy-annotation-reporter",
99
]
1010
resolver = "2"

.github/actions/ci-crates/src/lib.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/actions/ci-shared/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ publish = false
1010

1111
[dependencies]
1212
anyhow = "1.0"
13+
cargo_metadata = "0.23.1"
1314
log = "0.4"
1415
toml = "0.8"
1516
serde = { version = "1", features = ["derive"] }
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use anyhow::{bail, Context, Result};
55
use std::process::Command;
66

7-
/// Run `git fetch --depth=1 origin <base_ref>` to ensure the base ref is available locally.
87
pub fn fetch_base(base_ref: &str) -> Result<()> {
98
log::info!("Fetching base branch: {base_ref}");
109

@@ -18,16 +17,12 @@ pub fn fetch_base(base_ref: &str) -> Result<()> {
1817
.context("Failed to run git fetch")?;
1918

2019
if !status.success() {
21-
// Non-fatal: warn but do not abort (mirrors `|| true` in the bash version)
2220
log::warn!("git fetch for {base_ref} returned non-zero exit code; continuing");
2321
}
2422

2523
Ok(())
2624
}
2725

28-
/// Return the list of files changed between `origin/<base_ref>...HEAD` (three-dot diff).
29-
///
30-
/// Uses `git diff --name-only origin/<base_ref>...HEAD`.
3126
pub fn changed_files(base_ref: &str) -> Result<Vec<String>> {
3227
let output = Command::new("git")
3328
.args(["diff", "--name-only", &format!("origin/{base_ref}...HEAD")])

.github/actions/ci-shared/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33

44
pub mod crate_detection;
55
pub mod github_output;
6+
pub mod git;
7+
pub mod workspace;

.github/actions/ci-crates/src/workspace.rs renamed to .github/actions/ci-shared/src/workspace.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use std::collections::{HashMap, HashSet, VecDeque};
99
/// Parsed workspace metadata with reverse-dependency index.
1010
pub struct WorkspaceMetadata {
1111
packages: Vec<Package>,
12-
/// Maps each crate name to the list of workspace crates that depend on it.
1312
reverse_deps: HashMap<String, Vec<String>>,
1413
workspace_root: Utf8PathBuf,
1514
}
@@ -105,8 +104,6 @@ mod tests {
105104
s.iter().map(|s| s.to_string()).collect()
106105
}
107106

108-
// --- affected_from ---
109-
110107
#[test]
111108
fn affected_from_empty_seeds_returns_empty() {
112109
let meta = make_meta(&[]);
@@ -171,8 +168,6 @@ mod tests {
171168
);
172169
}
173170

174-
// --- load() integration ---
175-
176171
#[test]
177172
fn load_returns_non_empty_workspace() {
178173
let meta = load().expect("load() should succeed against the real workspace");

.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::{error, info};
10+
use log::info;
1111
use octocrab::Octocrab;
1212

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

.github/actions/ci-crates/Cargo.toml renamed to .github/actions/crates-reporter/Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
[package]
5-
name = "ci-crates"
5+
name = "crates-reporter"
66
version = "0.1.0"
77
edition = "2021"
88
rust-version = "1.84.1"
9+
description = "GitHub Action for reporting modified crates and transitive dependencies"
10+
homepage = "https://github.com/DataDog/libdatadog/tree/main/.github/actions/changed-crates"
11+
repository = "https://github.com/DataDog/libdatadog/tree/main/.github/actions/changed-crates"
912
publish = false
1013

11-
[[bin]]
12-
name = "changed-crates"
13-
path = "src/bin/changed_crates.rs"
14-
1514
[dependencies]
1615
ci-shared = { path = "../ci-shared" }
1716
anyhow = "1.0"

.github/actions/changed-crates/action.yml renamed to .github/actions/crates-reporter/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ runs:
4545
shell: bash
4646
run: |
4747
cd ${{ github.action_path }}/..
48-
cargo build --release -p ci-crates
48+
cargo build --release -p crates-reporter
4949
5050
- name: Run change reporter
5151
id: detect
@@ -58,7 +58,7 @@ runs:
5858
echo "status=skipped" >> $GITHUB_OUTPUT
5959
exit 0
6060
fi
61-
if RUST_LOG=debug ${{ github.action_path }}/../target/release/changed-crates $PR_BASE_REF; then
61+
if RUST_LOG=debug ${{ github.action_path }}/../target/release/crates-reporter $PR_BASE_REF; then
6262
echo "status=success" >> $GITHUB_OUTPUT
6363
else
6464
echo "status=skipped" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)