-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (85 loc) · 3.03 KB
/
check-change-status.yaml
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
name: Check Change Status
on:
workflow_run:
workflows: [OctoDNS Sync]
types: [completed]
branches: [main]
jobs:
check-change-status:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python 3.11
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.11
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets.DNS_CHECK_CHANGE_STATUS_AWS_ROLE_ARN }}
aws-region: us-east-1
- name: Install dependencies
run: |
make install
- name: Get hosted zone changed files
id: hosted-zone-changed-files
uses: tj-actions/changed-files@40853de9f8ce2d6cfdc73c1b96f14e22ba44aec4 # v45.0.0
with:
files: |
hostedzones/**
- name: Set hosted zone changed files environment variable
env:
HOSTED_ZONE_CHANGED_FILES: ${{ steps.hosted-zone-changed-files.outputs.all_changed_files }}
if: steps.hosted-zone-changed-files.outputs.any_changed == 'true'
run: |
echo "hosted_zone_changed_files=${HOSTED_ZONE_CHANGED_FILES}" >> "$GITHUB_ENV"
echo "$hosted_zone_changed_files"
- name: Check change status
id: check-change-status
if: steps.hosted-zone-changed-files.outputs.any_changed == 'true'
run: |
pipenv run python3 -m bin.check_change_status
env:
CHANGE_STATUS_OUTPUT: ${{ env.CHANGE_STATUS_OUTPUT }}
PYTHONUNBUFFERED: 1
- name: Send notification to Slack
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "📋 DNS Change Status"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Please inform requester of successful DNS change for changes showing as INSYNC."
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "A manual check is required for changes still showing as PENDING."
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "```${{ env.CHANGE_STATUS_OUTPUT }}```"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK