name: Update locales

on:
  workflow_dispatch:
  push:
    branches:
      - main
    paths:
      - app/src/main/res/values-*/strings.xml
      - app/src/main/res/values/settings.xml

permissions:
  contents: write
  pull-requests: write

jobs:
  update-locales:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v7.0.1
    - name: Add new locales
      run: .scripts/new-locales.py
    - name: Update locales
      run: .scripts/locales.py
    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v8.1.1
      with:
        title: "Update locales"
        commit-message: "Update locales"
        branch-suffix: timestamp
