@@ -45,11 +45,13 @@ jobs:
4545 run : |
4646 # See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
4747 echo "CERTIFICATE_PATH=${{ runner.temp }}/certificate.p12" >> "$GITHUB_ENV"
48+
4849 - name : Decode certificate
4950 env :
5051 CERTIFICATE : ${{ secrets[matrix.certificate.certificate-secret] }}
5152 run : |
5253 echo "${{ env.CERTIFICATE }}" | base64 --decode > "${{ env.CERTIFICATE_PATH }}"
54+
5355 - name : Verify certificate
5456 env :
5557 CERTIFICATE_PASSWORD : ${{ secrets[matrix.certificate.password-secret] }}
6264 echo "::error::Verification of ${{ matrix.certificate.identifier }} failed!!!"
6365 exit 1
6466 )
67+
6568 - name : Slack notification of certificate verification failure
6669 if : failure()
67- uses : rtCamp/action-slack-notify@v2
6870 env :
6971 SLACK_WEBHOOK : ${{ secrets.TEAM_CREATE_CHANNEL_SLACK_WEBHOOK }}
7072 SLACK_MESSAGE : |
7375 :warning::warning::warning::warning:
7476 SLACK_COLOR : danger
7577 MSG_MINIMAL : true
78+ uses : rtCamp/action-slack-notify@v2
7679
7780 - name : Get days remaining before certificate expiration date
7881 env :
@@ -98,27 +101,32 @@ jobs:
98101 'notAfter=(\K.*)'
99102 )
100103 )"
104+
101105 DAYS_BEFORE_EXPIRATION="$((($(date --utc --date="$EXPIRATION_DATE" +%s) - $(date --utc +%s)) / 60 / 60 / 24))"
106+
102107 # Display the expiration information in the log.
103108 echo "Certificate expiration date: $EXPIRATION_DATE"
104109 echo "Days remaining before expiration: $DAYS_BEFORE_EXPIRATION"
110+
105111 echo "::set-output name=days::$DAYS_BEFORE_EXPIRATION"
112+
106113 - name : Check if expiration notification period has been reached
107114 id : check-expiration
108115 run : |
109116 if [[ ${{ steps.get-days-before-expiration.outputs.days }} -lt ${{ env.EXPIRATION_WARNING_PERIOD }} ]]; then
110117 echo "::error::${{ matrix.certificate.identifier }} will expire in ${{ steps.get-days-before-expiration.outputs.days }} days!!!"
111118 exit 1
112119 fi
120+
113121 - name : Slack notification of pending certificate expiration
114122 # Don't send spurious expiration notification if verification fails.
115123 if : failure() && steps.check-expiration.outcome == 'failure'
116- uses : rtCamp/action-slack-notify@v2
117124 env :
118125 SLACK_WEBHOOK : ${{ secrets.TEAM_CREATE_CHANNEL_SLACK_WEBHOOK }}
119126 SLACK_MESSAGE : |
120127 :warning::warning::warning::warning:
121128 WARNING: ${{ github.repository }} ${{ matrix.certificate.identifier }} will expire in ${{ steps.get-days-before-expiration.outputs.days }} days!!!
122129 :warning::warning::warning::warning:
123130 SLACK_COLOR : danger
124- MSG_MINIMAL : true
131+ MSG_MINIMAL : true
132+ uses : rtCamp/action-slack-notify@v2
0 commit comments