name: Notify nightly failure on: workflow_call: secrets: MATTERMOST_PUBLIC_CERTBOT_CHANNEL_WEBHOOK: required: true permissions: actions: read jobs: notify_mattermost: name: Notify mattermost runs-on: ubuntu-latest steps: - name: Calculate duration shell: bash id: duration env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} run: |- START=$(gh run view "$GITHUB_RUN_ID" --json startedAt --jq ".startedAt") START_SECONDS=$(date -d"$START" +%s) NOW_SECONDS=$(date +%s) DURATION=$(date -d@"$((NOW_SECONDS - START_SECONDS))" -u +%H:%M:%S) echo "result = $DURATION" echo "result=$DURATION" >> "$GITHUB_OUTPUT" - name: Send to mattermost uses: mattermost/action-mattermost-notify@ae31bb6f9e26a54336e79696f108a2c91cf55b4e with: MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_PUBLIC_CERTBOT_CHANNEL_WEBHOOK }} PAYLOAD: |- { "attachments": [ { "color": "danger", "fields": [ null, { "title": "Duration", "value": "${{ steps.duration.outputs.result }}", "short": true }, { "title": "Workflow", "value": "nightly", "short": true } ], "pretext": "Run failed", "mrkdwn_in": [ "pretext" ], "fallback": "Run ${{ github.run_id }} failed https://github.com/certbot/actions/runs/${{ github.run_id }}" } ] }