Skip to content

Commit 84a0fdb

Browse files
committed
Merge branch 'main' into direnv-respect-config
2 parents 928c344 + dd94878 commit 84a0fdb

File tree

337 files changed

+4508
-27686
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

337 files changed

+4508
-27686
lines changed

.envrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
#!/bin/bash
2+
13
# Automatically sets up your devbox environment whenever you cd into this
24
# directory via our direnv integration:
35

46
eval "$(devbox generate direnv --print-envrc)"
57

6-
# check out https://www.jetify.com/devbox/docs/ide_configuration/direnv/
8+
# check out https://www.jetify.com/docs/devbox/ide_configuration/direnv/
79
# for more details

.github/workflows/cache-upload.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ env:
2121
DEVBOX_API_TOKEN: ${{ secrets.DEVBOX_API_TOKEN }}
2222
DEVBOX_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2323
DEVBOX_DEBUG: 1
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
# I think this should be added to individual nix commands within devbox, but this is quick fix for now
26+
NIX_CONFIG: |
27+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
2428
2529
jobs:
2630
upload-cache:
@@ -44,7 +48,7 @@ jobs:
4448
sudo mv ./dist/devbox /usr/local/bin/
4549
4650
# - name: Install devbox
47-
# uses: jetify-com/devbox-install-action@v0.11.0
51+
# uses: jetify-com/devbox-install-action@v0.14.0
4852
# with:
4953
# enable-cache: true
5054

.github/workflows/cli-tests.yaml

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,18 @@ defaults:
3939
shell: bash
4040

4141
env:
42-
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
DEVBOX_DEBUG: 1
4343
DEVBOX_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4446
HOMEBREW_NO_ANALYTICS: 1
4547
HOMEBREW_NO_AUTO_UPDATE: 1
4648
HOMEBREW_NO_EMOJI: 1
4749
HOMEBREW_NO_ENV_HINTS: 1
4850
HOMEBREW_NO_INSTALL_CLEANUP: 1
49-
DEVBOX_DEBUG: 1
50-
51+
NIX_CONFIG: |
52+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
53+
5154
jobs:
5255
build-devbox:
5356
strategy:
@@ -82,10 +85,13 @@ jobs:
8285
runs-on: ubuntu-latest
8386
steps:
8487
- uses: actions/checkout@v4
85-
- uses: DeterminateSystems/nix-installer-action@main
88+
- name: Install devbox
89+
uses: jetify-com/devbox-install-action@jl/migrate-installer
90+
with:
91+
enable-cache: true
8692
- name: Build flake
8793
run: |
88-
if ! nix build .; then
94+
if ! devbox run build-flake; then
8995
echo "::warning::If this fails, you probably have to run 'devbox run update-hash'"
9096
exit 1
9197
fi
@@ -101,7 +107,7 @@ jobs:
101107
- uses: actions/checkout@v4
102108

103109
- name: Install devbox
104-
uses: jetify-com/devbox-install-action@v0.11.0
110+
uses: jetify-com/devbox-install-action@jl/migrate-installer
105111
with:
106112
enable-cache: true
107113

@@ -131,7 +137,7 @@ jobs:
131137
# 1. the oldest supported nix version (which is 2.9.0? But determinate-systems installer has 2.12.0)
132138
# 2. nix 2.19.2: version before nix profile changes
133139
# 2. latest nix version (note, 2.20.1 introduced a new profile change)
134-
nix-version: ["2.12.0", "2.19.2", "2.20.1"]
140+
nix-version: ["2.12.0", "2.19.2", "2.30.2"]
135141
exclude:
136142
# Only runs tests on macos if explicitly requested, or on a schedule
137143
- os: "${{ (inputs.run-mac-tests || github.event.schedule != '') && 'dummy' || 'macos-13' }}"
@@ -145,16 +151,12 @@ jobs:
145151
DEVBOX_DEBUG: ${{ (matrix.run-project-tests == 'project-tests-off' || inputs.example-debug) && '1' || '0' }}
146152
DEVBOX_GOLANG_TEST_TIMEOUT: "${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && '1h' || '30m' }}"
147153
steps:
148-
- name: Maximize build disk space
149-
uses: easimon/maximize-build-space@v10
150-
if: matrix.os == 'ubuntu-latest'
151-
with:
152-
root-reserve-mb: 32768
153-
temp-reserve-mb: 10000
154-
remove-dotnet: true
155-
remove-android: true
156-
remove-haskell: true
157-
remove-codeql: true
154+
- name: clear directories to reduce disk usage
155+
# https://github.com/actions/runner-images/issues/2840#issuecomment-1284059930
156+
run: |
157+
sudo rm -rf /usr/share/dotnet
158+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
159+
158160
- uses: actions/checkout@v4
159161
- name: Mount golang cache
160162
uses: actions/cache@v4
@@ -173,9 +175,33 @@ jobs:
173175
brew install dash zsh
174176
fi
175177
- name: Install devbox
176-
uses: jetify-com/devbox-install-action@v0.11.0
178+
uses: jetify-com/devbox-install-action@jl/migrate-installer
177179
with:
178180
enable-cache: true
181+
- name: Setup Nix GitHub authentication
182+
run: |
183+
# Setup github authentication to ensure Github's rate limits are not hit
184+
# For macOS, we need to configure the system-wide nix.conf because the Nix daemon
185+
# runs as a different user and doesn't read the user's ~/.config/nix/nix.conf
186+
if [ "$RUNNER_OS" == "macOS" ]; then
187+
echo "Configuring system-wide Nix config for macOS daemon"
188+
# Ensure /etc/nix directory exists
189+
if [ ! -d /etc/nix ]; then
190+
sudo mkdir -p /etc/nix
191+
fi
192+
# Check if file exists, create it if not
193+
if [ ! -f /etc/nix/nix.conf ]; then
194+
echo "# Nix configuration" | sudo tee /etc/nix/nix.conf > /dev/null
195+
fi
196+
echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" | sudo tee -a /etc/nix/nix.conf
197+
# Restart nix daemon to pick up the new configuration
198+
sudo launchctl stop org.nixos.nix-daemon || true
199+
sudo launchctl start org.nixos.nix-daemon || true
200+
sleep 2 # Give daemon time to restart
201+
fi
202+
# For Linux and as a backup for macOS, also configure user config
203+
mkdir -p ~/.config/nix
204+
echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" > ~/.config/nix/nix.conf
179205
- name: Run fast tests
180206
if: matrix.run-project-tests == 'project-tests-off'
181207
run: |
@@ -215,12 +241,28 @@ jobs:
215241
export NIX_INSTALLER_NO_CHANNEL_ADD=1
216242
export DEVBOX_FEATURE_DETSYS_INSTALLER=${{ matrix.use-detsys }}
217243
218-
# Setup github authentication to ensure Github's rate limits are not hit.
219-
# If this works, we can consider refactoring this into a reusable github action helper.
244+
# Setup github authentication BEFORE running devbox to ensure Github's rate limits are not hit.
245+
# Configure user config first (Nix installer will respect this)
220246
mkdir -p ~/.config/nix
221247
echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" > ~/.config/nix/nix.conf
222248
249+
# Run devbox which will auto-install Nix if needed
223250
devbox run echo "Installing packages..."
251+
252+
# After Nix is installed, configure system-wide config for the daemon on macOS
253+
if [ "$RUNNER_OS" == "macOS" ]; then
254+
echo "Configuring system-wide Nix config for macOS daemon"
255+
# Check if file exists, create directory if needed
256+
if [ ! -f /etc/nix/nix.conf ]; then
257+
sudo mkdir -p /etc/nix
258+
echo "# Nix configuration" | sudo tee /etc/nix/nix.conf > /dev/null
259+
fi
260+
echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" | sudo tee -a /etc/nix/nix.conf
261+
# Restart nix daemon to pick up the new configuration
262+
sudo launchctl stop org.nixos.nix-daemon || true
263+
sudo launchctl start org.nixos.nix-daemon || true
264+
sleep 2 # Give daemon time to restart
265+
fi
224266
- name: Test removing package
225267
run: devbox rm go
226268

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Random Reviewer Assignment
2+
on:
3+
pull_request:
4+
types: [opened]
5+
6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
10+
env:
11+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_FOR_PR_ASSIGNMENT }}
12+
13+
jobs:
14+
assign-reviewer:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Randomly assign reviewer from team
18+
uses: actions/github-script@v6
19+
with:
20+
script: |
21+
const TRIAGE_USERNAME = 'Lagoja';
22+
const EXCLUDE_USERNAMES = ['jetpack-io-bot'];
23+
24+
try {
25+
const authenticatedUser = await github.rest.users.getAuthenticated();
26+
27+
const teamMembers = await github.rest.teams.listMembersInOrg({
28+
org: 'jetify-com',
29+
team_slug: 'eng'
30+
});
31+
32+
const prAuthor = context.payload.pull_request.user.login.toLowerCase();
33+
const prAuthorId = context.payload.pull_request.user.id;
34+
const authenticatedUserLower = authenticatedUser.data.login.toLowerCase();
35+
36+
// If the PR author is already a member of the team, we can skip random assignment
37+
const isPrAuthorInTeam = teamMembers.data.some(member =>
38+
member.login.toLowerCase() === prAuthor && member.id === prAuthorId
39+
);
40+
41+
if (isPrAuthorInTeam) {
42+
console.log(`PR author ${prAuthor} is already a team member, skipping random assignment.`);
43+
return;
44+
}
45+
46+
// Get eligible reviewers (excluding PR author, authenticated user, and lagoja)
47+
const eligibleReviewers = teamMembers.data
48+
.filter(member => {
49+
const loginLower = member.login.toLowerCase();
50+
51+
// Exclude authenticated user
52+
const isNotAuthenticatedUser = member.id !== authenticatedUser.data.id;
53+
const isNotTriage = loginLower !== TRIAGE_USERNAME.toLowerCase();
54+
const isNotExcludedUsername = !EXCLUDE_USERNAMES.includes(loginLower);
55+
56+
return isNotAuthenticatedUser && isNotTriage && isNotExcludedUsername;
57+
})
58+
.map(member => member.login);
59+
60+
console.log(`Eligible reviewers: ${eligibleReviewers.join(', ')}`);
61+
62+
if (eligibleReviewers.length === 0) {
63+
console.log('No eligible reviewers found');
64+
return;
65+
}
66+
67+
const randomReviewer = eligibleReviewers[Math.floor(Math.random() * eligibleReviewers.length)];
68+
const reviewers = [randomReviewer];
69+
70+
// Only add TRIAGE_USERNAME if they're not the PR author and not the authenticated user
71+
if (prAuthor !== TRIAGE_USERNAME.toLowerCase() &&
72+
authenticatedUserLower !== TRIAGE_USERNAME.toLowerCase()) {
73+
reviewers.push(TRIAGE_USERNAME);
74+
}
75+
76+
console.log(`Final reviewers: ${reviewers.join(', ')}`);
77+
78+
console.log(`Assigning reviewers: ${reviewers.join(', ')}`);
79+
80+
await github.rest.pulls.requestReviewers({
81+
owner: context.repo.owner,
82+
repo: context.repo.repo,
83+
pull_number: context.payload.pull_request.number,
84+
reviewers
85+
});
86+
87+
} catch (error) {
88+
console.error('Error assigning reviewer:', error);
89+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ curl -fsSL https://get.jetify.com/devbox | bash
4747
```
4848

4949
Read more on the
50-
[Devbox docs](https://www.jetify.com/devbox/docs/installing_devbox/).
50+
[Devbox docs](https://www.jetify.com/devbox/docs/installing-devbox/).
5151

5252
## Benefits
5353

devbox.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"go mod vendor -o $vendor",
5151
"nix hash path $vendor >vendor-hash"
5252
],
53+
"build-flake": "nix build .",
5354
"tidy": ["go mod tidy", "devbox run update-hash"],
5455
// docker-testscripts runs the testscripts with Docker to exercise
5556
// Linux-specific tests. It invokes the test binary directly, so any extra

0 commit comments

Comments
 (0)