Skip to content

Commit 1afddd3

Browse files
committed
ci: add GitHub token to buf-setup-action to avoid API rate limits
The buf-setup-action was hitting GitHub API rate limits for unauthenticated requests. Adding the GITHUB_TOKEN allows authenticated requests which have a much higher rate limit.
1 parent 015d69b commit 1afddd3

File tree

3 files changed

+39
-38
lines changed

3 files changed

+39
-38
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919

2020
- name: Setup Buf
2121
uses: bufbuild/buf-setup-action@v1
22+
with:
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
2224

2325
- name: Configure Buf Registry
2426
run: |

dist/post/index.js

Lines changed: 18 additions & 18 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: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,32 @@ export async function checkPreviousStepFailures(
2626
// Check if we're running inside a container.
2727
// In container jobs, _diag is not mounted and not accessible.
2828
const isContainer = await (async () => {
29+
// Check for /.dockerenv file (docker-specific).
2930
try {
30-
// Check for /.dockerenv file (docker-specific).
31-
try {
32-
await fs.access("/.dockerenv");
33-
return true;
34-
} catch {
35-
// Not a docker container, continue checking.
36-
}
31+
await fs.access("/.dockerenv");
32+
return true;
33+
} catch {
34+
// Not a docker container, continue checking.
35+
}
3736

38-
// Check cgroup for container indicators (works with cgroup v1).
37+
// Check cgroup for container indicators (works with cgroup v1).
38+
try {
3939
const cgroup = await fs.readFile("/proc/1/cgroup", "utf-8");
4040
if (cgroup.includes("docker") || cgroup.includes("containerd")) {
4141
return true;
4242
}
43-
44-
// For cgroup v2, check if working directory starts with /__w/.
45-
// This is GitHub Actions container-specific workspace mount.
46-
const cwd = process.cwd();
47-
if (cwd.startsWith("/__w/")) {
48-
return true;
49-
}
50-
51-
return false;
5243
} catch {
53-
return false;
44+
// /proc/1/cgroup unreadable or doesn't exist, continue checking.
5445
}
46+
47+
// For cgroup v2, check if working directory starts with /__w/.
48+
// This is GitHub Actions container-specific workspace mount.
49+
const cwd = process.cwd();
50+
if (cwd.startsWith("/__w/")) {
51+
return true;
52+
}
53+
54+
return false;
5555
})();
5656

5757
if (isContainer) {
@@ -61,8 +61,7 @@ export async function checkPreviousStepFailures(
6161
return {
6262
hasFailures: false,
6363
failedCount: 0,
64-
error:
65-
"Step failure checking skipped: running inside container where _diag is not accessible",
64+
// No error field - we want commits to proceed in containers
6665
};
6766
}
6867

0 commit comments

Comments
 (0)