Merge pull request #528 from TencentCloudBase/feature/cloudrun-deploy… #70
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: Push Skills Repository | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'config/source/skills/**' | |
| - 'config/source/guideline/**' | |
| - 'scripts/build-skills-repo.mjs' | |
| - 'scripts/skills-repo-template/readme-template.md' | |
| workflow_dispatch: | |
| jobs: | |
| push-skills: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout source repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Build skills repository | |
| run: | | |
| node scripts/build-skills-repo.mjs | |
| - name: Checkout target repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: TencentCloudBase/skills | |
| path: skills-repo | |
| token: ${{ secrets.SKILLS_REPO_TOKEN }} | |
| - name: Copy output to target repository | |
| run: | | |
| cd skills-repo | |
| echo "Cleaning auto-generated content, keeping whitelisted local skills..." | |
| # 1. 只删除自动生成的内容,保留白名单目录 | |
| # - 保留:setup-cloudbase-openclaw | |
| # - 保留:所有以 local- 前缀命名的目录(比如 local-*, 方便以后扩展) | |
| for entry in $(find . -mindepth 1 -maxdepth 1 ! -name '.git'); do | |
| name="$(basename "$entry")" | |
| case "$name" in | |
| setup-cloudbase-openclaw|local-*) | |
| echo "Keep local skill: $name" | |
| ;; | |
| *) | |
| echo "Remove generated entry: $name" | |
| rm -rf "$entry" | |
| ;; | |
| esac | |
| done | |
| # 2. 拷贝生成产物覆盖(如果有同名目录,会被上面的删除逻辑释放出来) | |
| cp -r ../.skills-repo-output/* . | |
| - name: Commit and push changes | |
| env: | |
| SKILLS_REPO_TOKEN: ${{ secrets.SKILLS_REPO_TOKEN }} | |
| run: | | |
| cd skills-repo | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Configure git to use token for push | |
| git remote set-url origin https://x-access-token:${SKILLS_REPO_TOKEN}@github.com/TencentCloudBase/skills.git | |
| # Check if there are any changes | |
| if [ -n "$(git status --porcelain)" ]; then | |
| git add . | |
| git commit -m "chore: sync skills from CloudBase-AI-ToolKit [skip ci]" | |
| git push | |
| else | |
| echo "No changes to commit" | |
| fi |