name: update i18n repo

on:
  push:
    branches:
    - main
  pull_request:
    branches:
    - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Write content to en_us.json
        run: |
            git clone https://github.com/IceWhaleTech/CasaOS-i18n.git
            chmod +x ./help/action.sh
            ./help/action.sh
      
      - name: Pushes to i18n repository
        uses: cpina/github-action-push-to-another-repository@main
        env:
          API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
        with:
          source-directory: './CasaOS-i18n'
          destination-github-username: 'IceWhaleTech'
          destination-repository-name: 'CasaOS-i18n'
          user-email: a624669980@163.com
          target-branch: main
