Skip to content

Commit 6c894bb

Browse files
authored
Merge branch 'dev' into fix/acp-show-proper-run-command-message
2 parents 3766dab + 2c82e6c commit 6c894bb

84 files changed

Lines changed: 2342 additions & 298 deletions

Some content is hidden

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

.github/workflows/close-stale-prs.yml

Lines changed: 76 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,98 @@ jobs:
2828
const cutoff = new Date(Date.now() - DAYS_INACTIVE * 24 * 60 * 60 * 1000)
2929
const { owner, repo } = context.repo
3030
const dryRun = context.payload.inputs?.dryRun === "true"
31-
const stalePrs = []
3231
3332
core.info(`Dry run mode: ${dryRun}`)
33+
core.info(`Cutoff date: ${cutoff.toISOString()}`)
3434
35-
const prs = await github.paginate(github.rest.pulls.list, {
36-
owner,
37-
repo,
38-
state: "open",
39-
per_page: 100,
40-
sort: "updated",
41-
direction: "asc",
42-
})
43-
44-
for (const pr of prs) {
45-
const lastUpdated = new Date(pr.updated_at)
46-
if (lastUpdated > cutoff) {
47-
core.info(`PR ${pr.number} is fresh`)
48-
continue
35+
const query = `
36+
query($owner: String!, $repo: String!, $cursor: String) {
37+
repository(owner: $owner, name: $repo) {
38+
pullRequests(first: 100, states: OPEN, after: $cursor) {
39+
pageInfo {
40+
hasNextPage
41+
endCursor
42+
}
43+
nodes {
44+
number
45+
title
46+
author {
47+
login
48+
}
49+
createdAt
50+
commits(last: 1) {
51+
nodes {
52+
commit {
53+
committedDate
54+
}
55+
}
56+
}
57+
comments(last: 1) {
58+
nodes {
59+
createdAt
60+
}
61+
}
62+
reviews(last: 1) {
63+
nodes {
64+
createdAt
65+
}
66+
}
67+
}
68+
}
69+
}
4970
}
71+
`
72+
73+
const allPrs = []
74+
let cursor = null
75+
let hasNextPage = true
76+
77+
while (hasNextPage) {
78+
const result = await github.graphql(query, {
79+
owner,
80+
repo,
81+
cursor,
82+
})
5083
51-
stalePrs.push(pr)
84+
allPrs.push(...result.repository.pullRequests.nodes)
85+
hasNextPage = result.repository.pullRequests.pageInfo.hasNextPage
86+
cursor = result.repository.pullRequests.pageInfo.endCursor
5287
}
5388
89+
core.info(`Found ${allPrs.length} open pull requests`)
90+
91+
const stalePrs = allPrs.filter((pr) => {
92+
const dates = [
93+
new Date(pr.createdAt),
94+
pr.commits.nodes[0] ? new Date(pr.commits.nodes[0].commit.committedDate) : null,
95+
pr.comments.nodes[0] ? new Date(pr.comments.nodes[0].createdAt) : null,
96+
pr.reviews.nodes[0] ? new Date(pr.reviews.nodes[0].createdAt) : null,
97+
].filter((d) => d !== null)
98+
99+
const lastActivity = dates.sort((a, b) => b.getTime() - a.getTime())[0]
100+
101+
if (!lastActivity || lastActivity > cutoff) {
102+
core.info(`PR #${pr.number} is fresh (last activity: ${lastActivity?.toISOString() || "unknown"})`)
103+
return false
104+
}
105+
106+
core.info(`PR #${pr.number} is STALE (last activity: ${lastActivity.toISOString()})`)
107+
return true
108+
})
109+
54110
if (!stalePrs.length) {
55111
core.info("No stale pull requests found.")
56112
return
57113
}
58114
115+
core.info(`Found ${stalePrs.length} stale pull requests`)
116+
59117
for (const pr of stalePrs) {
60118
const issue_number = pr.number
61119
const closeComment = `Closing this pull request because it has had no updates for more than ${DAYS_INACTIVE} days. If you plan to continue working on it, feel free to reopen or open a new PR.`
62120
63121
if (dryRun) {
64-
core.info(`[dry-run] Would close PR #${issue_number} from ${pr.user.login}`)
122+
core.info(`[dry-run] Would close PR #${issue_number} from ${pr.author.login}: ${pr.title}`)
65123
continue
66124
}
67125
@@ -79,5 +137,5 @@ jobs:
79137
state: "closed",
80138
})
81139
82-
core.info(`Closed PR #${issue_number} from ${pr.user.login}`)
140+
core.info(`Closed PR #${issue_number} from ${pr.author.login}: ${pr.title}`)
83141
}

.github/workflows/nix-hashes.yml

Lines changed: 92 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -21,120 +21,131 @@ on:
2121
- ".github/workflows/nix-hashes.yml"
2222

2323
jobs:
24-
nix-hashes:
25-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
26-
runs-on: blacksmith-4vcpu-ubuntu-2404
27-
env:
28-
TITLE: node_modules hashes
24+
# Native runners required: bun install cross-compilation flags (--os/--cpu)
25+
# do not produce byte-identical node_modules as native installs.
26+
compute-hash:
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
include:
31+
- system: x86_64-linux
32+
runner: blacksmith-4vcpu-ubuntu-2404
33+
- system: aarch64-linux
34+
runner: blacksmith-4vcpu-ubuntu-2404-arm
35+
- system: x86_64-darwin
36+
runner: macos-15-intel
37+
- system: aarch64-darwin
38+
runner: macos-latest
39+
runs-on: ${{ matrix.runner }}
2940

3041
steps:
3142
- name: Checkout repository
3243
uses: actions/checkout@v6
44+
45+
- name: Setup Nix
46+
uses: nixbuild/nix-quick-install-action@v34
47+
48+
- name: Compute node_modules hash
49+
id: hash
50+
env:
51+
SYSTEM: ${{ matrix.system }}
52+
run: |
53+
set -euo pipefail
54+
55+
BUILD_LOG=$(mktemp)
56+
trap 'rm -f "$BUILD_LOG"' EXIT
57+
58+
# Build with fakeHash to trigger hash mismatch and reveal correct hash
59+
nix build ".#packages.${SYSTEM}.node_modules_updater" --no-link 2>&1 | tee "$BUILD_LOG" || true
60+
61+
# Extract hash from build log with portability
62+
HASH="$(grep -oE 'sha256-[A-Za-z0-9+/=]+' "$BUILD_LOG" | tail -n1 || true)"
63+
64+
if [ -z "$HASH" ]; then
65+
echo "::error::Failed to compute hash for ${SYSTEM}"
66+
cat "$BUILD_LOG"
67+
exit 1
68+
fi
69+
70+
echo "$HASH" > hash.txt
71+
echo "Computed hash for ${SYSTEM}: $HASH"
72+
73+
- name: Upload hash
74+
uses: actions/upload-artifact@v4
3375
with:
34-
token: ${{ secrets.GITHUB_TOKEN }}
76+
name: hash-${{ matrix.system }}
77+
path: hash.txt
78+
retention-days: 1
79+
80+
update-hashes:
81+
needs: compute-hash
82+
if: github.event_name != 'pull_request'
83+
runs-on: blacksmith-4vcpu-ubuntu-2404
84+
85+
steps:
86+
- name: Checkout repository
87+
uses: actions/checkout@v4
88+
with:
89+
persist-credentials: false
3590
fetch-depth: 0
36-
ref: ${{ github.head_ref || github.ref_name }}
37-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
91+
ref: ${{ github.ref_name }}
3892

3993
- name: Setup git committer
40-
id: committer
4194
uses: ./.github/actions/setup-git-committer
4295
with:
4396
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
4497
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
4598

46-
- name: Setup Nix
47-
uses: nixbuild/nix-quick-install-action@v34
48-
4999
- name: Pull latest changes
50-
env:
51-
TARGET_BRANCH: ${{ github.head_ref || github.ref_name }}
52100
run: |
53-
BRANCH="${TARGET_BRANCH:-${GITHUB_REF_NAME}}"
54-
git pull --rebase --autostash origin "$BRANCH"
101+
git pull --rebase --autostash origin "$GITHUB_REF_NAME"
55102
56-
- name: Compute all node_modules hashes
103+
- name: Download hash artifacts
104+
uses: actions/download-artifact@v4
105+
with:
106+
path: hashes
107+
pattern: hash-*
108+
109+
- name: Update hashes.json
57110
run: |
58111
set -euo pipefail
59112
60113
HASH_FILE="nix/hashes.json"
61-
SYSTEMS="x86_64-linux aarch64-linux x86_64-darwin aarch64-darwin"
62-
63-
if [ ! -f "$HASH_FILE" ]; then
64-
mkdir -p "$(dirname "$HASH_FILE")"
65-
echo '{"nodeModules":{}}' > "$HASH_FILE"
66-
fi
67-
68-
for SYSTEM in $SYSTEMS; do
69-
echo "Computing hash for ${SYSTEM}..."
70-
BUILD_LOG=$(mktemp)
71-
trap 'rm -f "$BUILD_LOG"' EXIT
72114
73-
# The updater derivations use fakeHash, so they will fail and reveal the correct hash
74-
UPDATER_ATTR=".#packages.x86_64-linux.${SYSTEM}_node_modules"
75-
76-
nix build "$UPDATER_ATTR" --no-link 2>&1 | tee "$BUILD_LOG" || true
77-
78-
CORRECT_HASH="$(grep -E 'got:\s+sha256-[A-Za-z0-9+/=]+' "$BUILD_LOG" | awk '{print $2}' | head -n1 || true)"
79-
80-
if [ -z "$CORRECT_HASH" ]; then
81-
CORRECT_HASH="$(grep -A2 'hash mismatch' "$BUILD_LOG" | grep 'got:' | awk '{print $2}' | sed 's/sha256:/sha256-/' || true)"
82-
fi
83-
84-
if [ -z "$CORRECT_HASH" ]; then
85-
echo "Failed to determine correct node_modules hash for ${SYSTEM}."
86-
cat "$BUILD_LOG"
87-
exit 1
115+
[ -f "$HASH_FILE" ] || echo '{"nodeModules":{}}' > "$HASH_FILE"
116+
117+
for SYSTEM in x86_64-linux aarch64-linux x86_64-darwin aarch64-darwin; do
118+
FILE="hashes/hash-${SYSTEM}/hash.txt"
119+
if [ -f "$FILE" ]; then
120+
HASH="$(tr -d '[:space:]' < "$FILE")"
121+
echo "${SYSTEM}: ${HASH}"
122+
jq --arg sys "$SYSTEM" --arg h "$HASH" '.nodeModules[$sys] = $h' "$HASH_FILE" > tmp.json
123+
mv tmp.json "$HASH_FILE"
124+
else
125+
echo "::warning::Missing hash for ${SYSTEM}"
88126
fi
89-
90-
echo " ${SYSTEM}: ${CORRECT_HASH}"
91-
jq --arg sys "$SYSTEM" --arg h "$CORRECT_HASH" \
92-
'.nodeModules[$sys] = $h' "$HASH_FILE" > "${HASH_FILE}.tmp"
93-
mv "${HASH_FILE}.tmp" "$HASH_FILE"
94127
done
95128
96-
echo "All hashes computed:"
97129
cat "$HASH_FILE"
98130
99-
- name: Commit ${{ env.TITLE }} changes
100-
env:
101-
TARGET_BRANCH: ${{ github.head_ref || github.ref_name }}
131+
- name: Commit changes
102132
run: |
103133
set -euo pipefail
104134
105135
HASH_FILE="nix/hashes.json"
106-
echo "Checking for changes..."
107-
108-
summarize() {
109-
local status="$1"
110-
{
111-
echo "### Nix $TITLE"
112-
echo ""
113-
echo "- ref: ${GITHUB_REF_NAME}"
114-
echo "- status: ${status}"
115-
} >> "$GITHUB_STEP_SUMMARY"
116-
if [ -n "${GITHUB_SERVER_URL:-}" ] && [ -n "${GITHUB_REPOSITORY:-}" ] && [ -n "${GITHUB_RUN_ID:-}" ]; then
117-
echo "- run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" >> "$GITHUB_STEP_SUMMARY"
118-
fi
119-
echo "" >> "$GITHUB_STEP_SUMMARY"
120-
}
121-
122-
FILES=("$HASH_FILE")
123-
STATUS="$(git status --short -- "${FILES[@]}" || true)"
124-
if [ -z "$STATUS" ]; then
125-
echo "No changes detected."
126-
summarize "no changes"
136+
137+
if [ -z "$(git status --short -- "$HASH_FILE")" ]; then
138+
echo "No changes to commit"
139+
echo "### Nix hashes" >> "$GITHUB_STEP_SUMMARY"
140+
echo "Status: no changes" >> "$GITHUB_STEP_SUMMARY"
127141
exit 0
128142
fi
129143
130-
echo "Changes detected:"
131-
echo "$STATUS"
132-
git add "${FILES[@]}"
144+
git add "$HASH_FILE"
133145
git commit -m "chore: update nix node_modules hashes"
134146
135-
BRANCH="${TARGET_BRANCH:-${GITHUB_REF_NAME}}"
136-
git pull --rebase --autostash origin "$BRANCH"
137-
git push origin HEAD:"$BRANCH"
138-
echo "Changes pushed successfully"
147+
git pull --rebase --autostash origin "$GITHUB_REF_NAME"
148+
git push origin HEAD:"$GITHUB_REF_NAME"
139149
140-
summarize "committed $(git rev-parse --short HEAD)"
150+
echo "### Nix hashes" >> "$GITHUB_STEP_SUMMARY"
151+
echo "Status: committed $(git rev-parse --short HEAD)" >> "$GITHUB_STEP_SUMMARY"

README.ar.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
<a href="README.ru.md">Русский</a> |
3030
<a href="README.ar.md">العربية</a> |
3131
<a href="README.no.md">Norsk</a> |
32-
<a href="README.br.md">Português (Brasil)</a>
32+
<a href="README.br.md">Português (Brasil)</a> |
33+
<a href="README.th.md">ไทย</a> |
34+
<a href="README.tr.md">Türkçe</a>
3335
</p>
3436

3537
[![OpenCode Terminal UI](packages/web/src/assets/lander/screenshot.png)](https://opencode.ai)

README.br.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
<a href="README.ru.md">Русский</a> |
3030
<a href="README.ar.md">العربية</a> |
3131
<a href="README.no.md">Norsk</a> |
32-
<a href="README.br.md">Português (Brasil)</a>
32+
<a href="README.br.md">Português (Brasil)</a> |
33+
<a href="README.th.md">ไทย</a> |
34+
<a href="README.tr.md">Türkçe</a>
3335
</p>
3436

3537
[![OpenCode Terminal UI](packages/web/src/assets/lander/screenshot.png)](https://opencode.ai)

README.da.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
<a href="README.ru.md">Русский</a> |
3030
<a href="README.ar.md">العربية</a> |
3131
<a href="README.no.md">Norsk</a> |
32-
<a href="README.br.md">Português (Brasil)</a>
32+
<a href="README.br.md">Português (Brasil)</a> |
33+
<a href="README.th.md">ไทย</a> |
34+
<a href="README.tr.md">Türkçe</a>
3335
</p>
3436

3537
[![OpenCode Terminal UI](packages/web/src/assets/lander/screenshot.png)](https://opencode.ai)

README.de.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
<a href="README.ru.md">Русский</a> |
3030
<a href="README.ar.md">العربية</a> |
3131
<a href="README.no.md">Norsk</a> |
32-
<a href="README.br.md">Português (Brasil)</a>
32+
<a href="README.br.md">Português (Brasil)</a> |
33+
<a href="README.th.md">ไทย</a> |
34+
<a href="README.tr.md">Türkçe</a>
3335
</p>
3436

3537
[![OpenCode Terminal UI](packages/web/src/assets/lander/screenshot.png)](https://opencode.ai)

README.es.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
<a href="README.ru.md">Русский</a> |
3030
<a href="README.ar.md">العربية</a> |
3131
<a href="README.no.md">Norsk</a> |
32-
<a href="README.br.md">Português (Brasil)</a>
32+
<a href="README.br.md">Português (Brasil)</a> |
33+
<a href="README.th.md">ไทย</a> |
34+
<a href="README.tr.md">Türkçe</a>
3335
</p>
3436

3537
[![OpenCode Terminal UI](packages/web/src/assets/lander/screenshot.png)](https://opencode.ai)

0 commit comments

Comments
 (0)