Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

integration-docs: Update Github Actions for new doc format.

Niloth P95e2b3906147
diff --git a/templates/zerver/integrations/github-actions.md b/templates/zerver/integrations/github-actions.md
index dce3eacdd7c..315fababd43 100644
--- a/templates/zerver/integrations/github-actions.md
+++ b/templates/zerver/integrations/github-actions.md
@@ -1,12 +1,76 @@
-It's easy to send Zulip messages from GitHub Actions! This is useful:
+# Zulip GitHub Actions integration
- * If you want to report the success or failure of an Action to Zulip.
- * If you want to send output from your actions to Zulip.
+Get Zulip notifications from GitHub Actions workflow runs!
-Instructions are available [here](https://github.com/zulip/github-actions-zulip#readme).
+{start_tabs}
-See also the [GitHub integration](/integrations/github).
+{tab|send-channel-message}
+
+1. {!create-a-generic-bot.md!}
+
+1. Add the `zulip/github-actions-zulip/send-message@v1` action to your GitHub
+ Actions [workflow file][workflows]. The `content` template parameter supports Markdown
+ and [GitHub Actions expressions][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 }}
+ 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!}
+
+1. Look up the ID of the recipient for DM notifications in their
+ [profile](https://zulip.com/help/view-someones-profile).
+
+1. Add the `zulip/github-actions-zulip/send-message@v1` action to your GitHub
+ Actions [workflow file][workflows]. The `content` template parameter
+ supports Markdown and [GitHub Actions expressions][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 }}
+ 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!}
![](/static/images/integrations/github-actions/001.png)
+
+### Related documentation
+
+* [Configuring the Send Message Action][README]
+
+* [Zulip GitHub Actions repository][repo]
+
+* [GitHub integration](/integrations/github)
+
+[README]: https://github.com/zulip/github-actions-zulip/blob/main/send-message/README.md
+[repo]: https://github.com/zulip/github-actions-zulip
+[expressions]: https://docs.github.com/en/actions/reference/evaluate-expressions-in-workflows-and-actions
+[workflows]: https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax
diff --git a/zerver/lib/markdown/tabbed_sections.py b/zerver/lib/markdown/tabbed_sections.py
index 1c3253b3340..669fdb39c43 100644
--- a/zerver/lib/markdown/tabbed_sections.py
+++ b/zerver/lib/markdown/tabbed_sections.py
@@ -53,6 +53,8 @@ TAB_SECTION_LABELS = {
"for-yourself": "For yourself",
"grafana-latest": "Grafana 8.3+",
"grafana-older-version": "Grafana 8.2 and below",
+ "send-channel-message": "Send a channel message",
+ "send-dm": "Send a DM",
}