-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathspring-announce-milestone-planning.yml
More file actions
35 lines (29 loc) · 1.14 KB
/
spring-announce-milestone-planning.yml
File metadata and controls
35 lines (29 loc) · 1.14 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
name: Announce Milestone Planning in Chat
# Must be used for `on: milestone: types: [created, edited]` GH events, and repo must have `SPRING_RELEASE_CHAT_WEBHOOK_URL` secret
on:
workflow_call:
secrets:
SPRING_RELEASE_CHAT_WEBHOOK_URL:
required: true
jobs:
announce-milestone-planning:
runs-on: ubuntu-latest
if: github.event.milestone.due_on
steps:
- run: |
dueDate=${{ github.event.milestone.due_on }}
dueDate=${dueDate%T*}
changesDueOn=${{ github.event.changes.due_on.from }}
changesDueOn=${changesDueOn%T*}
if [ '${{ github.event.action }}' = 'edited' -a '$changesDueOn' = '$dueDate' ]
then
exit 0
fi
if [ $dueDate = $(date '+%F') ]
then
dueDate=today
else
dueDate="on $(date -d $dueDate '+%B %d')"
fi
curl -X POST '${{ secrets.SPRING_RELEASE_CHAT_WEBHOOK_URL }}' -H 'Content-Type: application/json' \
-d '{ text: "${{ github.event.repository.name }}-planning `${{ github.event.milestone.title }}` '"$dueDate"'"}'