Check Change Status #142
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |