Skip to content

Commit b91890f

Browse files
committed
fix: skip step-checker in container jobs where _diag is not accessible
The step-checker was causing warnings in container jobs because the _diag directory exists on the host but is not mounted into containers. This change adds container detection via /proc/1/cgroup and skips the step-checker gracefully when running inside a container, allowing sticky disk commits to proceed normally. Affects container jobs only - regular jobs continue to work as before.
1 parent 58d9166 commit b91890f

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

dist/post/index.js

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

src/step-checker.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,29 @@ export async function checkPreviousStepFailures(
2323
runnerBasePath?: string,
2424
): Promise<StepFailureCheck> {
2525
try {
26+
// Check if we're running inside a container.
27+
// In container jobs, _diag is not mounted and not accessible.
28+
const isContainer = await (async () => {
29+
try {
30+
const cgroup = await fs.readFile("/proc/1/cgroup", "utf-8");
31+
return cgroup.includes("docker") || cgroup.includes("containerd");
32+
} catch {
33+
return false;
34+
}
35+
})();
36+
37+
if (isContainer) {
38+
core.debug(
39+
"Running inside container - _diag directory not accessible, skipping step failure check",
40+
);
41+
return {
42+
hasFailures: false,
43+
failedCount: 0,
44+
error:
45+
"Step failure checking skipped: running inside container where _diag is not accessible",
46+
};
47+
}
48+
2649
// If no base path provided, try to detect the runner root
2750
if (!runnerBasePath) {
2851
// In GitHub Actions, we're typically in /home/runner/_work/{repo}/{repo}

0 commit comments

Comments
 (0)