Add safety feature to setdiscordstatus.py and discordidle.service #14
This file contains hidden or 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: Reformat code | |
| on: | |
| push: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: false | |
| jobs: | |
| format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install python3 black -y | |
| sudo npm i -g prettier | |
| black --version | |
| echo "prettier $(prettier --version)" | |
| - name: Format python using black | |
| run: black . --target-version py310 | |
| - name: Format everything else using prettier | |
| run: prettier . -w | |
| - name: Commit and push changes if any | |
| run: | | |
| #!/bin/bash | |
| shopt -s extglob | |
| if [[ `git status !(.github) --porcelain` ]]; then | |
| git add !(.github) | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git commit -m "$(echo -e "Reformat code\n\nOriginal commit: ${{ github.sha }}\nThis is an automated task.\nIf you have questions or concerns about this task,\nplease contact the repository owner.")" | |
| git push | |
| else | |
| git status | |
| fi |