-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (94 loc) · 3.83 KB
/
watch-domains-ssl-dns.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Check domain SSL and DNS
on:
schedule:
# Run this workflow at 11:00 UTC+3
- cron: '0 8 * * *'
env:
BRANCH: 'master'
# BRANCH: ${GITHUB_REF##*/}
jobs:
recreate-doc:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.BRANCH }}
- name: Recreate document
run: |
rm -rf README.md
cp README.template.md README.md
echo "" >> README.md
echo "## Sites" >> README.md
echo "" >> README.md
echo "| Domain | SSL | SSL expires | Paid | Paid till |" >> README.md
echo "| - | - | - | - | - |" >> README.md
- uses: EndBug/add-and-commit@v7
with:
author_name: github-actions
author_email: 41898282+github-actions[bot]@users.noreply.github.com
message: 'Recreate sites file'
check:
runs-on: ubuntu-20.04
name: Check
needs: [recreate-doc]
strategy:
max-parallel: 1
matrix:
domain:
- https://codex.so
- https://ifmo.su
- https://editorjs.io
- https://hawk.so
# CodeX Media sites
- https://school332.ru
- https://school181.ru
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.BRANCH }}
- name: Check domain SSL and registry expire date
id: check-domain
uses: codex-team/[email protected]
with:
url: ${{ matrix.domain }}
- run: echo 'SSL cert has ${{ steps.check-domain.outputs.ssl-expire-days-left }} days left'
- run: echo 'Paid ${{ steps.check-domain.outputs.ssl-expire-days-left }} days left'
- name: Add site info
run: |
echo "| ${{ matrix.domain }} | ${{ fromJSON('["", "🧨"]')[!steps.check-domain.outputs.ssl-expire-days-left || steps.check-domain.outputs.ssl-expire-days-left < 10] }} | ${{ steps.check-domain.outputs.ssl-expire-date }} | ${{ fromJSON('["⚠️", ""]')[steps.check-domain.outputs.paid-till-days-left < 10] }} | ${{ steps.check-domain.outputs.paid-till-date }} |" >> README.md
- uses: EndBug/add-and-commit@v7
with:
author_name: github-actions
author_email: 41898282+github-actions[bot]@users.noreply.github.com
message: 'Add info for ${{ matrix.domain }}'
- name: Create an issue if paid till number is below limit
if: ${{ steps.check-domain.outputs.paid-till-days-left && steps.check-domain.outputs.paid-till-days-left < 10 }}
uses: rishabhgupta/git-action-issue@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: ⚠️ ${{ matrix.domain }} — registry expiries in ${{ steps.check-domain.outputs.paid-till-days-left }} days
body: 'Paid till: `${{ steps.check-domain.outputs.paid-till-date }}`'
- name: Create an issue if SSL lifespan days number is below limit
if: ${{ steps.check-domain.outputs.ssl-expire-days-left && steps.check-domain.outputs.ssl-expire-days-left < 10 }}
uses: rishabhgupta/git-action-issue@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: 🧨 ${{ matrix.domain }} — SSL cert expires in ${{ steps.check-domain.outputs.ssl-expire-days-left }} days
body: 'Valid till: `${{ steps.check-domain.outputs.ssl-expire-date }}`'
save:
if: ${{ always() }}
needs: [recreate-doc, check]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.BRANCH }}
- name: Recreate document
run: |
echo "" >> README.md
echo "Updated at $(date +'%Y-%m-%d %H:%M:%S') UTC" >> README.md
- uses: EndBug/add-and-commit@v7
with:
author_name: github-actions
author_email: 41898282+github-actions[bot]@users.noreply.github.com
message: 'Add datetime for last update'