Back to Zulip

Zulip GitHub Actions integration

templates/zerver/integrations/github-actions.md

12.02.9 KB
Original Source

Zulip GitHub Actions integration

Get Zulip notifications from GitHub Actions workflow runs!

{start_tabs}

{tab|send-channel-message}

  1. {!create-a-generic-bot.md!}

  2. Add the zulip/github-actions-zulip/send-message@v1 action to your GitHub Actions workflow file. The content template parameter supports Markdown and GitHub Actions expressions.

    {% raw %}- name: Send a channel message
    if: steps.backup.outcome == 'failure'
    uses: zulip/github-actions-zulip/send-message@v1
    with:
       # Your bot's API key and email
       api-key: ${{ secrets.ZULIP_API_KEY }}
       email: "[email protected]"
       organization-url: "https://your-org.zulipchat.com"
       type: "stream"
       # Notification channel
       to: "github-actions updates"
       topic: "scheduled backups"
       # Example: Notify if a previous GitHub Actions step with the ID "backup" fails.
       content: "Backup [failed](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) at <time:${{ steps.backup.outputs.time }}>.\n>${{ steps.backup.outputs.error }}"{% endraw %}
    

{tab|send-dm}

  1. {!create-a-generic-bot.md!}

  2. Look up the ID of the recipient for DM notifications in their profile.

  3. Add the zulip/github-actions-zulip/send-message@v1 action to your GitHub Actions workflow file. The content template parameter supports Markdown and GitHub Actions expressions.

    {% raw %}- name: Send a channel message
    if: steps.backup.outcome == 'failure'
    uses: zulip/github-actions-zulip/send-message@v1
    with:
       # Your bot's API key and email
       api-key: ${{ secrets.ZULIP_API_KEY }}
       email: "[email protected]"
       organization-url: "https://your-org.zulipchat.com"
       type: "private"
       # Recipient's user ID
       to: "295"
       # Example: Notify if a previous GitHub Actions step with the ID "backup" fails.
       content: "Backup [failed](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) at <time:${{ steps.backup.outputs.time }}>.\n>${{ steps.backup.outputs.error }}"{% endraw %}
    

{end_tabs}

{!congrats.md!}