Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,69 @@ jobs:
attic push rc:main $(which attic)
nix build .#devShells.${{ matrix.system }}.default -o ./result-devshell
attic push rc:main ./result-devshell
- name: Prepare Slack context
if: failure()
id: slack-context
env:
EVENT_NAME: ${{ github.event_name }}
SHA: ${{ github.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
COMMIT_URL: ${{ github.event.head_commit.url }}
run: |
echo "short_sha=${SHA:0:7}" >> $GITHUB_OUTPUT
if [ "$EVENT_NAME" = "pull_request" ]; then
echo "trigger=PR <${PR_URL}|#${PR_NUMBER}: ${PR_TITLE}>" >> $GITHUB_OUTPUT
else
FIRST_LINE=$(printf '%s' "$COMMIT_MESSAGE" | head -1)
echo "trigger=push <${COMMIT_URL}|${FIRST_LINE}>" >> $GITHUB_OUTPUT
fi
- name: Notify Slack on failure
if: failure()
uses: slackapi/slack-github-action@v2
with:
webhook: ${{ secrets.SLACK_WEBHOOK_UPDATES_CI }}
webhook-type: incoming-webhook
payload-templating: true
payload: |
{
"attachments": [
{
"color": "#CC0000",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":x: CI build failed",
"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Host*\n${{ matrix.host }}"
},
{
"type": "mrkdwn",
"text": "*Trigger*\n${{ steps.slack-context.outputs.trigger }}"
}
]
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}> · <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ steps.slack-context.outputs.short_sha }}> · <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>"
}
]
}
]
}
]
}
Loading