Repository navigation
feat: add custom GitHub Actions notifications #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
37a264b
1a117d9
5458fe4
fcb6d06
1d4968c
de57452
a47f127
86df3de
3901b53
99248de
18d5b31
d3f6c9f
920c846
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Notify Wire | ||
| description: Send a custom message to a Wire conversation through github-app | ||
| inputs: | ||
| webhook-url: | ||
| description: Full github-app Actions endpoint URL for the Wire conversation | ||
| required: true | ||
| token: | ||
| description: GitHub Actions token configured for the Wire conversation | ||
| required: true | ||
| text: | ||
| description: Message text to send | ||
| required: true | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Send message to Wire | ||
| shell: bash | ||
| env: | ||
| WIRE_WEBHOOK_URL: ${{ inputs.webhook-url }} | ||
| WIRE_ACTIONS_TOKEN: ${{ inputs.token }} | ||
| MESSAGE_TEXT: ${{ inputs.text }} | ||
| run: | | ||
| set -euo pipefail | ||
| python3 -c 'import json, os; print(json.dumps({"text": os.environ["MESSAGE_TEXT"]}))' \ | ||
| | curl --fail-with-body --silent --show-error \ | ||
| -X POST "$WIRE_WEBHOOK_URL" \ | ||
| -H "Authorization: Bearer ${WIRE_ACTIONS_TOKEN}" \ | ||
| -H "Content-Type: application/json" \ | ||
| --data-binary @- | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,14 +23,16 @@ No license is granted to the Wire trademark and its associated logos, all of whi | |
|
|
||
| Here's a list of features included in this project: | ||
|
|
||
| | Name | Description | | ||
| |------------------------------------------|--------------------------------------------| | ||
| | /health | Healthcheck endpoint returning HTTP OK 200. | | ||
| | /{conversation_id}/{conversation_domain} | Webhook endpoint. | | ||
| | Name | Description | | ||
| |--------------------------------------------------------|--------------------------------------------------| | ||
| | `/health` | Healthcheck endpoint returning HTTP OK 200. | | ||
| | `/{conversation_id}/{conversation_domain}` | Receive signed GitHub repository webhooks. | | ||
| | `/actions/{conversation_id}/{conversation_domain}` | Receive workflow-authored GitHub Actions text. | | ||
|
|
||
| ### GitHub Actions notifications | ||
| ### Repository webhook notifications | ||
|
|
||
| The existing webhook endpoint supports centralized notifications for these GitHub Actions events: | ||
| The existing webhook endpoint provides centralized notifications rendered by this service. It supports | ||
| these GitHub Actions-related repository webhook events: | ||
|
|
||
| | GitHub event | Supported action | Notification | | ||
| |--------------|------------------|--------------| | ||
|
|
@@ -41,6 +43,43 @@ All completed conclusions are reported, including successful, failed, cancelled, | |
| results when GitHub provides them. Other actions, such as `requested`, `queued`, and `in_progress`, are | ||
| accepted by the endpoint but do not produce a Wire message. | ||
|
|
||
| Use `/github webhook help` in the Wire conversation for its URL, secret, and setup instructions. | ||
|
|
||
| ### Workflow-authored GitHub Actions notifications | ||
|
|
||
| Use `/github actions help` in the Wire conversation to obtain the complete endpoint URL and Actions | ||
| token. Store them as `WIRE_WEBHOOK_URL` and `WIRE_ACTIONS_TOKEN` respectively. | ||
|
Comment on lines
+46
to
+51
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is too much for the README and too specific, just keep this part and the yaml example of the action IMHO
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed most of the explanation parts and kept the inputs table/yaml configuration and all commands at the bottom |
||
|
|
||
| The action accepts these inputs: | ||
|
|
||
| | Input | Required | Description | | ||
| |-------|----------|-------------| | ||
| | `webhook-url` | Yes | Complete `/actions/{conversation_id}/{conversation_domain}` URL. | | ||
| | `token` | Yes | Dedicated Actions bearer token. | | ||
| | `text` | Yes | Complete message text to send without service-side formatting. | | ||
|
|
||
| ```yaml | ||
| - name: Notify Wire on failure | ||
| if: failure() || cancelled() | ||
| uses: wireapp/github-app/.github/actions/notify-wire@v1 | ||
| with: | ||
| webhook-url: ${{ secrets.WIRE_WEBHOOK_URL }} | ||
| token: ${{ secrets.WIRE_ACTIONS_TOKEN }} | ||
| text: | | ||
| CI failed for ${{ github.repository }} on `${{ github.ref_name }}`. | ||
| Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| ``` | ||
|
|
||
| ## Wire commands | ||
|
|
||
| | Command | Description | | ||
| |---------|-------------| | ||
| | `/github help` | List available commands and notification approaches. | | ||
| | `/github tokens` | Show or create the webhook secret and Actions token. | | ||
| | `/github webhook help` | Show repository webhook setup instructions. | | ||
| | `/github actions help` | Show the Actions endpoint, token usage, and reusable action example. | | ||
|
|
||
|
|
||
| ## Building & Running | ||
|
|
||
| To build or run the project, you can use the IDE Run configuration with environment variables. | ||
|
|
@@ -57,7 +96,6 @@ GHAPP_SERVER_PORT=8083 | |
| GHAPP_REDIS_URL=redis://username:password@host:port | ||
| WIRE_SDK_API_HOST=https://nginz-https.chala.wire.link | ||
| WIRE_SDK_API_TOKEN=myApiToken | ||
| WIRE_SDK_APP_ID=f562e146-dec2-4d85-93c7-7132746b5cca | ||
| WIRE_SDK_CRYPTOGRAPHY_STORAGE_PASSWORD=myDummyPasswordmyDummyPassword01 | ||
| ``` | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure if just by placing the action here it's somehow reachable by all the other repositories in wireapp org:
https://docs.github.com/en/actions/how-tos/reuse-automations/share-with-your-organization#sharing-actions-and-workflows-with-your-organization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this repository is public, it is open. The configurations/changes are only needed if the repository is set to private.
Also, after this PR is approved and merged, I will be creating a tag so the actions can be reachable by (or something like):