Sync everything-claude-code #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync opencode from everything-claude-code | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 */6 * * *" | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: sync-opencode | |
| cancel-in-progress: false | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout target repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.REPO_PAT }} | |
| - name: Clone upstream repository | |
| run: | | |
| git clone --depth=1 https://github.com/affaan-m/everything-claude-code.git /tmp/ecc | |
| - name: Sync .opencode and skills into opencode | |
| run: | | |
| rm -rf ./opencode | |
| mkdir -p ./opencode | |
| cp -a /tmp/ecc/.opencode/. ./opencode/ | |
| if [ -d /tmp/ecc/skills ]; then | |
| mkdir -p ./opencode/skills | |
| cp -a /tmp/ecc/skills/. ./opencode/skills/ | |
| fi | |
| if [ -d ./opencode/commands ]; then | |
| find ./opencode/commands -type f -exec sh -c ' | |
| for file do | |
| first_line=$(sed -n "1p" "$file") | |
| if printf "%s\n" "$first_line" | grep -q "^python3 "; then | |
| rm -f "$file" | |
| continue | |
| fi | |
| if grep -q "~/.claude" "$file"; then | |
| rm -f "$file" | |
| fi | |
| done | |
| ' sh {} + | |
| fi | |
| if [ -f ./opencode/opencode.json ]; then | |
| if [ -d ./opencode/commands ]; then | |
| existing_refs=$(find ./opencode/commands -type f -printf 'commands/%f\n' | jq -R . | jq -s .) | |
| else | |
| existing_refs='[]' | |
| fi | |
| jq --argjson existing_refs "$existing_refs" ' | |
| if .command then | |
| .command |= with_entries( | |
| (.value.template // "") as $template | |
| | if ($template | test("^\\{file:commands/[^}]+\\}")) then | |
| ($template | capture("^\\{file:(?<ref>commands/[^}]+)\\}").ref) as $ref | |
| | select($existing_refs | index($ref)) | |
| else | |
| . | |
| end | |
| ) | |
| else | |
| . | |
| end | |
| ' ./opencode/opencode.json >/tmp/opencode.json | |
| mv /tmp/opencode.json ./opencode/opencode.json | |
| fi | |
| - name: Replace model names | |
| run: | | |
| find ./opencode -type f -exec perl -0pi -e ' | |
| s|anthropic/claude-opus-4-5|openai/gpt-5.4|g; | |
| s|anthropic/claude-sonnet-4-5|openai/gpt-5.4|g; | |
| s|anthropic/claude-haiku-4-5|openai/gpt-5.4-mini|g; | |
| s|agent: everything-claude-code:|agent: |g; | |
| ' {} + | |
| - name: Stage changes | |
| run: | | |
| git add -A opencode | |
| - name: Detect changes | |
| id: changes | |
| run: | | |
| if git diff --cached --quiet -- opencode; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Commit and push if changed | |
| if: steps.changes.outputs.changed == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git commit -m "chore: sync opencode from everything-claude-code" | |
| git push origin HEAD:main |