-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (71 loc) · 3.06 KB
/
Copy pathupdate-skills.yml
File metadata and controls
81 lines (71 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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<<EOF" >> "$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