-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (58 loc) · 2.13 KB
/
surge-teardown-old-domains.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
name: Teardown old surge.sh domains
on:
schedule:
- cron: '0 3 * * 6'
workflow_dispatch:
inputs:
send-slack-notifications:
description: 'If true, send slack notifications when errors occur'
required: false
type: boolean
default: false
jobs:
teardown_old_deployments:
runs-on: ${{ vars.RUNNER_UBUNTU }}
steps:
- name: Teardown surge deployments created more than 1 month ago
uses: adrianjost/[email protected]
with:
regex: '[1-9]+ month.? ago'
env:
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
- name: Send message to Slack channel
if: failure() && (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.send-slack-notifications == 'true') )
uses: slackapi/[email protected]
with:
channel-id: ${{ vars.SLACK_CHANNEL_ID_NOTIFICATIONS }}
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":fire: The teardown of old surge.sh domains failed!",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "More details about the error <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}?check_suite_focus=true| here>"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@channel *We need someone*! \n - Add a :fire_extinguisher: if you investigate the problem (only one person is required) \n - Add a :sweat_drops: when it’s done (and eventually a :party_parrot:)"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}