Add randomtext.sh #77
  
    
      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 # Prettier version and plugins should be specified in package.json | |
| - name: Format python using black | |
| run: black . --target-version py310 | |
| - name: Run prettier | |
| run: | | |
| python3 http/php/.preformat.py | |
| npm run prettier -- . -w | |
| python3 http/php/.postformat.py | |
| npm run prettier -- . -w | |
| - name: Commit and push changes if any | |
| run: | | |
| #!/bin/bash | |
| shopt -s extglob | |
| if [[ `git status !(.github) --porcelain` ]]; then | |
| git add . | |
| git restore --staged .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 |