update-registry.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. name: Update Component Registry
  2. on:
  3. push:
  4. branches:
  5. - main
  6. paths:
  7. - '.opencode/**'
  8. - '!registry.json'
  9. workflow_dispatch:
  10. permissions:
  11. contents: write
  12. pull-requests: write
  13. jobs:
  14. update-registry:
  15. runs-on: ubuntu-latest
  16. steps:
  17. - name: Checkout repository
  18. uses: actions/checkout@v4
  19. with:
  20. fetch-depth: 0
  21. - name: Install dependencies
  22. run: |
  23. sudo apt-get update
  24. sudo apt-get install -y jq
  25. - name: Run component registration
  26. run: |
  27. chmod +x scripts/register-component.sh
  28. ./scripts/register-component.sh
  29. - name: Check for changes
  30. id: check_changes
  31. run: |
  32. if git diff --quiet registry.json; then
  33. echo "changed=false" >> $GITHUB_OUTPUT
  34. echo "No changes to registry.json"
  35. else
  36. echo "changed=true" >> $GITHUB_OUTPUT
  37. echo "Registry has been updated"
  38. fi
  39. - name: Commit and push changes
  40. if: steps.check_changes.outputs.changed == 'true'
  41. run: |
  42. git config --local user.email "github-actions[bot]@users.noreply.github.com"
  43. git config --local user.name "github-actions[bot]"
  44. git add registry.json
  45. git commit -m "chore: auto-update component registry [skip ci]"
  46. git push
  47. - name: Summary
  48. if: steps.check_changes.outputs.changed == 'true'
  49. run: |
  50. echo "✅ Registry updated successfully" >> $GITHUB_STEP_SUMMARY
  51. echo "" >> $GITHUB_STEP_SUMMARY
  52. echo "### Updated Components" >> $GITHUB_STEP_SUMMARY
  53. echo "" >> $GITHUB_STEP_SUMMARY
  54. jq -r '
  55. "- **Agents:** \(.components.agents | length)",
  56. "- **Subagents:** \(.components.subagents | length)",
  57. "- **Commands:** \(.components.commands | length)",
  58. "- **Tools:** \(.components.tools | length)",
  59. "- **Plugins:** \(.components.plugins | length)",
  60. "- **Contexts:** \(.components.contexts | length)"
  61. ' registry.json >> $GITHUB_STEP_SUMMARY
  62. - name: No changes summary
  63. if: steps.check_changes.outputs.changed == 'false'
  64. run: |
  65. echo "ℹ️ No changes to registry" >> $GITHUB_STEP_SUMMARY