Skip to content
send

GitHub Action

GitHub Action for Mercure

1.1.0 Latest version

GitHub Action for Mercure

send

GitHub Action for Mercure

Send a Mercure publish event

Installation

Copy and paste the following snippet into your .yml file.

              

- name: GitHub Action for Mercure

uses: Ilshidur/action-mercure@1.1.0

Learn more about this action in Ilshidur/action-mercure

Choose a version

๐Ÿš€ GitHub Action for Mercure

GitHubActions

Send a Mercure publish event. Simple as that.

GitHub Action


Demo

  1. Go to https://demo.mercure.rocks, in the Subscribe section.
  2. Subscribe for notifications on this topic : foo.
  3. ๐ŸŒŸ Star ๐ŸŒŸ this repo !
  4. Quickly switch to the Mercure demo page to see a notification in your browser.

Usage

New YML synthax

- name: Publish notification
 env:
   MERCURE_HUB_URL: ${{ secrets.MERCURE_HUB_URL }}
   MERCURE_HUB_JWT: ${{ secrets.MERCURE_HUB_JWT }}
   MERCURE_TOPICS: topic1,topic2
 uses: Ilshidur/action-mercure@master
 with:
   args: '{ \"hello\": \"world\" }'

(legacy) HCL synthax

action "Publish notification" {
  uses = "Ilshidur/action-mercure@master"
  secrets = ["MERCURE_HUB_URL", "MERCURE_HUB_JWT"]
  args = "{ \"hello\": \"world\" }"
}

NOTICE : for stability purposes, it is recommended to use the action with an explicit commit SHA-1 :

uses = "Ilshidur/action-mercure@6265c17" (=> link to the commits list : https://github.com/Ilshidur/action-mercure/commits/master)

Arguments

The argument is the content of the event to send. It is RECOMMENDED to use JSON.

Environment variables can be interpolated in the message using brackets ({{ and }}) :

e.g.: args: "{ \"action\": \"{{ GITHUB_ACTION }}\" }"

Environment variables

  • MERCURE_TOPICS: the Mercure topics. Supports interpolation using ({{ and }}).

Secrets

  • MERCURE_HUB_URL: the public Mercure hub URL (required).
  • MERCURE_HUB_JWT: the publisher JWT (required).
  • That's all.

License

GNU GENERAL PUBLIC LICENSE v3.


Don't forget to ๐ŸŒŸ Star ๐ŸŒŸ the repo if you like this GitHub Action !
Your feedback is appreciated