name: Update cockroachdb-skills submodule on: schedule: - cron: '0 9 * * 1' # Weekly on Monday at 9am UTC workflow_dispatch: # Allow manual trigger permissions: contents: write pull-requests: write jobs: check-update: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true fetch-depth: 0 - name: Check for upstream updates id: check run: | cd submodules/cockroachdb-skills CURRENT=$(git rev-parse HEAD) git fetch origin main LATEST=$(git rev-parse origin/main) echo "current=$CURRENT" >> "$GITHUB_OUTPUT" echo "latest=$LATEST" >> "$GITHUB_OUTPUT" if [ "$CURRENT" != "$LATEST" ]; then echo "behind=true" >> "$GITHUB_OUTPUT" COMMITS=$(git log --oneline "$CURRENT..$LATEST" | wc -l | tr -d ' ') echo "commits=$COMMITS" >> "$GITHUB_OUTPUT" git log --oneline "$CURRENT..$LATEST" > /tmp/changelog.txt echo "changelog<> "$GITHUB_OUTPUT" cat /tmp/changelog.txt >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" else echo "behind=false" >> "$GITHUB_OUTPUT" fi - name: Update submodule if: steps.check.outputs.behind == 'true' run: | cd submodules/cockroachdb-skills git checkout origin/main - name: Sync skills from submodule if: steps.check.outputs.behind == 'true' run: | rm -rf skills cp -rL submodules/cockroachdb-skills/skills skills echo "Categories: $(find skills -mindepth 1 -maxdepth 1 -type d | wc -l | tr -d ' ')" echo "Skills: $(find skills -name 'SKILL.md' -type f | wc -l | tr -d ' ')" find skills -name "SKILL.md" -type f | sort - name: Update plugin.json skills array if: steps.check.outputs.behind == 'true' run: | SKILLS_JSON=$(find skills -name "SKILL.md" -type f | sed 's|/SKILL.md||' | sed 's|^|./|' | sort | jq -R . | jq -s .) jq --argjson skills "$SKILLS_JSON" '.skills = $skills' .claude-plugin/plugin.json > /tmp/plugin.json mv /tmp/plugin.json .claude-plugin/plugin.json - name: Create Pull Request if: steps.check.outputs.behind == 'true' uses: peter-evans/create-pull-request@v7 with: commit-message: "chore: update cockroachdb-skills submodule" title: "chore: update cockroachdb-skills submodule (${{ steps.check.outputs.commits }} new commits)" body: | Updates `cockroachdb-skills` submodule from `${{ steps.check.outputs.current }}` to `${{ steps.check.outputs.latest }}`. ### Upstream changes ``` ${{ steps.check.outputs.changelog }} ``` This PR was auto-generated by the [update-skills](${{ github.server_url }}/${{ github.repository }}/actions/workflows/update-skills.yml) workflow. branch: chore/update-cockroachdb-skills delete-branch: true labels: dependencies,automated