MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / get_commit_hash

Method get_commit_hash

src/run_environment/github_actions/provider.rs:252–268  ·  view source on GitHub ↗
(&self, repository_root_path: &str)

Source from the content-addressed store, hash-verified

250 }
251
252 fn get_commit_hash(&self, repository_root_path: &str) -> Result<String> {
253 let repo = Repository::open(repository_root_path).context(format!(
254 "Failed to open repository at path: {repository_root_path}\n\
255 Make sure git is installed, and that `actions/checkout` used git to fetch the repository\n\
256 If necessary, install git before running `actions/checkout`.\n\
257 If you run into permission issues when running in Docker, you may need to also run \
258 `git config --global --add safe.directory $GITHUB_WORKSPACE` "
259 ))?;
260
261 let commit_hash = repo
262 .head()
263 .and_then(|head| head.peel_to_commit())
264 .context("Failed to get HEAD commit")?
265 .id()
266 .to_string();
267 Ok(commit_hash)
268 }
269
270 /// Validate that the environment is correctly configured for OIDC usage.
271 ///

Callers

nothing calls this directly

Calls 1

idMethod · 0.80

Tested by

no test coverage detected