Skip to content

Commit ab9980b

Browse files
committed
Auto Deploy after Checks
1 parent 963c055 commit ab9980b

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Deploy to GitHub Pages
33
on:
44
push:
55
branches: [main]
6+
workflow_call: # Allow other workflows to trigger this
67

78
permissions:
89
contents: write

.github/workflows/monitor-checks.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ permissions:
1212
jobs:
1313
check-monitors:
1414
runs-on: ubuntu-latest
15+
outputs:
16+
changes: ${{ steps.commit.outputs.changes }}
1517

1618
steps:
1719
- name: Checkout repository
@@ -34,9 +36,20 @@ jobs:
3436
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
3537

3638
- name: Commit and push updates
39+
id: commit
3740
run: |
3841
git config --local user.email "github-actions[bot]@users.noreply.github.com"
3942
git config --local user.name "github-actions[bot]"
4043
git add data/history.json data/notification-state.json static/data/status.json
41-
git diff --staged --quiet || git commit -m "Update monitor status"
42-
git push
44+
if git diff --staged --quiet; then
45+
echo "changes=false" >> $GITHUB_OUTPUT
46+
else
47+
git commit -m "Update monitor status"
48+
git push
49+
echo "changes=true" >> $GITHUB_OUTPUT
50+
fi
51+
52+
deploy:
53+
needs: check-monitors
54+
if: needs.check-monitors.outputs.changes == 'true'
55+
uses: ./.github/workflows/deploy.yml

0 commit comments

Comments
 (0)