Skip to content

Commit 0fcf079

Browse files
committed
Parse event_file instead, internal logic
Attempt to produce the same style as n.tkte.ch for IRC notifications. Move announce logic into notify_irc.py to handle massaging of messages. Add ANSI colour to messages. The max commits (8) could be an argument. Signed-off-by: Jorgen Lundman <[email protected]>
1 parent 768ca06 commit 0fcf079

File tree

5 files changed

+308
-39
lines changed

5 files changed

+308
-39
lines changed

README.md

+42-31
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,54 @@
33
### Usage
44

55
See [action.yml](./action.yml) For comprehensive list of options.
6-
6+
7+
This is a fork of https://github.com/rectalogic/notify-irc
8+
but I had issues getting it to send multiline messages.
9+
This has been tweaked to issue IRC notifications mimicking
10+
the style of `n.tkte.ch`'s Notifico.
11+
12+
Jorgen Lundman <[email protected]>
13+
714
Example, send notifications to Libera Chat IRC channel:
815

916
```yaml
10-
name: "Push Notification"
11-
on: [push, pull_request, create]
17+
18+
name: Notify IRC
19+
20+
on:
21+
push:
22+
issues:
23+
types:
24+
- opened
25+
- edited
26+
- closed
27+
issue_comment:
28+
pull_request:
29+
discussion:
30+
types:
31+
- created
32+
- edited
33+
- closed
34+
- answered
35+
discussion_comment:
36+
create:
37+
delete:
1238

1339
jobs:
14-
test:
40+
notify-irc:
1541
runs-on: ubuntu-latest
42+
1643
steps:
17-
- name: irc push
18-
uses: rectalogic/notify-irc@v1
19-
if: github.event_name == 'push'
44+
- name: Notify IRC
45+
uses: openzfsonwindows/notify-irc@v1
2046
with:
21-
channel: "#mychannel"
22-
server: "irc.libera.chat"
23-
nickname: my-github-notifier
24-
message: |
25-
${{ github.actor }} pushed ${{ github.event.ref }} ${{ github.event.compare }}
26-
${{ join(github.event.commits.*.message) }}
27-
- name: irc pull request
28-
uses: rectalogic/notify-irc@v1
29-
if: github.event_name == 'pull_request'
30-
with:
31-
channel: "#mychannel"
32-
server: "irc.libera.chat"
33-
nickname: my-github-notifier
34-
message: |
35-
${{ github.actor }} opened PR ${{ github.event.pull_request.html_url }}
36-
- name: irc tag created
37-
uses: rectalogic/notify-irc@v1
38-
if: github.event_name == 'create' && github.event.ref_type == 'tag'
39-
with:
40-
channel: "#mychannel"
41-
server: "irc.libera.chat"
42-
nickname: my-github-notifier
43-
message: |
44-
${{ github.actor }} tagged ${{ github.repository }} ${{ github.event.ref }}
47+
channel: "#yourchannel"
48+
server: "irc.server.net"
49+
nickname: "irc-bot-name"
50+
ansicolor: "true"
51+
eventpath: ${{ github.event_path }}
52+
4553
```
54+
55+
![Screenshot](irc-notify.png)
56+

action.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Notify IRC'
1+
name: 'Notify IRC Notifico'
22
description: 'Send a notification message to an IRC channel'
33
author: 'Andrew Wason'
44
inputs:
@@ -25,8 +25,8 @@ inputs:
2525
sasl_password:
2626
description: 'IRC user SASL password'
2727
required: false
28-
message:
29-
description: 'Message to send'
28+
eventpath:
29+
description: 'path to EVENT_FILE'
3030
required: true
3131
notice:
3232
description: 'Use NOTICE instead of PRIVMSG'
@@ -40,6 +40,10 @@ inputs:
4040
description: 'Enable verbose logging'
4141
default: false
4242
required: false
43+
ansicolor:
44+
description: 'Enable ansi color text'
45+
default: false
46+
required: false
4347
runs:
4448
using: 'docker'
4549
image: 'Dockerfile'

entrypoint.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ if [ "$INPUT_VERBOSE" == "true" ]; then
1919
else
2020
ARG_VERBOSE=""
2121
fi
22+
if [ "$INPUT_ANSICOLOR" == "true" ]; then
23+
ARG_ANSICOLOR="--ansicolor"
24+
else
25+
ARG_ANSICOLOR=""
26+
fi
2227

2328
exec /notify_irc.py \
2429
--server "$INPUT_SERVER" \
@@ -28,5 +33,5 @@ exec /notify_irc.py \
2833
--sasl-password "$INPUT_SASL_PASSWORD" \
2934
--channel "$INPUT_CHANNEL" \
3035
--channel-key "$INPUT_CHANNEL_KEY" \
31-
--message "$INPUT_MESSAGE" \
32-
$ARG_TLS $ARG_NOTICE $ARG_VERBOSE
36+
--eventpath "$INPUT_EVENTPATH" \
37+
$ARG_TLS $ARG_NOTICE $ARG_VERBOSE $ARG_ANSICOLOR

irc-notify.png

271 KB
Loading

0 commit comments

Comments
 (0)