Append data to list #192
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |