|
| 1 | +# Gitter notify - Github action |
| 2 | + |
| 3 | +A [GitHub Action](https://github.com/features/actions) to send a message to a Gitter room. |
| 4 | + |
| 5 | +**Example** |
| 6 | + |
| 7 | +<img width="485" alt="gitter-github-action-example" src="https://user-images.githubusercontent.com/17607423/79047650-97327a00-7c35-11ea-8ebb-5348ea23fbc8.png"> |
| 8 | + |
| 9 | + |
| 10 | +## Usage |
| 11 | + |
| 12 | +You can use this action after any other action. Here is an example setup of this action: |
| 13 | + |
| 14 | +1. Create a `.github/workflows/gitter-notify.yml` file in your GitHub repo. |
| 15 | +2. Add the following code to the `gitter-notify.yml` file. |
| 16 | + |
| 17 | +```yml |
| 18 | +on: [push] |
| 19 | + |
| 20 | +jobs: |
| 21 | + send_message: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + name: Send test message |
| 24 | + |
| 25 | + steps: |
| 26 | + - id: initial |
| 27 | + uses: juztcode/gitter-github-action@v1 |
| 28 | + with: |
| 29 | + room-id: ${{ secrets.GITTER_ROOM_ID }} |
| 30 | + token: ${{ secrets.GITTER_TOKEN }} |
| 31 | + text: Pending |
| 32 | + |
| 33 | + - uses: juztcode/gitter-github-action@v1 |
| 34 | + with: |
| 35 | + room-id: ${{ secrets.GITTER_ROOM_ID }} |
| 36 | + token: ${{ secrets.GITTER_TOKEN }} |
| 37 | + text: Success |
| 38 | + message-id: ${{ steps.initial.outputs.message-id }} |
| 39 | +``` |
| 40 | +
|
| 41 | +3. Create `GITTER_ROOM_ID` and `GITTER_TOKEN` secrets using [GitHub Action's Secret](https://developer.github.com/actions/creating-workflows/storing-secrets). |
| 42 | +4. You can get Gitter personal access token from [Gitter Developer Page](https://developer.gitter.im/apps). |
| 43 | + |
| 44 | + |
| 45 | +## Inputs |
| 46 | + |
| 47 | +Input | Purpose |
| 48 | +------------------|--------------------------------------------------------------------------------------------------------------------------------------- |
| 49 | +room-id | Specify Gitter room id in which message needs to be sent |
| 50 | +token | Personal access token of a user who has permission to send messages to above mentioned Gitter room. |
| 51 | +text | Message need to be displayed (Ref, EventName, ActionUrl are automatically added to the message). |
| 52 | +message-id | Instead of creating a new message if you want to replace existing then you can provide id. After github action submitted message id can be accessed via action outputs. |
| 53 | + |
| 54 | +>**At the moment Gitter developer api does not provide option to reset personal access token** |
0 commit comments