Skip to content

Commit 4c3657e

Browse files
authored
Merge pull request #27 from advanced-security/fix-container-path-issue
Fix container path issue and bump version to v0.1.5
2 parents 3c557a6 + 0d1859b commit 4c3657e

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

.release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "codeql-extractor-action"
22
repository: "advanced-security/codeql-extractor-action"
3-
version: 0.1.4
3+
version: 0.1.5
44

55
ecosystems:
66
- Docs

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "codeql-extractor-action"
33
description = "GitHub Action for CodeQL Extractors"
4-
version = "0.1.4"
4+
version = "0.1.5"
55
authors = ["GeekMasher"]
66

77
license = "MIT"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This action is designed to be used in conjunction with the [CodeQL][CodeQL] anal
2929

3030
```yml
3131
- name: "CodeQL Extractor Action"
32-
uses: advanced-security/[email protected].4
32+
uses: advanced-security/[email protected].5
3333
with:
3434
# Repository reference (e.g. "owner/repo", "owner/repo@ref")
3535
extractor: "advanced-security/codeql-extractor-iac"

action.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM ghcr.io/advanced-security/codeql-extractor-action:v0.1.4
1+
FROM ghcr.io/advanced-security/codeql-extractor-action:v0.1.5
22

33
ENTRYPOINT [ "codeql-extractor-action" ]

src/main.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,21 @@ async fn main() -> Result<()> {
287287
groupend!();
288288
}
289289

290-
action.set_sarif_results(sarif_output.display().to_string());
290+
// If the action is running in Actions, the SARIF file must be a relative path
291+
// This is because we assume that this code is running in a container which mounts
292+
// the repository at /github/workspace
293+
if std::env::var("CI").is_ok() {
294+
// If running in a CI environment, set the SARIF as a relative path
295+
let relative_path = sarif_output.strip_prefix(&cwd).unwrap_or(&sarif_output);
296+
log::debug!(
297+
"CI environment detected, setting SARIF path as relative: {}",
298+
relative_path.display()
299+
);
300+
action.set_sarif_results(relative_path.display().to_string());
301+
} else {
302+
log::debug!("Setting SARIF path as absolute: {}", sarif_output.display());
303+
action.set_sarif_results(sarif_output.display().to_string());
304+
}
291305

292306
log::info!("All databases created and analyzed");
293307

0 commit comments

Comments
 (0)