Skip to content

Commit bc9bd92

Browse files
committed
don't push on workflow dispatch
Signed-off-by: Juan Antonio Osorio <[email protected]>
1 parent f322f38 commit bc9bd92

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

.github/workflows/update-tools.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ jobs:
167167
fi
168168
169169
- name: Commit changes
170-
if: steps.update.outputs.changed == 'true' || steps.update.outputs.warning-added == 'true'
170+
if: (steps.update.outputs.changed == 'true' || steps.update.outputs.warning-added == 'true') && github.event_name == 'pull_request'
171171
run: |
172172
git config --local user.email "[email protected]"
173173
git config --local user.name "GitHub Action"
@@ -191,10 +191,44 @@ jobs:
191191
fi
192192
193193
- name: Push changes
194-
if: steps.update.outputs.changed == 'true' || steps.update.outputs.warning-added == 'true'
194+
if: (steps.update.outputs.changed == 'true' || steps.update.outputs.warning-added == 'true') && github.event_name == 'pull_request'
195195
run: |
196196
git push
197197
198+
- name: Output diff for workflow dispatch
199+
if: github.event_name == 'workflow_dispatch' && (steps.update.outputs.changed == 'true' || steps.update.outputs.warning-added == 'true')
200+
run: |
201+
SERVER_NAME="${{ steps.server-info.outputs.server-name }}"
202+
203+
echo "## 🔧 Tool List Update for $SERVER_NAME" >> $GITHUB_STEP_SUMMARY
204+
echo "" >> $GITHUB_STEP_SUMMARY
205+
206+
if [ "${{ steps.update.outputs.changed }}" = "true" ]; then
207+
echo "✅ **Status**: Successfully updated tool list" >> $GITHUB_STEP_SUMMARY
208+
echo "" >> $GITHUB_STEP_SUMMARY
209+
echo "### Changes Made:" >> $GITHUB_STEP_SUMMARY
210+
echo '```diff' >> $GITHUB_STEP_SUMMARY
211+
git diff "${{ matrix.spec }}" >> $GITHUB_STEP_SUMMARY
212+
echo '```' >> $GITHUB_STEP_SUMMARY
213+
echo "" >> $GITHUB_STEP_SUMMARY
214+
echo "⚠️ **Note**: Changes were not committed because this is a workflow dispatch run. To apply these changes:" >> $GITHUB_STEP_SUMMARY
215+
echo "1. Create a new branch" >> $GITHUB_STEP_SUMMARY
216+
echo "2. Apply the changes shown above" >> $GITHUB_STEP_SUMMARY
217+
echo "3. Open a pull request" >> $GITHUB_STEP_SUMMARY
218+
else
219+
echo "❌ **Status**: Tool list update failed, warning added" >> $GITHUB_STEP_SUMMARY
220+
echo "" >> $GITHUB_STEP_SUMMARY
221+
echo "### Warning Added:" >> $GITHUB_STEP_SUMMARY
222+
echo '```diff' >> $GITHUB_STEP_SUMMARY
223+
git diff "${{ matrix.spec }}" >> $GITHUB_STEP_SUMMARY
224+
echo '```' >> $GITHUB_STEP_SUMMARY
225+
fi
226+
227+
echo "" >> $GITHUB_STEP_SUMMARY
228+
echo "**Server**: $SERVER_NAME" >> $GITHUB_STEP_SUMMARY
229+
echo "**Spec File**: \`${{ matrix.spec }}\`" >> $GITHUB_STEP_SUMMARY
230+
echo "**Triggered by**: @${{ github.actor }}" >> $GITHUB_STEP_SUMMARY
231+
198232
comment-summary:
199233
name: Post Summary Comment
200234
needs: [detect-changes, update-tools]

0 commit comments

Comments
 (0)