/action-mattermost-notify

GitHub Action for sending a notification to a Mattermost channel

Primary LanguageGo

Mattermost Actions

GitHub Actions for automating builds, deployments, and so on.

You need generate a mattermost.json file in a step before. For the message format you can check the Mattermost documentation

Also you can check the files for example:

Environment Variables

Variable Default Purpose
MATTERMOST_WEBHOOK_URL (Mandatory) The Mattermost Incoming Webhook
MATTERMOST_CHANNEL The name of the channel you want to post, by default will post in the channel that was setup in the webhook creation
MATTERMOST_USERNAME The name of the sender of the message. ie, "GitHubAction"
MATTERMOST_ICON User/Bot icon shown with Mattermost message

You can see the action block with some variables as below:

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Create the Mattermost Message
      run: |
        echo "{\"text\":\"testing github action :tada:\"}" > mattermost.json
    - uses: mattermost/action-mattermost-notify@master
      env:
        MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}

Building

To build the action-mattermost-notify app, use the Dockerfile:

podman build . -f ./Dockerfile -t action-mattermost-notify:local

Or just build with:

go build -o action-mattermost-notify .