name: Minify Code

on:
  push:
    paths:
      - 'data/*.js'
      - 'data/*.css'

jobs:
  minify:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        token: ${{ secrets.BOT_ACCESS_TOKEN }}
    - uses: actions/setup-node@v3
      with:
        node-version: '16'

    - name: Install NodeJS modules
      run: cd data/minify && npm install
      
    - name: Minify code
      run: cd data/minify && npm run build
      
    - uses: EndBug/add-and-commit@v9
      with:
        default_author: github_actions
