name: onetime

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for branch 1 and on start directory, command.txt file changes or by manually running the workflow from actions tab
on:
  workflow_dispatch:



# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: windows-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:

      # Partial clone
      - name: Partial clone
        shell: bash
        run: |
          mkdir C:/currency-api.git
          REPO="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
          git clone $REPO C:/currency-api.git


      - name: Install Dependencies
        working-directory: C:/currency-api.git
        run: | 
          npm install
          npm install glob
          
      - name: Running the command
        working-directory: C:/currency-api.git
        run: node --max-old-space-size=6144 setdate.js

      # commiting and pushing changes
      - name: commit and push
        working-directory: C:/currency-api.git
        run: |
          git config --global pack.threads 1
          git config --global pack.windowMemory 7g
          git config --global pack.deltacachesize 7g
          git config --global pack.packSizeLimit 4095m
          git config --global core.packedGitLimit 4095m
          git config --global core.packedGitWindowSize 4095m
          git config --global user.email github-actions@github.com
          git config --global user.name github-actions
          git add -A
          git commit -m 'Update old Currencies'
          git push
