-
-
Notifications
You must be signed in to change notification settings - Fork 15
42 lines (36 loc) · 1.32 KB
/
Copy pathmerger.yml
File metadata and controls
42 lines (36 loc) · 1.32 KB
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
name: CI Contributor Merger
on:
pull_request:
types: [closed]
branches: [main]
paths:
- "contributors/*"
concurrency:
group: ${{ github.ref }}-ci-merger
cancel-in-progress: true
jobs:
merger:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.FA_TOKEN }}
if: ${{ github.event.pull_request.merged == true }}
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Post merge
run: |
file_lower=$(printf '%s' "${{ github.event.pull_request.user.login }}" | tr '[:upper:]' '[:lower:]')
if [ -f "contributors/$file_lower.json" ]; then
value=$(jq -r '.display_float_text // empty' "contributors/$file_lower.json")
if [ -z "$value" ]; then
echo '@${{ github.event.pull_request.user.login }}' > "util/names/@${{ github.event.pull_request.user.login }}"
else
echo "$value" > "util/names/ @${{ github.event.pull_request.user.login }}"
echo "display_float_text: $value"
fi
git config --global user.name "STICKnoLOGIC[automation]"
git config --global user.email "65322242+STICKnoLOGIC@users.noreply.github.com"
git add .
git commit -m "Add @${{ github.event.pull_request.user.login }} as contributor"
git push
fi