-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (57 loc) 路 2.64 KB
/
Copy pathgithub-watchtower.yml
File metadata and controls
65 lines (57 loc) 路 2.64 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
name: GitHub Watchtower
on:
schedule:
- cron: '0 * * * *' # Every hour
workflow_dispatch: {}
permissions:
contents: read
pull-requests: read
# Skip on push events - only run on schedule or manual dispatch
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
jobs:
watch:
name: Monitor repo activity and open PRs
runs-on: ubuntu-latest
steps:
- name: Check recent commits
id: commits
run: |
COMMITS=$(gh api repos/atomeam/Aether/commits --paginate -q '.[:5] | .[] | {sha, message: .commit.message[:50], author: .author.login, date: .commit.committer.date}' || echo "[]")
echo "$COMMITS"
echo "commits<<EOF" >> "$GITHUB_OUTPUT"
echo "$COMMITS" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Check open PRs
id: prs
run: |
PRS=$(gh pr list --state open --json number,title,headRefName,createdAt,author --jq '.[] | {number, title, head: .headRefName, created: .createdAt, author: .author.login}' || echo "[]")
echo "$PRS"
echo "prs<<EOF" >> "$GITHUB_OUTPUT"
echo "$PRS" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Check Issue #117 status
id: issue117
run: |
ISSUE=$(gh issue view 117 --json state,title,url --jq '{state, title, url}' || echo "{}")
echo "$ISSUE"
echo "issue117<<EOF" >> "$GITHUB_OUTPUT"
echo "$ISSUE" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Alert on new critical PRs
if: contains(steps.prs.outputs.prs, 'deploy') || contains(steps.prs.outputs.prs, 'billing') || contains(steps.prs.outputs.prs, 'stripe')
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
curl -s -X POST "$SLACK_WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d "{\"text\": \"馃憖 *GitHub Watchtower*\nCritical PRs detected:\n${{ steps.prs.outputs.prs }}\"}" || echo "Slack notification failed"
- name: Log to Notion (via bridge)
run: |
curl -sf -X POST "https://bridge.a-to-mind.com/api/github/status" \
-H "Content-Type: application/json" \
-d "{
\"recent_commits\": \"${{ steps.commits.outputs.commits }}\",
\"open_prs\": \"${{ steps.prs.outputs.prs }}\",
\"issue117_status\": \"${{ steps.issue117.outputs.issue117 }}\",
\"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"
}" 2>/dev/null || echo "Bridge endpoint not available"