Skip to content

Commit 727b984

Browse files
committed
check-mirrors: run on GitHub-hosted runner
Minimizing the amount of code running on the website machine is important to avoid potential security vulnerabilities. Since we now need to fetch Zig (rather than it being preinstalled), also update `check-mirrors` to the latest Zig dev version. We'll want to do this soon anyway due to ziglang/zig#24316 blocking #492.
1 parent 9df902a commit 727b984

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

.github/workflows/check-mirrors.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,27 @@ on:
55
pull_request: { paths: ["assets/community-mirrors.ziggy"] }
66
jobs:
77
check:
8-
runs-on: [self-hosted, website]
8+
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v3
11-
with: { clean: false }
12-
- name: Check Mirrors
10+
- name: Check out code
11+
uses: actions/checkout@v4
12+
13+
- name: Install Zig
14+
# We can't use mlugg/setup-zig, because that Action uses the community mirror list, which
15+
# this workflow is in the "supply chain" for. Instead, just directly fetch a tarball from
16+
# ziglang.org. This is **not** a recommended strategy for most users, but rather a special
17+
# case due to the role this repository plays in maintaining the mirror list.
1318
run: |
14-
cd check-mirrors
15-
/home/ci/deps/zig-linux-x86_64-0.14.0/zig build run -- ../assets/community-mirrors.ziggy "$GITHUB_STEP_SUMMARY"
19+
curl -L 'https://ziglang.org/builds/zig-x86_64-linux-0.15.0-dev.885+e83776595.tar.xz' | tar -xJ
20+
mv 'zig-x86_64-linux-0.15.0-dev.885+e83776595' zig
21+
echo "$PWD/zig" >>"$GITHUB_PATH"
22+
23+
- name: Check Mirrors
24+
run: zig build --build-file check-mirrors/build.zig
25+
run -- assets/community-mirrors.ziggy "$GITHUB_STEP_SUMMARY"
26+
1627
notify-failure:
17-
runs-on: [self-hosted, website]
28+
runs-on: ubuntu-latest
1829
needs: [check]
1930
if: ${{ always() && (github.event_name != 'pull_request') && (needs.check.result == 'failure' || needs.check.result == 'timed_out') }}
2031
steps:

check-mirrors/main.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub fn main() Allocator.Error!u8 {
121121
defer http_client.deinit();
122122

123123
const mirrors: []Mirror = mirrors: {
124-
const raw = std.fs.cwd().readFileAllocOptions(arena, mirrors_path, 1024 * 1024 * 8, null, 1, 0) catch |err| {
124+
const raw = std.fs.cwd().readFileAllocOptions(arena, mirrors_path, 1024 * 1024 * 8, null, .of(u8), 0) catch |err| {
125125
std.debug.panic("failed to read mirrors file '{s}': {s}", .{ mirrors_path, @errorName(err) });
126126
};
127127
const parsed = ziggy.parseLeaky([]const Mirror.Parsed, arena, raw, .{}) catch |err| {

0 commit comments

Comments
 (0)