From 5c7725db4756e2d49eca6f3ce1021072ffa8e9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Catriel=20M=C3=BCller?= Date: Tue, 10 Feb 2026 17:08:24 -0300 Subject: [PATCH] feat: ci pr management --- .github/actions/setup-bun/action.yml | 2 +- .../actions/setup-git-committer/action.yml | 16 +++++---- .github/actions/setup-kilo/action.yml | 9 +++++ .github/workflows/check-org-member.yml | 36 +++++++++++++++++++ .github/workflows/pr-management.yml | 35 +++++++++--------- 5 files changed, 73 insertions(+), 25 deletions(-) create mode 100644 .github/actions/setup-kilo/action.yml create mode 100644 .github/workflows/check-org-member.yml diff --git a/.github/actions/setup-bun/action.yml b/.github/actions/setup-bun/action.yml index 7584334a7b..65fbf0f3d6 100644 --- a/.github/actions/setup-bun/action.yml +++ b/.github/actions/setup-bun/action.yml @@ -6,7 +6,7 @@ runs: - name: Mount Bun Cache uses: useblacksmith/stickydisk@v1 with: - key: ${{ github.repository }}-bun-cache + key: ${{ github.repository }}-bun-cache-${{ runner.os }} path: ~/.bun - name: Setup Bun diff --git a/.github/actions/setup-git-committer/action.yml b/.github/actions/setup-git-committer/action.yml index 87d2f5d0d4..852d3096ae 100644 --- a/.github/actions/setup-git-committer/action.yml +++ b/.github/actions/setup-git-committer/action.yml @@ -1,12 +1,14 @@ name: "Setup Git Committer" description: "Create app token and configure git user" inputs: - opencode-app-id: - description: "OpenCode GitHub App ID" + # kilocode_change start + kilo-maintainer-app-id: + description: "Kilo Maintainer GitHub App ID" required: true - opencode-app-secret: - description: "OpenCode GitHub App private key" + kilo-maintainer-app-secret: + description: "Kilo Maintainer GitHub App private key" required: true + # kilocode_change end outputs: token: description: "GitHub App token" @@ -21,8 +23,10 @@ runs: id: apptoken uses: actions/create-github-app-token@v2 with: - app-id: ${{ inputs.opencode-app-id }} - private-key: ${{ inputs.opencode-app-secret }} + # kilocode_change start + app-id: ${{ inputs.kilo-maintainer-app-id }} + private-key: ${{ inputs.kilo-maintainer-app-secret }} + # kilocode_change end owner: ${{ github.repository_owner }} - name: Configure git user diff --git a/.github/actions/setup-kilo/action.yml b/.github/actions/setup-kilo/action.yml new file mode 100644 index 0000000000..6624a2dc42 --- /dev/null +++ b/.github/actions/setup-kilo/action.yml @@ -0,0 +1,9 @@ +# kilocode_change - new file +name: "Setup Kilo" +description: "Install Kilo CLI globally" +runs: + using: "composite" + steps: + - name: Install Kilo CLI + run: bun add -g @kilocode/cli + shell: bash diff --git a/.github/workflows/check-org-member.yml b/.github/workflows/check-org-member.yml new file mode 100644 index 0000000000..eef27efafa --- /dev/null +++ b/.github/workflows/check-org-member.yml @@ -0,0 +1,36 @@ +name: Check Organization Member + +on: + workflow_call: + inputs: + username: + required: true + type: string + outputs: + is-member: + description: Whether the user is an org member or kilo-maintainer bot + value: ${{ jobs.check.outputs.is-member }} + +jobs: + check: + # kilocode_change - new file + runs-on: blacksmith-2vcpu-ubuntu-2404 + outputs: + is-member: ${{ steps.check.outputs.is-member }} + steps: + - name: Check if author is org member or kilo-maintainer bot + id: check + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + USERNAME: ${{ inputs.username }} + run: | + if [[ "$USERNAME" == "kilo-maintainer[bot]" ]]; then + echo "is-member=true" >> "$GITHUB_OUTPUT" + echo "User is kilo-maintainer bot" + elif gh api orgs/Kilo-Org/members/"$USERNAME" --silent 2>/dev/null; then + echo "is-member=true" >> "$GITHUB_OUTPUT" + echo "User is an org member" + else + echo "is-member=false" >> "$GITHUB_OUTPUT" + echo "User is not an org member" + fi diff --git a/.github/workflows/pr-management.yml b/.github/workflows/pr-management.yml index cbb0cdd415..9ef561454f 100644 --- a/.github/workflows/pr-management.yml +++ b/.github/workflows/pr-management.yml @@ -5,22 +5,16 @@ on: types: [opened] jobs: + # kilocode_change start + check-author: + uses: ./.github/workflows/check-org-member.yml + with: + username: ${{ github.event.pull_request.user.login }} + check-duplicates: - # kilocode_change start - disabled for kilo-cli fork (requires OpenCode API key and install) - if: false + needs: check-author + if: needs.check-author.outputs.is-member == 'false' # kilocode_change end - # Original condition with OpenCode maintainer allowlist: - # if: | - # github.event.pull_request.user.login != 'actions-user' && - # github.event.pull_request.user.login != 'opencode' && - # github.event.pull_request.user.login != 'rekram1-node' && - # github.event.pull_request.user.login != 'thdxr' && - # github.event.pull_request.user.login != 'kommander' && - # github.event.pull_request.user.login != 'jayair' && - # github.event.pull_request.user.login != 'fwang' && - # github.event.pull_request.user.login != 'adamdotdevin' && - # github.event.pull_request.user.login != 'iamdavidhill' && - # github.event.pull_request.user.login != 'opencode-agent[bot]' runs-on: blacksmith-4vcpu-ubuntu-2404 permissions: contents: read @@ -37,8 +31,10 @@ jobs: - name: Install dependencies run: bun install - - name: Install opencode - run: curl -fsSL https://opencode.ai/install | bash + # kilocode_change start + - name: Setup Kilo + uses: ./.github/actions/setup-kilo + # kilocode_change end - name: Build prompt env: @@ -58,7 +54,10 @@ jobs: - name: Check for duplicate PRs env: - OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} + # kilocode_change start + KILO_API_KEY: ${{ secrets.KILO_API_KEY }} + KILO_ORG_ID: ${{ secrets.KILO_ORG_ID }} + # kilocode_change end GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.pull_request.number }} run: | @@ -69,7 +68,7 @@ jobs: $COMMENT" add-contributor-label: - runs-on: ubuntu-latest + runs-on: blacksmith-2vcpu-ubuntu-2404 # kilocode_change permissions: pull-requests: write issues: write