forked from darktable-org/darktable
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (65 loc) · 2.32 KB
/
irc.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: IRC Notification
on:
schedule:
- cron: "*/10 * * * *"
workflow_dispatch:
jobs:
dtslave:
if: github.repository == 'darktable-org/darktable'
runs-on: ubuntu-latest
concurrency: irc_bot
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 200
path: src
- uses: dawidd6/action-download-artifact@v2
continue-on-error: true
with:
workflow: irc.yml
name: recent_commit
- name: git log
id: gitlog
run: |
cd src;
if [ ! -f ../recent_commit ]; then
git log --format="%H" -n 1 --skip 10 > ../recent_commit
fi;
git log --format="%H" -n 1 > ../current_commit
if cmp -s ../recent_commit ../current_commit; then
echo "no new commits since last run"
echo "::set-output name=log::"
else
git log --reverse --first-parent --pretty=format:"%h: %s (%aN)" `cat ../recent_commit`..`cat ../current_commit` | perl -pe 'if(/pull request #(\d+)/){$title=`curl -s https://api.github.com/repos/darktable-org/darktable/pulls/$1|jq -r .title`;chomp $title;s/pull request/"$title"/}' >> ../log
echo "current log:"
cat ../log
echo "";
echo "setting output..."
output="$(cat ../log)"
output="${output//'%'/'%25'}"
output="${output//$'\n'/'%0A'}"
output="${output//$'\r'/'%0D'}"
echo "::set-output name=log::$output"
echo ""
echo "" >> ../log
echo "::set-output name=llc::$(wc -l < ../log)"
fi;
cd ..
mv -f current_commit recent_commit
- name: IRC notification
if: ${{ steps.gitlog.outputs.log != '' }}
uses: Gottox/irc-message-action@v2
with:
server: "irc.oftc.net"
channel: '#darktable'
nickname: dtslav
response_allow_from: andabata, AurlienPierre[m], elstoc, johnny_bit, parafin
response_timeout: 5
message: |-
Showing last ${{ steps.gitlog.outputs.llc }} commit(s) to ${{ github.repository }}:
${{ steps.gitlog.outputs.log }}
- uses: actions/upload-artifact@v3
with:
name: recent_commit
path: recent_commit
if-no-files-found: warn