forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (67 loc) · 2.68 KB
/
notify-stalled-snapshots.yml
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
---
name: notify-stalled-snapshots
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * 1'
permissions:
contents: read
env:
EMAIL: [email protected]
URL_QUERY: 'https://github.com/elastic/beats/pulls?q=is%3Apr+is%3Aopen+label%3ATeam%3ABeats-On-Call'
JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
jobs:
filter:
runs-on: ubuntu-latest
timeout-minutes: 1
outputs:
matrix: ${{ steps.generator.outputs.matrix }}
steps:
- id: generator
uses: elastic/apm-pipeline-library/.github/actions/elastic-stack-snapshot-branches@current
notify:
runs-on: ubuntu-latest
needs: [filter]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.filter.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "${{ matrix.branch }}"
- id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- id: search
run: |-
if git --no-pager \
log --pretty=format: \
--name-only \
--since="7 days ago" \
| grep 'testing/environments/snapshot.yml' ; then
echo "found=false" >> $GITHUB_OUTPUT
else
echo "found=true" >> $GITHUB_OUTPUT
fi
env:
GH_TOKEN: ${{ github.token }}
- if: ${{ contains(steps.search.outputs.found, 'true') }}
name: Report obsoleted branches (slack)
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
with:
channel-id: '#ingest-notifications'
payload: ":red_circle: Elastic Stack version for the `${{ matrix.branch }}` branch has not been updated for a while (`> 7 days`). Review the (<${{ env.URL_QUERY }}|open PRs>)"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- if: ${{ contains(steps.search.outputs.found, 'true') }}
name: Report obsoleted branches (email)
uses: dawidd6/action-send-mail@2cea9617b09d79a095af21254fbcb7ae95903dde
with:
server_address: ${{ secrets.MAIL_SERVER }}
username: ${{ secrets.MAIL_USERNAME }}
password: ${{ secrets.MAIL_PASSWORD }}
subject: '[${{ matrix.branch }}] ${{ steps.date.outputs.date }}: Elastic Stack version has not been updated recently.'
to: ${{ env.EMAIL }}
from: ${{ secrets.MAIL_FROM }}
reply_to: ${{ secrets.MAIL_REPLY }}
body: 'Elastic Stack version for the ${{ matrix.branch }} branch has not been updated for a while (> 7 days). Review the open PRs in ${{ env.URL_QUERY }}. Generated automatically with ${{ env.JOB_URL }}'