From 49f435377c50ab06b80d1f491eed3c2152c228bf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 03:32:06 +0000 Subject: [PATCH] fork: maintain upstream sync workflows --- .github/workflows/compliance-close.yml | 38 ------------------- .github/workflows/duplicate-issues.yml | 46 +---------------------- .github/workflows/local-pull.yml | 27 +++++++++++++ .github/workflows/publish.yml | 1 - .github/workflows/storybook.yml | 2 - .github/workflows/sync-upstream.yml | 50 +++++++++++++++++++++++++ .github/workflows/test.yml | 10 +---- .github/workflows/triage.yml | 19 ---------- script/setup-mac-runner.sh | 52 ++++++++++++++++++++++++++ 9 files changed, 132 insertions(+), 113 deletions(-) create mode 100644 .github/workflows/local-pull.yml create mode 100644 .github/workflows/sync-upstream.yml create mode 100755 script/setup-mac-runner.sh diff --git a/.github/workflows/compliance-close.yml b/.github/workflows/compliance-close.yml index a83824e5cf60..14e68701e57d 100644 --- a/.github/workflows/compliance-close.yml +++ b/.github/workflows/compliance-close.yml @@ -34,48 +34,10 @@ jobs: const now = Date.now(); const twoHours = 2 * 60 * 60 * 1000; - const orgMemberAssociations = new Set(['OWNER', 'MEMBER']); - const agentLogin = 'opencode-agent[bot]'; - const { data: file } = await github.rest.repos.getContent({ - owner: context.repo.owner, - repo: context.repo.repo, - path: '.github/TEAM_MEMBERS', - ref: 'dev', - }); - const teamMembers = new Set( - Buffer.from(file.content, 'base64') - .toString() - .split('\n') - .map((line) => line.trim().toLowerCase()) - .filter(Boolean) - ); - - function isExempt(item) { - const login = item.user?.login?.toLowerCase(); - return ( - login === agentLogin || - orgMemberAssociations.has(item.author_association) || - (login && teamMembers.has(login)) - ); - } for (const item of items) { const isPR = !!item.pull_request; const kind = isPR ? 'PR' : 'issue'; - const login = item.user?.login; - - if (isExempt(item)) { - core.info(`Skipping ${kind} #${item.number}; author ${login || 'unknown'} is exempt`); - try { - await github.rest.issues.removeLabel({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: item.number, - name: 'needs:compliance', - }); - } catch (e) {} - continue; - } const { data: comments } = await github.rest.issues.listComments({ owner: context.repo.owner, diff --git a/.github/workflows/duplicate-issues.yml b/.github/workflows/duplicate-issues.yml index 3972247dafc6..4648a2d0c3d3 100644 --- a/.github/workflows/duplicate-issues.yml +++ b/.github/workflows/duplicate-issues.yml @@ -17,31 +17,12 @@ jobs: with: fetch-depth: 1 - - name: Check exempt issue author - id: author - run: | - LOGIN="${{ github.event.issue.user.login }}" - ASSOCIATION="${{ github.event.issue.author_association }}" - - if [ "$LOGIN" = "opencode-agent[bot]" ] || - [ "$ASSOCIATION" = "OWNER" ] || - [ "$ASSOCIATION" = "MEMBER" ] || - grep -qxiF "$LOGIN" .github/TEAM_MEMBERS; then - echo "skip=true" >> "$GITHUB_OUTPUT" - echo "Skipping issue automation for exempt author: $LOGIN ($ASSOCIATION)" - else - echo "skip=false" >> "$GITHUB_OUTPUT" - fi - - uses: ./.github/actions/setup-bun - if: steps.author.outputs.skip != 'true' - name: Install opencode - if: steps.author.outputs.skip != 'true' run: curl -fsSL https://opencode.ai/install | bash - name: Check duplicates and compliance - if: steps.author.outputs.skip != 'true' env: OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -57,7 +38,6 @@ jobs: opencode run -m opencode/claude-sonnet-4-6 "A new issue has been created: Issue number: ${{ github.event.issue.number }} - Issue author association: ${{ github.event.issue.author_association }} Lookup this issue with gh issue view ${{ github.event.issue.number }}. @@ -69,8 +49,6 @@ jobs: Check whether the issue follows our contributing guidelines and issue templates. - If the issue author association is OWNER or MEMBER, skip this compliance check. Do not add the needs:compliance label for organization-owned issues. - This project has three issue templates that every issue MUST use one of: 1. Bug Report - requires a Description field with real content @@ -105,7 +83,7 @@ jobs: Based on your findings, post a SINGLE comment on issue #${{ github.event.issue.number }}. Build the comment as follows: - If the issue is NOT compliant and the author association is not OWNER or MEMBER, start the comment with: + If the issue is NOT compliant, start the comment with: Then explain what needs to be fixed and that they have 2 hours to edit the issue before it is automatically closed. Also add the label needs:compliance to the issue using: gh issue edit ${{ github.event.issue.number }} --add-label needs:compliance @@ -151,31 +129,12 @@ jobs: with: fetch-depth: 1 - - name: Check exempt issue author - id: author - run: | - LOGIN="${{ github.event.issue.user.login }}" - ASSOCIATION="${{ github.event.issue.author_association }}" - - if [ "$LOGIN" = "opencode-agent[bot]" ] || - [ "$ASSOCIATION" = "OWNER" ] || - [ "$ASSOCIATION" = "MEMBER" ] || - grep -qxiF "$LOGIN" .github/TEAM_MEMBERS; then - echo "skip=true" >> "$GITHUB_OUTPUT" - echo "Skipping issue automation for exempt author: $LOGIN ($ASSOCIATION)" - else - echo "skip=false" >> "$GITHUB_OUTPUT" - fi - - uses: ./.github/actions/setup-bun - if: steps.author.outputs.skip != 'true' - name: Install opencode - if: steps.author.outputs.skip != 'true' run: curl -fsSL https://opencode.ai/install | bash - name: Recheck compliance - if: steps.author.outputs.skip != 'true' env: OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -189,12 +148,9 @@ jobs: } run: | opencode run -m opencode/claude-sonnet-4-6 "Issue #${{ github.event.issue.number }} was previously flagged as non-compliant and has been edited. - Issue author association: ${{ github.event.issue.author_association }} Lookup this issue with gh issue view ${{ github.event.issue.number }}. - If the issue author association is OWNER or MEMBER, remove the needs:compliance label if present, delete the previous compliance comment if present, and do not post a new comment. - Re-check whether the issue now follows our contributing guidelines and issue templates. This project has three issue templates that every issue MUST use one of: diff --git a/.github/workflows/local-pull.yml b/.github/workflows/local-pull.yml new file mode 100644 index 000000000000..caa78891d48f --- /dev/null +++ b/.github/workflows/local-pull.yml @@ -0,0 +1,27 @@ +name: Pull local clone + +on: + workflow_run: + workflows: ["Sync fork with upstream"] + types: [completed] + +jobs: + pull: + if: >- + vars.MAC_RUNNER == 'true' && + github.event.workflow_run.conclusion == 'success' + runs-on: [self-hosted, macOS] + steps: + - name: Sync local OpenCode clone to fork dev + shell: bash + run: | + set -euo pipefail + dir="$HOME/opencode" + if [[ ! -d "$dir/.git" ]]; then + echo "Skip $dir (not a git repo)" + exit 0 + fi + echo "Syncing $dir" + git -C "$dir" fetch origin dev + git -C "$dir" reset --hard origin/dev + git -C "$dir" log -1 --oneline diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 037020c03af1..29b5aa30476a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -325,7 +325,6 @@ jobs: run: bun run build working-directory: packages/desktop env: - NODE_OPTIONS: --max-old-space-size=4096 OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_ORG: ${{ vars.SENTRY_ORG }} diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index be2e099d0ed9..1e652104d690 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -9,7 +9,6 @@ on: - "bun.lock" - "packages/storybook/**" - "packages/ui/**" - - "packages/session-ui/**" pull_request: branches: [dev] paths: @@ -18,7 +17,6 @@ on: - "bun.lock" - "packages/storybook/**" - "packages/ui/**" - - "packages/session-ui/**" workflow_dispatch: concurrency: diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml new file mode 100644 index 000000000000..32a6adb8d581 --- /dev/null +++ b/.github/workflows/sync-upstream.yml @@ -0,0 +1,50 @@ +name: Sync fork with upstream + +on: + schedule: + - cron: "0 */6 * * *" + workflow_dispatch: + +permissions: + contents: write + actions: write + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: dev + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Reset to upstream and re-apply fork workflows + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + preserve="${RUNNER_TEMP}/fork-preserve" + mkdir -p "${preserve}" + cp -a .github/workflows "${preserve}/workflows" + mkdir -p "${preserve}/script" + cp script/setup-mac-runner.sh "${preserve}/script/" 2>/dev/null || true + + git fetch origin dev + git remote add upstream https://github.com/anomalyco/opencode.git || \ + git remote set-url upstream https://github.com/anomalyco/opencode.git + git fetch upstream dev + + git reset --hard upstream/dev + + rm -rf .github/workflows + mkdir -p .github/workflows + cp -a "${preserve}/workflows/." .github/workflows/ + mkdir -p script + cp "${preserve}/script/setup-mac-runner.sh" script/setup-mac-runner.sh 2>/dev/null || true + + git add .github/workflows + git add script/setup-mac-runner.sh 2>/dev/null || true + git diff --cached --quiet || git commit -m "fork: maintain upstream sync workflows" + + git push --force-with-lease origin HEAD:dev diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c69de1d93b0d..4c36f41106c3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,15 +65,10 @@ jobs: - name: Run unit tests timeout-minutes: 20 - run: GITHUB_ACTIONS=false bun turbo test + run: bun turbo test --output-logs=errors-only --log-order=grouped --log-prefix=task env: OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }} - - name: Check generated client - if: runner.os == 'Linux' - working-directory: packages/client - run: bun run check:generated - - name: Run HttpApi exerciser gates if: runner.os == 'Linux' working-directory: packages/opencode @@ -104,8 +99,7 @@ jobs: - name: Setup Node uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: - # Playwright 1.59 hangs while extracting Chromium with Node 24.16. - node-version: "24.15" + node-version: "24" - name: Setup Bun uses: ./.github/actions/setup-bun diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 0350e43877c4..27852a12ce4d 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -16,32 +16,13 @@ jobs: with: fetch-depth: 1 - - name: Check exempt issue author - id: author - run: | - LOGIN="${{ github.event.issue.user.login }}" - ASSOCIATION="${{ github.event.issue.author_association }}" - - if [ "$LOGIN" = "opencode-agent[bot]" ] || - [ "$ASSOCIATION" = "OWNER" ] || - [ "$ASSOCIATION" = "MEMBER" ] || - grep -qxiF "$LOGIN" .github/TEAM_MEMBERS; then - echo "skip=true" >> "$GITHUB_OUTPUT" - echo "Skipping issue automation for exempt author: $LOGIN ($ASSOCIATION)" - else - echo "skip=false" >> "$GITHUB_OUTPUT" - fi - - name: Setup Bun - if: steps.author.outputs.skip != 'true' uses: ./.github/actions/setup-bun - name: Install opencode - if: steps.author.outputs.skip != 'true' run: curl -fsSL https://opencode.ai/install | bash - name: Triage issue - if: steps.author.outputs.skip != 'true' env: OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/script/setup-mac-runner.sh b/script/setup-mac-runner.sh new file mode 100755 index 000000000000..aa6b59e3d9cd --- /dev/null +++ b/script/setup-mac-runner.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# Register a self-hosted GitHub Actions runner on this Mac for fork auto-pull. +set -euo pipefail + +REPO="${1:?Usage: setup-mac-runner.sh MervinPraison/opencode}" +RUNNER_NAME="${2:-praison-mac-opencode}" +RUNNER_ROOT="$HOME/.github-actions-runners/${REPO##*/}" + +latest_version() { + curl -fsSL https://api.github.com/repos/actions/runner/releases/latest | grep tag_name | cut -d'"' -f4 +} + +install_runner() { + local version arch tar url + version="$(latest_version)" + version="${version#v}" + arch="$(uname -m)" + case "$arch" in + arm64) tar="actions-runner-osx-arm64-${version}.tar.gz" ;; + x86_64) tar="actions-runner-osx-x64-${version}.tar.gz" ;; + *) echo "Unsupported arch: $arch" >&2; exit 1 ;; + esac + url="https://github.com/actions/runner/releases/download/v${version}/${tar}" + + mkdir -p "$RUNNER_ROOT" + cd "$RUNNER_ROOT" + if [[ ! -f "./config.sh" ]]; then + echo "Downloading runner v${version}..." + curl -fsSL "$url" -o runner.tar.gz + tar xzf runner.tar.gz + rm runner.tar.gz + fi + + token="$(gh api -X POST "repos/${REPO}/actions/runners/registration-token" -q .token)" + ./config.sh \ + --url "https://github.com/${REPO}" \ + --token "$token" \ + --name "$RUNNER_NAME" \ + --labels "self-hosted,macOS,${arch}" \ + --unattended \ + --replace + + ./svc.sh install + ./svc.sh start + gh api -X PATCH "repos/${REPO}/actions/variables/MAC_RUNNER" \ + -f name=MAC_RUNNER -f value=true 2>/dev/null \ + || gh api -X POST "repos/${REPO}/actions/variables" \ + -f name=MAC_RUNNER -f value=true + echo "Runner ready for ${REPO} (service running, MAC_RUNNER=true)" +} + +install_runner