Repository navigation
feat: add custom GitHub Actions notifications - #150
Conversation
Review:
|
| @@ -0,0 +1,37 @@ | |||
| name: Notify Wire | |||
There was a problem hiding this comment.
Unsure if just by placing the action here it's somehow reachable by all the other repositories in wireapp org:
There was a problem hiding this comment.
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):
uses: wireapp/github-app/.github/actions/notify-wire@v1
# Conflicts: # src/test/kotlin/com/wire/github/ApplicationTest.kt
* Adjust Actions endpoint validation and authentication * Simplify `notify-wire` to URL, secret, and text inputs * Add Wire setup commands * Expand tests and documentation
* Added concise error bodies for invalid UUID, content type, authorization, credentials, JSON, and blank text * Kept authentication errors generic * Kept successful `200` responses empty * Updated tests to assert each error message
* Add dummy workflow in pull-request.yml to test custom action
* Generate and store a dedicated per-conversation Actions token * Replace `/github token` with `/github tokens` * Update the reusable action, workflow, documentation, and tests
* Upgrade to JVM SDK version 0.3.0 * Remove now unused APP ID
* Use SHA commit for actions/checkout instead of version tag
* Use QualifiedId throughout Actions token validation * Inject Redis commands directly into the token validator * Replace custom HTTP parsing with Ktor utilities * Consolidate credential get-or-create logic
| import java.nio.charset.StandardCharsets | ||
| import java.security.MessageDigest | ||
|
|
||
| class ActionsTokenValidator( |
There was a problem hiding this comment.
This strucrure is not bad, but there is a lot of configuration to use ActionsTokenValidator (register in DI, imports and so on) and (besides) tests, it's just a function called in one place.
Not sure it justifies the infrastructure, maybe better to just have the function directly in the place its needed.
Or maybe instead of getting calls to Redis storage from many places, I would suggest a RedisRepository that contains the GET and SET operations for both the webhook and the actions (setWebhookSecret, setActionSecret, getWebhookSecret, getActionSecret). This way the code can just pass around conversationId and the parsing to conversationId.toActionsTokenStorageKey() can happen inside the RedisRepository and the rest of the code is unaware.
Again current setup works but I think it can be quite simpler
There was a problem hiding this comment.
hmmm makes sense to have the RedisRepository, but I would do it in another PR/ticket as this has grown quite a bit (given the custom notification + jvm sdk update and some other improvements).
We are still missing metrics for custom notifications (but not part of this PR/ticket) so maybe we can introduce both (metrics + redisRepository) in the future if you agree
| Use `/github webhook help` in the Wire conversation for its URL, secret, and setup instructions. | ||
|
|
||
| ### Workflow-authored GitHub Actions notifications | ||
|
|
||
| Use the reusable composite action to send workflow-composed text to a Wire conversation. The endpoint | ||
| authenticates with a dedicated per-conversation Actions token. Store it as a GitHub Actions secret and do | ||
| not print it in workflow logs. Empty or whitespace-only messages are rejected with `400`; a missing or | ||
| invalid token is rejected with `403`. | ||
|
|
||
| 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. |
There was a problem hiding this comment.
This is too much for the README and too specific, just keep this part and the yaml example of the action IMHO
There was a problem hiding this comment.
Removed most of the explanation parts and kept the inputs table/yaml configuration and all commands at the bottom
* move help command metrics into GitHubCommandHandler * simplify command dispatch and update tests
* Update README
* fix ktlint
* remove test workflow dispatch with own action
spoonman01
left a comment
There was a problem hiding this comment.
Approving this but mostly because we are in a hurry to deploy the apps this sprint, I would really like to have the refactoring about RedisRepository
Yes!! will be worked on WPB-29141 |
Summary