name: Star

on:

  push:
    branches:
      - main
      
  schedule:
  - cron: "* * * * *"

jobs:
  auto_commit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
         persist-credentials: false
         fetch-depth: 0

      - name: Modify last update
        run: |
          d='DATE '`date '+%Y-%m-%d %H:%M:%S'`
          echo $d > LOG
          
      - name: Commit changes
        run: | 
          git config --local user.email "ischhfd83@rambler.ru"
          git config --local user.name "${{ github.repository_owner }}"
          git add -A
          
          arr[0]="LOG"
          arr[1]="LOG"
          arr[2]="LOG"
          arr[3]="LOG"
          arr[4]="LOG"
          arr[5]="LOG"
          arr[6]="LOG"
          arr[7]="LOG"
          arr[8]="LOG"
          arr[9]="LOG"
          
          rand=$[$RANDOM % ${#arr[@]}]
          
          git commit -m "${arr[$rand]}"
          
      - name: GitHub Push
        uses: ad-m/github-push-action@master
        with:
          force: true
          directory: "."
          github_token: ${{ secrets.GITHUB_TOKEN }}