1
- name : Standard Dependency Updates
1
+ name : Buddy Update
2
2
3
3
on :
4
4
schedule :
5
- - cron : ' 0 9 * * 1,3,5 '
6
- workflow_dispatch :
5
+ - cron : ' 0 */2 * * * ' # Every 2 hours for testing (more reasonable for testing)
6
+ workflow_dispatch : # Manual triggering for development
7
7
inputs :
8
8
strategy :
9
9
description : Update strategy
18
18
dry_run :
19
19
description : Dry run (preview only)
20
20
required : false
21
- default : false
21
+ default : true
22
22
type : boolean
23
23
packages :
24
24
description : Specific packages (comma-separated)
31
31
type : boolean
32
32
33
33
env :
34
+ # For workflow file updates, you need a Personal Access Token with 'repo' and 'workflow' scopes
35
+ # Create a PAT at: https://github.com/settings/tokens
36
+ # Add it as a repository secret named 'BUDDY_BOT_TOKEN'
37
+ # If BUDDY_BOT_TOKEN is not available, falls back to GITHUB_TOKEN (limited permissions)
34
38
GITHUB_TOKEN : ${{ secrets.BUDDY_BOT_TOKEN || secrets.GITHUB_TOKEN }}
35
39
36
40
permissions :
37
41
contents : write
38
42
pull-requests : write
39
43
issues : write
40
- actions : read
44
+ actions : write
41
45
checks : read
42
46
statuses : read
43
47
44
48
jobs :
45
- dependency-updates :
49
+ test- dependency-updates :
46
50
runs-on : ubuntu-latest
47
51
48
52
steps :
49
53
- name : Checkout repository
50
54
uses : actions/checkout@v4
51
55
with :
52
56
token : ${{ secrets.BUDDY_BOT_TOKEN || secrets.GITHUB_TOKEN }}
57
+ fetch-depth : 0 # Fetch full history for rebasing
58
+ persist-credentials : true
53
59
54
60
- name : Setup Bun
55
61
uses : oven-sh/setup-bun@v2
@@ -64,58 +70,136 @@ jobs:
64
70
tools : composer
65
71
coverage : none
66
72
73
+ - name : Install dependencies
74
+ run : bun install
75
+
67
76
- name : Install Composer dependencies (if needed)
68
77
if : ${{ hashFiles('composer.json') != '' }}
69
78
run : composer install --prefer-dist --optimize-autoloader
70
79
71
- - name : Install dependencies
72
- run : bun install
73
-
74
80
- name : Build buddy-bot
75
81
run : bun run build
76
82
77
- - name : Run dependency updates
83
+ - name : Configure Git
84
+ run : |
85
+ git config --global user.name "buddy-bot[bot]"
86
+ git config --global user.email "buddy-bot[bot]@users.noreply.github.com"
87
+
88
+ - name : Verify Composer setup
89
+ run : |
90
+ echo "🔍 Verifying Composer and PHP setup..."
91
+ php --version
92
+ composer --version
93
+ echo ""
94
+ echo "📦 Checking composer.json..."
95
+ if [ -f "composer.json" ]; then
96
+ echo "✅ composer.json found"
97
+ composer validate --no-check-all --strict
98
+ echo ""
99
+ echo "📋 Composer packages in composer.json:"
100
+ cat composer.json | jq -r '.require, ."require-dev" | to_entries[] | "\(.key): \(.value)"' 2>/dev/null || echo "Unable to parse with jq, showing raw content:"
101
+ else
102
+ echo "❌ composer.json not found"
103
+ fi
104
+
105
+ - name : Display test configuration
106
+ run : |
107
+ echo "🧪 **Buddy Bot Testing Mode**"
108
+ echo "Strategy: ${{ github.event.inputs.strategy || 'patch' }}"
109
+ echo "Dry Run: ${{ github.event.inputs.dry_run || 'true' }}"
110
+ echo "Packages: ${{ github.event.inputs.packages || 'all' }}"
111
+ echo "Verbose: ${{ github.event.inputs.verbose || 'true' }}"
112
+ echo "Triggered by: ${{ github.event_name }}"
113
+ echo "Repository: ${{ github.repository }}"
114
+ echo "Branch: ${{ github.ref_name }}"
115
+
116
+ - name : Run Buddy dependency scan
78
117
run : |
79
118
STRATEGY="${{ github.event.inputs.strategy || 'patch' }}"
80
119
PACKAGES="${{ github.event.inputs.packages }}"
81
120
VERBOSE="${{ github.event.inputs.verbose || 'true' }}"
82
- DRY_RUN="${{ github.event.inputs.dry_run || 'false' }}"
83
121
84
122
echo "🔍 Scanning for dependency updates..."
85
- set -e
123
+ echo "Strategy: $STRATEGY"
124
+ echo "Packages: ${PACKAGES:-all}"
125
+ echo "Verbose: $VERBOSE"
126
+ echo ""
127
+
128
+ set -e # Exit on any error
86
129
87
130
if [ "$PACKAGES" != "" ]; then
88
131
if [ "$VERBOSE" = "true" ]; then
89
- bunx buddy-bot scan --packages "$PACKAGES" --verbose
132
+ bunx buddy-bot- scan --packages "$PACKAGES" --verbose
90
133
else
91
- bunx buddy-bot scan --packages "$PACKAGES"
134
+ bunx buddy-bot- scan --packages "$PACKAGES"
92
135
fi
93
136
else
94
137
if [ "$VERBOSE" = "true" ]; then
95
- bunx buddy-bot scan --strategy "$STRATEGY" --verbose
138
+ bunx buddy-bot- scan --strategy "$STRATEGY" --verbose
96
139
else
97
- bunx buddy-bot scan --strategy "$STRATEGY"
140
+ bunx buddy-bot- scan --strategy "$STRATEGY"
98
141
fi
99
142
fi
100
143
101
- if [ "$DRY_RUN" != "true" ]; then
102
- echo "🚀 Running dependency updates..."
103
- if [ "$PACKAGES" != "" ]; then
104
- if [ "$VERBOSE" = "true" ]; then
105
- bunx buddy-bot update --packages "$PACKAGES" --verbose
106
- else
107
- bunx buddy-bot update --packages "$PACKAGES"
108
- fi
144
+ env :
145
+ GITHUB_TOKEN : ${{ secrets.BUDDY_BOT_TOKEN || secrets.GITHUB_TOKEN }}
146
+
147
+ - name : Run Buddy dependency updates
148
+ if : ${{ github.event.inputs.dry_run != 'true' }}
149
+ run : |
150
+ STRATEGY="${{ github.event.inputs.strategy || 'patch' }}"
151
+ PACKAGES="${{ github.event.inputs.packages }}"
152
+ VERBOSE="${{ github.event.inputs.verbose || 'true' }}"
153
+
154
+ echo "🚀 Running dependency updates..."
155
+ echo "This will create/update PRs if outdated dependencies are found"
156
+ echo ""
157
+
158
+ set -e # Exit on any error
159
+
160
+ if [ "$PACKAGES" != "" ]; then
161
+ if [ "$VERBOSE" = "true" ]; then
162
+ bunx buddy-bot update --packages "$PACKAGES" --verbose
109
163
else
110
- if [ "$VERBOSE" = "true" ]; then
111
- bunx buddy-bot update --strategy "$STRATEGY" --verbose
112
- else
113
- bunx buddy-bot update --strategy "$STRATEGY"
114
- fi
164
+ bunx buddy-bot update --packages "$PACKAGES"
115
165
fi
116
166
else
117
- echo "📋 DRY RUN MODE - No changes made"
167
+ if [ "$VERBOSE" = "true" ]; then
168
+ bunx buddy-bot update --strategy "$STRATEGY" --verbose
169
+ else
170
+ bunx buddy-bot update --strategy "$STRATEGY"
171
+ fi
118
172
fi
119
173
120
174
env :
121
175
GITHUB_TOKEN : ${{ secrets.BUDDY_BOT_TOKEN || secrets.GITHUB_TOKEN }}
176
+
177
+ - name : Dry run notification
178
+ if : ${{ github.event.inputs.dry_run == 'true' }}
179
+ run : |
180
+ echo "ℹ️ **Dry Run Mode** - No changes were made"
181
+ echo "To apply updates, run this workflow again with 'Dry run' set to false"
182
+
183
+ - name : Create test summary
184
+ if : always()
185
+ run : |
186
+ echo "## 🧪 Buddy Bot Testing Summary" >> $GITHUB_STEP_SUMMARY
187
+ echo "" >> $GITHUB_STEP_SUMMARY
188
+ echo "- **Strategy**: ${{ github.event.inputs.strategy || 'patch' }}" >> $GITHUB_STEP_SUMMARY
189
+ echo "- **Triggered by**: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
190
+ echo "- **Dry run**: ${{ github.event.inputs.dry_run || 'true' }}" >> $GITHUB_STEP_SUMMARY
191
+ echo "- **Packages**: ${{ github.event.inputs.packages || 'all' }}" >> $GITHUB_STEP_SUMMARY
192
+ echo "- **Verbose**: ${{ github.event.inputs.verbose || 'true' }}" >> $GITHUB_STEP_SUMMARY
193
+ echo "- **Time**: $(date)" >> $GITHUB_STEP_SUMMARY
194
+ echo "" >> $GITHUB_STEP_SUMMARY
195
+
196
+ if [ "${{ github.event_name }}" = "schedule" ]; then
197
+ echo "⏰ **Scheduled Run**: This was triggered automatically every 2 hours" >> $GITHUB_STEP_SUMMARY
198
+ echo "💡 **Tip**: Use 'Actions' tab to manually trigger with custom settings" >> $GITHUB_STEP_SUMMARY
199
+ else
200
+ echo "🖱️ **Manual Trigger**: This was triggered manually from the Actions tab" >> $GITHUB_STEP_SUMMARY
201
+ echo "⏰ **Auto-Schedule**: This workflow also runs every 2 hours for testing" >> $GITHUB_STEP_SUMMARY
202
+ fi
203
+
204
+ echo "" >> $GITHUB_STEP_SUMMARY
205
+ echo "📊 View detailed logs above for scan and update results." >> $GITHUB_STEP_SUMMARY
0 commit comments