Repository navigation
159 lines (129 loc) · 4.93 KB
/
Copy pathplugin-management.yml
File metadata and controls
159 lines (129 loc) · 4.93 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Plugin Management
'on':
schedule:
# Run daily at 2 AM UTC to check for plugin updates
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
operation:
description: 'Operation to perform'
required: true
default: 'check-updates'
type: choice
options:
- check-updates
- list-prs
- sync-submodules
permissions:
contents: write
pull-requests: write
issues: write
jobs:
plugin-operations:
name: Plugin Operations
runs-on: ubuntu-latest
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup GitHub CLI
run: |
gh auth setup-git
gh auth status
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check for plugin updates
if: github.event.inputs.operation == 'check-updates' || github.event_name == 'schedule'
run: |
echo "Checking for plugin updates..."
# List all plugin repositories
PLUGINS=("entity-plugin-examples" "entity-plugin-gpt-oss" "entity-plugin-stdlib" "entity-plugin-template")
for plugin in "${PLUGINS[@]}"; do
echo "Checking $plugin..."
# Get latest release
LATEST_RELEASE=$(gh release view --repo "Ladvien/$plugin" --json tagName -q .tagName 2>/dev/null || echo "No releases")
echo " Latest release: $LATEST_RELEASE"
# Get latest commit
LATEST_COMMIT=$(gh api "repos/Ladvien/$plugin/commits/main" --jq '.sha[0:7]' 2>/dev/null || echo "Unable to fetch")
echo " Latest commit: $LATEST_COMMIT"
# Check current submodule commit
if [ -d "plugins/${plugin#entity-plugin-}" ]; then
CURRENT_COMMIT=$(cd "plugins/${plugin#entity-plugin-}" && git rev-parse --short HEAD)
echo " Current commit: $CURRENT_COMMIT"
if [ "$LATEST_COMMIT" != "$CURRENT_COMMIT" ]; then
echo " ⚠️ Update available for $plugin"
else
echo " ✅ $plugin is up to date"
fi
fi
echo ""
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: List plugin PRs
if: github.event.inputs.operation == 'list-prs'
run: |
echo "Listing open PRs for plugin repositories..."
PLUGINS=("entity-plugin-examples" "entity-plugin-gpt-oss" "entity-plugin-stdlib" "entity-plugin-template")
for plugin in "${PLUGINS[@]}"; do
echo "PRs for $plugin:"
gh pr list --repo "Ladvien/$plugin" --state open --limit 10
echo ""
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Sync submodules to latest
if: github.event.inputs.operation == 'sync-submodules'
run: |
echo "Syncing submodules to latest commits..."
# Update all submodules to their latest remote commits
git submodule update --remote --merge
# Check if there are changes
if [ -n "$(git status --porcelain)" ]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Create a branch for the update
BRANCH_NAME="update-plugin-submodules-$(date +%Y%m%d)"
git checkout -b "$BRANCH_NAME"
# Commit the changes
git add .
git commit -m "chore: Update plugin submodules to latest versions
Auto-generated by GitHub Actions workflow"
# Push the branch
git push origin "$BRANCH_NAME"
# Create a pull request
gh pr create \
--title "chore: Update plugin submodules" \
--body "This PR updates the plugin submodules to their latest versions.
Auto-generated by the plugin management workflow.
Please review the changes and merge if all tests pass." \
--label "dependencies" \
--label "automated"
echo "✅ Pull request created for submodule updates"
else
echo "✅ All submodules are already up to date"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate plugin status report
if: always()
run: |
echo "## Plugin Status Report" > plugin-status.md
echo "" >> plugin-status.md
echo "Generated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> plugin-status.md
echo "" >> plugin-status.md
# List submodule status
echo "### Submodule Status" >> plugin-status.md
echo '```' >> plugin-status.md
git submodule status >> plugin-status.md
echo '```' >> plugin-status.md
# Upload as artifact
echo "Report saved to plugin-status.md"
- name: Upload plugin status report
if: always()
uses: actions/upload-artifact@v4
with:
name: plugin-status-report
path: plugin-status.md