forked from Mudlet/Mudlet
-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (66 loc) · 2.33 KB
/
generate-coder-attribution.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
68
69
70
71
72
73
74
75
76
77
78
79
name: Generate coder attribution
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
inputs:
from:
description: 'Generate from this release/commit (defaults to the latest release)'
required: false
# default is calculated dynamically
to:
description: 'Generate until this release/commit (defaults to latest development)'
required: false
default: 'HEAD'
jobs:
generate-attribution:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'Mudlet' }}
steps:
- name: Checkout Mudlet repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Lua 5.1.5
uses: leafo/gh-actions-lua@v10
with:
luaVersion: "5.1.5"
- name: Install Luarocks
uses: leafo/gh-actions-luarocks@v4
- name: Install Lua dependencies
run: |
luarocks install argparse
luarocks install lunajson
- name: Calculate from and to releases
run: |
if [[ -z "${{ github.event.inputs.from }}" ]] ; then
FROM_RELEASE=$(git tag --sort=committerdate | tail -1)
else
FROM_RELEASE=${{ github.event.inputs.from }}
fi
if [[ -z "${{ github.event.inputs.to }}" ]] ; then
TO_RELEASE="HEAD"
else
TO_RELEASE=${{ github.event.inputs.to }}
fi
echo "Generating attributions from $FROM_RELEASE until $TO_RELEASE"
echo "FROM_RELEASE=$FROM_RELEASE" >> $GITHUB_ENV
echo "TO_RELEASE=$TO_RELEASE" >> $GITHUB_ENV
- name: Generate attributions
run: |
# get list of authors
authors=$(git log $FROM_RELEASE..$TO_RELEASE --format="%aN" --reverse | sort -u)
# trim known bots
authors=$(echo "$authors" | grep -v "bot" | grep -v "mudlet-machine-account" | grep -v "ImgBotApp" \
| grep -v "mudlet-machine-account" | grep -v "root")
# beautify list
authors=$(echo "$authors" | tr '\n' ',' | sed 's/,$//' | sed 's/,/, /g')
authors=$(echo "$authors" | sed 's/\(.*\), \(.*\)/\1, and \2/')
echo "$authors" > authors.txt
echo "[INFO] Authors from $FROM_RELEASE to $TO_RELEASE are:"
echo $authors
- name: Upload authors as txt
uses: actions/upload-artifact@v4
with:
name: authors.txt
path: authors.txt