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