-
-
Notifications
You must be signed in to change notification settings - Fork 26
56 lines (50 loc) · 1.6 KB
/
append-lists-txt.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
name: Append data to list
concurrency: listappend-${{ github.ref }}
on:
workflow_dispatch:
inputs:
file:
description: "The file in the Lists directory to append to"
required: true
default: "scams.txt"
text:
description: "The text to append to the end of the list"
required: true
user:
description: "The Discord user to credit for the addition"
required: true
jobs:
fileappend:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Check file exists
run: |
if [ ! -f Lists/${{ github.event.inputs.file }} ]; then
echo "File not found!"
exit 1
fi
- name: Append to file
uses: Erisa/write-file-action@master
with:
path: Lists/${{ github.event.inputs.file }}
contents: |
${{ github.event.inputs.text }}
write-mode: append-newline
- name: Setup git config
run: |
git config user.name "GitHub Actions via Discord user ${{ github.event.inputs.user }}"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Commit and push
run: |
git add .
git commit -m "${{ github.event.inputs.user }}: Update ${{ github.event.inputs.file }}"
git push
- name: Trigger rebuild
run: |
if [[ "${GITHUB_REF##*/}" == "main" ]]; then
gh workflow run docker-push.yml --ref main
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}