Spaces:
Paused
Paused
Mirrowel
commited on
Commit
·
9ee0808
1
Parent(s):
a97ced5
ci(opencode): tighten trigger conditions and optimize pipeline
Browse files- restrict workflow trigger to comments from OWNER, MEMBER or COLLABORATOR
- replace hard-coded Gemini model with environment variable OPENCODE_MODEL
- add Python 3.12 setup with pip caching for faster builds
- remove redundant pip upgrade step thanks to setup-python action
.github/workflows/opencode.yml
CHANGED
|
@@ -7,10 +7,14 @@ on:
|
|
| 7 |
jobs:
|
| 8 |
opencode:
|
| 9 |
if: |
|
|
|
|
| 10 |
contains(github.event.comment.body, ' /oc') ||
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
runs-on: ubuntu-latest
|
| 15 |
permissions:
|
| 16 |
contents: write
|
|
@@ -40,26 +44,40 @@ jobs:
|
|
| 40 |
}
|
| 41 |
},
|
| 42 |
"models": {
|
| 43 |
-
"
|
| 44 |
-
"name": "
|
| 45 |
}
|
| 46 |
}
|
| 47 |
}
|
| 48 |
},
|
| 49 |
-
"model": "gemini/gemini-2.5-pro",
|
| 50 |
"autoupdate": true
|
| 51 |
}'
|
| 52 |
echo "$CONFIG" > ~/.config/opencode/opencode.json
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
- name: Install dependencies
|
| 56 |
run: |
|
| 57 |
-
python -m pip install --upgrade pip
|
| 58 |
pip install -r requirements.txt
|
|
|
|
| 59 |
- name: Run opencode
|
| 60 |
uses: sst/opencode/github@latest
|
| 61 |
env:
|
| 62 |
OPENCODE_API_KEY: ${{ secrets.PROXY_API_KEY }}
|
| 63 |
with:
|
| 64 |
-
model: llm-proxy
|
| 65 |
share: true
|
|
|
|
| 7 |
jobs:
|
| 8 |
opencode:
|
| 9 |
if: |
|
| 10 |
+
(
|
| 11 |
contains(github.event.comment.body, ' /oc') ||
|
| 12 |
+
contains(github.event.comment.body, ' /opencode')
|
| 13 |
+
) && (
|
| 14 |
+
github.event.comment.author_association == 'OWNER' ||
|
| 15 |
+
github.event.comment.author_association == 'MEMBER' ||
|
| 16 |
+
github.event.comment.author_association == 'COLLABORATOR'
|
| 17 |
+
)
|
| 18 |
runs-on: ubuntu-latest
|
| 19 |
permissions:
|
| 20 |
contents: write
|
|
|
|
| 44 |
}
|
| 45 |
},
|
| 46 |
"models": {
|
| 47 |
+
"${{ secrets.OPENCODE_MODEL }}": {
|
| 48 |
+
"name": "Custom Model"
|
| 49 |
}
|
| 50 |
}
|
| 51 |
}
|
| 52 |
},
|
|
|
|
| 53 |
"autoupdate": true
|
| 54 |
}'
|
| 55 |
echo "$CONFIG" > ~/.config/opencode/opencode.json
|
| 56 |
+
- name: Set up Python
|
| 57 |
+
uses: actions/setup-python@v5
|
| 58 |
+
with:
|
| 59 |
+
python-version: '3.12'
|
| 60 |
|
| 61 |
+
- name: Cache pip dependencies
|
| 62 |
+
uses: actions/cache@v4
|
| 63 |
+
with:
|
| 64 |
+
# This path is where pip stores its cache on the runner
|
| 65 |
+
path: ~/.cache/pip
|
| 66 |
+
# The key is crucial. It's created from the OS, Python version, and a hash of your requirements file.
|
| 67 |
+
# A new cache is only created when the requirements.txt file changes.
|
| 68 |
+
key: ${{ runner.os }}-pip-3.12-${{ hashFiles('requirements.txt') }}
|
| 69 |
+
# The restore-key provides a fallback to the most recent cache for this Python version.
|
| 70 |
+
restore-keys: |
|
| 71 |
+
${{ runner.os }}-pip-3.12
|
| 72 |
|
| 73 |
- name: Install dependencies
|
| 74 |
run: |
|
|
|
|
| 75 |
pip install -r requirements.txt
|
| 76 |
+
|
| 77 |
- name: Run opencode
|
| 78 |
uses: sst/opencode/github@latest
|
| 79 |
env:
|
| 80 |
OPENCODE_API_KEY: ${{ secrets.PROXY_API_KEY }}
|
| 81 |
with:
|
| 82 |
+
model: llm-proxy/${{ secrets.OPENCODE_MODEL }}
|
| 83 |
share: true
|