Skip to content

Zeronium's Keyboard #135

Zeronium's Keyboard

Zeronium's Keyboard #135

Workflow file for this run

name: Check new request
on:
issues:
types: [opened, edited]
# Stolen from geodes indexer lol
jobs:
issue_created:
name: Check Issue
if: (!github.event.issue.pull_request && github.event.issue.state == 'open')
runs-on: ubuntu-latest
steps:
- name: Checkout Clicks Indexer
uses: actions/checkout@v4
with:
path: code
- name: Checkout Clicks Repo
uses: actions/checkout@v4
with:
repository: clicksounds/clicks
path: clicks
token: ${{ secrets.COOP_BOT_PUSH_BIN_TOKEN }}
- name: Checkout Mod Source
uses: actions/checkout@v4
with:
repository: clicksounds/geode-clicksound
path: modsource
- name: Verify User
id: verify_user
shell: bash
run: |
echo result=`python3 code/.github/verify.py modsource $ISSUE_AUTHOR` >> $GITHUB_OUTPUT
env:
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
- name: Make Test Directory
run: mkdir test
- name: Download File
continue-on-error: true
id: download_file
uses: nick-fields/retry@v3
with:
timeout_minutes: 2
shell: bash
max_attempts: 5
command: |
echo has_issues=NO >> $GITHUB_ENV
set +e
python3 code/.github/DOWNLOAD_FILE.py > result.txt 2> err.txt
RESULT=$?
set -e
echo "output is"
cat result.txt
echo "any silly errors?"
if [ -f err.txt ]; then
cat err.txt
fi
EOF=$(openssl rand -hex 8)
{
echo "issue_output<<$EOF"
cat result.txt
echo "$EOF"
} >> "$GITHUB_ENV"
{
echo "issue_err<<$EOF"
cat err.txt
echo "$EOF"
} >> "$GITHUB_ENV"
exit $RESULT
env:
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
COMMENT_AUTHOR: ${{ github.event.issue.user.login }}
ISSUE_BODY: ${{ github.event.issue.body }}
- name: Unzip Download File
continue-on-error: true
if: steps.download_file.outputs.issue_err == ''
run: |
7z x "./test/yessir.zip" -o"./test/yessir"
- name: Add Entry
if: steps.download_file.outputs.issue_err == ''
id: add_entry
shell: bash
run: |
echo has_issues=NO >> $GITHUB_OUTPUT
set +e
python3 code/.github/issue.py clicks $ISSUE_AUTHOR > result.txt 2> err.txt
RESULT=$?
set -e
echo "output is"
cat result.txt
echo "any silly errors?"
if [ -f err.txt ]; then
cat err.txt
fi
EOF=$(openssl rand -hex 8)
{
echo "issue_output<<$EOF"
cat result.txt
echo "$EOF"
} >> "$GITHUB_OUTPUT"
{
echo "issue_err<<$EOF"
cat err.txt
echo "$EOF"
} >> "$GITHUB_OUTPUT"
if [ $RESULT -eq 0 ]; then
echo push_entry=YES >> $GITHUB_OUTPUT
else
echo push_entry=NO >> $GITHUB_OUTPUT
fi
env:
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
COMMENT_AUTHOR: ${{ github.event.issue.user.login }}
ISSUE_BODY: ${{ github.event.issue.body }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
VERIFY_USER_RESULT: ${{ steps.verify_user.outputs.result }}
FOLDER_NAME: ${{ steps.download_file.outputs.folder }}
- name: Push to clicks repository
shell: bash
if: steps.add_entry.outputs.push_entry == 'YES' && steps.verify_user.outputs.result == 'YES' && steps.add_entry.outputs.has_issues == 'NO'
working-directory: ${{ github.workspace }}/clicks
run: |
git config --global user.name "$ISSUE_AUTHOR" || git config --global user.name "Click Sounds Adder"
git config --global user.email "${{ github.event.issue.user.email }}" || echo "user doesn't have an email"
git add -A
git commit -m "New click - ${{ steps.add_entry.outputs.mod_id }}"
git config --global user.email "${{ secrets.COOP_BOT_EMAIL }}"
git remote set-url origin "https://coopeeobot:${{ secrets.COOP_BOT_PUSH_BIN_TOKEN }}@github.com/clicksounds/clicks.git"
git push -u origin main
env:
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
ISSUE_AUTHOR_EMAIL: ${{ github.event.issue.user.email }}
- name: Close because invalid
if: steps.add_entry.outputs.issue_err != '' || steps.download_file.outputs.issue_err != ''
run: gh issue close ${{ github.event.issue.number }} --comment "$BODY" -R "${{ github.repository }}" --reason "not planned"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BODY: "```\n${{ steps.add_entry.outputs.issue_err }}\n```"
- name: Close because verified and valid
if: steps.verify_user.outputs.result == 'YES' && steps.add_entry.outputs.push_entry == 'YES' && steps.add_entry.outputs.has_issues == 'NO'
run: gh issue close ${{ github.event.issue.number }} --comment "$BODY" -R "${{ github.repository }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BODY: ${{ steps.add_entry.outputs.issue_output }}
- name: Comment waiting for approver
uses: peter-evans/create-or-update-comment@v4
if: (steps.verify_user.outputs.result == 'NO' || steps.add_entry.outputs.has_issues == 'YES') && steps.add_entry.outputs.push_entry == 'YES'
with:
issue-number: ${{ github.event.issue.number }}
body: |
Waiting for a person who can approve to comment "!accept" to accept the click sound request.
${{ steps.add_entry.outputs.issue_output }}