Skip to content

Commit b668db7

Browse files
authored
Merge branch 'dev' into fix/acp-show-proper-run-command-message
2 parents 63c69a7 + 00637c0 commit b668db7

51 files changed

Lines changed: 693 additions & 190 deletions

Some content is hidden

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

.github/actions/setup-bun/action.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@ description: "Setup Bun with caching and install dependencies"
33
runs:
44
using: "composite"
55
steps:
6+
- name: Mount Bun Cache
7+
uses: useblacksmith/stickydisk@v1
8+
with:
9+
key: ${{ github.repository }}-bun-cache
10+
path: ~/.bun
11+
612
- name: Setup Bun
713
uses: oven-sh/setup-bun@v2
814
with:
915
bun-version-file: package.json
1016

11-
- name: Cache ~/.bun
12-
id: cache-bun
13-
uses: actions/cache@v4
14-
with:
15-
path: ~/.bun
16-
key: ${{ runner.os }}-bun-${{ hashFiles('package.json') }}-${{ hashFiles('bun.lockb', 'bun.lock') }}
17-
restore-keys: |
18-
${{ runner.os }}-bun-${{ hashFiles('package.json') }}-
19-
2017
- name: Install dependencies
2118
run: bun install
2219
shell: bash
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "Setup Git Committer"
2+
description: "Create app token and configure git user"
3+
inputs:
4+
opencode-app-id:
5+
description: "OpenCode GitHub App ID"
6+
required: true
7+
opencode-app-secret:
8+
description: "OpenCode GitHub App private key"
9+
required: true
10+
outputs:
11+
token:
12+
description: "GitHub App token"
13+
value: ${{ steps.apptoken.outputs.token }}
14+
app-slug:
15+
description: "GitHub App slug"
16+
value: ${{ steps.apptoken.outputs.app-slug }}
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Create app token
21+
id: apptoken
22+
uses: actions/create-github-app-token@v2
23+
with:
24+
app-id: ${{ inputs.opencode-app-id }}
25+
private-key: ${{ inputs.opencode-app-secret }}
26+
27+
- name: Configure git user
28+
run: |
29+
slug="${{ steps.apptoken.outputs.app-slug }}"
30+
git config --global user.name "${slug}[bot]"
31+
git config --global user.email "${slug}[bot]@users.noreply.github.com"
32+
shell: bash
33+
34+
- name: Clear checkout auth
35+
run: |
36+
git config --local --unset-all http.https://github.com/.extraheader || true
37+
shell: bash
38+
39+
- name: Configure git remote
40+
run: |
41+
git remote set-url origin https://x-access-token:${{ steps.apptoken.outputs.token }}@github.com/${{ github.repository }}
42+
shell: bash

.github/workflows/beta.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: blacksmith-4vcpu-ubuntu-2404
1616
permissions:
1717
contents: write
18-
pull-requests: read
18+
pull-requests: write
1919
steps:
2020
- name: Checkout repository
2121
uses: actions/checkout@v4

.github/workflows/containers.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: containers
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
paths:
8+
- packages/containers/**
9+
- .github/workflows/containers.yml
10+
- package.json
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
jobs:
18+
build:
19+
runs-on: blacksmith-4vcpu-ubuntu-2404
20+
env:
21+
REGISTRY: ghcr.io/${{ github.repository_owner }}
22+
TAG: "24.04"
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: ./.github/actions/setup-bun
27+
28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@v3
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Login to GHCR
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.repository_owner }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Build and push containers
42+
run: bun ./packages/containers/script/build.ts --push
43+
env:
44+
REGISTRY: ${{ env.REGISTRY }}
45+
TAG: ${{ env.TAG }}

.github/workflows/generate.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ jobs:
1616
steps:
1717
- name: Checkout repository
1818
uses: actions/checkout@v4
19-
with:
20-
token: ${{ secrets.GITHUB_TOKEN }}
21-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
22-
ref: ${{ github.event.pull_request.head.ref || github.ref_name }}
2319

2420
- name: Setup Bun
2521
uses: ./.github/actions/setup-bun
2622

23+
- name: Setup git committer
24+
id: committer
25+
uses: ./.github/actions/setup-git-committer
26+
with:
27+
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
28+
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
29+
2730
- name: Generate
2831
run: ./script/generate.ts
2932

@@ -33,10 +36,8 @@ jobs:
3336
echo "No changes to commit"
3437
exit 0
3538
fi
36-
git config --local user.email "[email protected]"
37-
git config --local user.name "GitHub Action"
3839
git add -A
39-
git commit -m "chore: generate"
40+
git commit -m "chore: generate" --allow-empty
4041
git push origin HEAD:${{ github.ref_name }} --no-verify
4142
# if ! git push origin HEAD:${{ github.event.pull_request.head.ref || github.ref_name }} --no-verify; then
4243
# echo ""

.github/workflows/nix-hashes.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ jobs:
3636
ref: ${{ github.head_ref || github.ref_name }}
3737
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
3838

39+
- name: Setup git committer
40+
id: committer
41+
uses: ./.github/actions/setup-git-committer
42+
with:
43+
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
44+
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
45+
3946
- name: Setup Nix
4047
uses: nixbuild/nix-quick-install-action@v34
4148

42-
- name: Configure git
43-
run: |
44-
git config --global user.email "[email protected]"
45-
git config --global user.name "Github Action"
46-
4749
- name: Pull latest changes
4850
env:
4951
TARGET_BRANCH: ${{ github.head_ref || github.ref_name }}

.github/workflows/publish.yml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,22 @@ jobs:
3737
steps:
3838
- uses: actions/checkout@v3
3939
with:
40-
fetch-depth: 1
40+
fetch-depth: 0
41+
4142
- uses: ./.github/actions/setup-bun
43+
44+
- name: Install OpenCode
45+
if: inputs.bump || inputs.version
46+
run: bun i -g opencode-ai
47+
4248
- id: version
4349
run: |
4450
./script/version.ts
4551
env:
4652
GH_TOKEN: ${{ github.token }}
4753
OPENCODE_BUMP: ${{ inputs.bump }}
4854
OPENCODE_VERSION: ${{ inputs.version }}
55+
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
4956
outputs:
5057
version: ${{ steps.version.outputs.version }}
5158
release: ${{ steps.version.outputs.release }}
@@ -58,7 +65,6 @@ jobs:
5865
steps:
5966
- uses: actions/checkout@v3
6067
with:
61-
fetch-depth: 1
6268
fetch-tags: true
6369

6470
- uses: ./.github/actions/setup-bun
@@ -103,7 +109,6 @@ jobs:
103109
steps:
104110
- uses: actions/checkout@v3
105111
with:
106-
fetch-depth: 1
107112
fetch-tags: true
108113

109114
- uses: apple-actions/import-codesign-certs@v2
@@ -128,6 +133,15 @@ jobs:
128133
129134
- uses: ./.github/actions/setup-bun
130135

136+
- name: Cache apt packages
137+
if: contains(matrix.settings.host, 'ubuntu')
138+
uses: actions/cache@v4
139+
with:
140+
path: /var/cache/apt/archives
141+
key: ${{ runner.os }}-${{ matrix.settings.target }}-apt-${{ hashFiles('.github/workflows/publish.yml') }}
142+
restore-keys: |
143+
${{ runner.os }}-${{ matrix.settings.target }}-apt-
144+
131145
- name: install dependencies (ubuntu only)
132146
if: contains(matrix.settings.host, 'ubuntu')
133147
run: |
@@ -149,8 +163,8 @@ jobs:
149163
cd packages/desktop
150164
bun ./scripts/prepare.ts
151165
env:
152-
OPENCODE_VERSION: ${{ needs.publish.outputs.version }}
153-
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
166+
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
167+
GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
154168
RUST_TARGET: ${{ matrix.settings.target }}
155169
GH_TOKEN: ${{ github.token }}
156170
GITHUB_RUN_ID: ${{ github.run_id }}
@@ -196,12 +210,8 @@ jobs:
196210
runs-on: blacksmith-4vcpu-ubuntu-2404
197211
steps:
198212
- uses: actions/checkout@v3
199-
with:
200-
fetch-depth: 1
201213

202-
- name: Install OpenCode
203-
if: inputs.bump || inputs.version
204-
run: bun i -g opencode-ai
214+
- uses: ./.github/actions/setup-bun
205215

206216
- name: Login to GitHub Container Registry
207217
uses: docker/login-action@v3
@@ -221,19 +231,26 @@ jobs:
221231
node-version: "24"
222232
registry-url: "https://registry.npmjs.org"
223233

224-
- name: Setup Git Identity
225-
run: |
226-
git config --global user.email "[email protected]"
227-
git config --global user.name "opencode"
228-
git remote set-url origin https://x-access-token:${{ secrets.SST_GITHUB_TOKEN }}@github.com/${{ github.repository }}
229-
230-
- uses: ./.github/actions/setup-bun
234+
- name: Setup git committer
235+
id: committer
236+
uses: ./.github/actions/setup-git-committer
237+
with:
238+
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
239+
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
231240

232241
- uses: actions/download-artifact@v4
233242
with:
234243
name: opencode-cli
235244
path: packages/opencode/dist
236245

246+
- name: Cache apt packages (AUR)
247+
uses: actions/cache@v4
248+
with:
249+
path: /var/cache/apt/archives
250+
key: ${{ runner.os }}-apt-aur-${{ hashFiles('.github/workflows/publish.yml') }}
251+
restore-keys: |
252+
${{ runner.os }}-apt-aur-
253+
237254
- name: Setup SSH for AUR
238255
run: |
239256
sudo apt-get update
@@ -250,6 +267,5 @@ jobs:
250267
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
251268
OPENCODE_RELEASE: ${{ needs.version.outputs.release }}
252269
AUR_KEY: ${{ secrets.AUR_KEY }}
253-
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
254-
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
270+
GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
255271
NPM_CONFIG_PROVENANCE: false

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
- To regenerate the JavaScript SDK, run `./packages/sdk/js/script/build.ts`.
22
- ALWAYS USE PARALLEL TOOLS WHEN APPLICABLE.
33
- The default branch in this repo is `dev`.
4+
- Prefer automation: execute requested actions without confirmation unless blocked by missing info or safety/irreversibility.
45

56
## Style Guide
67

0 commit comments

Comments
 (0)