Chattr / .github /workflows /ci_tools.yaml
MH0386's picture
Merge branch 'main' into renovate/pin-dependencies
d914d02 verified
name: CI Tools
on:
push:
branches:
- main
issue_comment:
types:
- created
- edited
workflow_dispatch:
permissions:
id-token: write
contents: write
pull-requests: read
issues: read
jobs:
opencode:
if: |
github.event_name == 'issue_comment' &&
(
contains(github.event.comment.body, ' /oc') ||
startsWith(github.event.comment.body, '/oc') ||
contains(github.event.comment.body, ' /opencode') ||
startsWith(github.event.comment.body, '/opencode')
)
name: Opencode
runs-on: ubuntu-latest
environment:
name: ai_agent
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run opencode
uses: sst/opencode/github@71e0ba271f1917f3128649f23210187265573f29 # v1.1.45
env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
with:
model: opencode/grok-code
uv_lock_sync:
if: |
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'issue_comment' &&
(
contains(github.event.comment.body, ' /uv-lock-sync') ||
startsWith(github.event.comment.body, '/uv-lock-sync')
)
)
name: UV Lock Sync
runs-on: ubuntu-latest
environment:
name: lockfile
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
token: ${{ secrets.GH_TOKEN }}
- name: Install uv
uses: astral-sh/setup-uv@803947b9bd8e9f986429fa0c5a41c367cd732b41 # v7.2.1
with:
enable-cache: true
activate-environment: true
- name: Sync dependencies and uv.lock
run: uv lock
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7.1.0
with:
commit_message: Sync uv.lock
commit_options: --no-verify
huggingface:
name: Sync HuggingFace Space
runs-on: ubuntu-latest
if: |
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'issue_comment' &&
(
contains(github.event.comment.body, ' /hf-sync') ||
startsWith(github.event.comment.body, '/hf-sync')
)
)
permissions:
contents: read
id-token: write
environment:
name: huggingface
url: https://huggingface.co/spaces/${{github.repository}}
steps:
- name: Checkout repository
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
with:
fetch-depth: 0
lfs: true
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
with:
enable-cache: true
activate-environment: true
- name: Push to HF
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message || 'Sync from GitHub' }}
run: >-
uvx hf upload ${{github.repository}} . . --repo-type space
--delete '*' --exclude '.github' --commit-message "$COMMIT_MESSAGE"