This GitHub Action collects all pull requests merged in the last 24 hours for the current repository and posts a formatted list to a Mattermost channel via an incoming webhook.
- Uses the GitHub CLI (
gh) to query merged PRs. - Automatically detects the current repository (
$GITHUB_REPOSITORY). - Outputs a nicely formatted list including PR number, title, URL, and author.
- Sends the result to Mattermost using a webhook.
- If no PRs were merged in the last 24h, it posts a fallback message.
| Name | Required | Description |
|---|---|---|
mattermost_webhook_url |
Yes | Incoming webhook URL for your Mattermost channel. |
gh_token |
Yes | GitHub token (usually secrets.GITHUB_TOKEN) to authenticate with the GitHub CLI. |
hours |
No | How many hours back to search for merged PRs. (default: 24) |
skip_if_no_prs |
No | If it is true, skip sending if there is no prs |
name: post-merged-prs
on:
schedule:
- cron: "0 0 * * *" # Runs daily at 00:00 UTC
workflow_dispatch:
jobs:
post-prs:
runs-on: ubuntu-latest
steps:
- uses: Gen5HQ/mattermost-github-watcher@[version]
with:
mattermost_webhook_url: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
If PRs were merged in the last 24h, the Mattermost message will look like:
If no PRs were merged:
- The GitHub CLI is preinstalled on GitHub-hosted runners.
- This action must have permission to read pull requests. By default,
secrets.GITHUB_TOKENis sufficient.