name: Auto-update IERS tables

on:
  schedule:
    - cron: '0 0 * * 0'

jobs:
  update-iers:
    name: Auto-update IERS tables
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v2
    - name: Download latest IERS files
      run: ./update_builtin_iers.sh
      working-directory: astropy/utils/iers/data
    - name: Commit changes
      run: |
        git config user.name github-actions
        git config user.email github-actions@github.com
        git add astropy/utils/iers/data/Leap_Second.dat
        git add astropy/utils/iers/data/eopc04_IAU2000.62-now
        git commit -m "Update IERS Earth rotation and leap second tables"
    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v3
      with:
        branch: update-iers
        branch-suffix: timestamp
        delete-branch: true
        labels: no-changelog-entry-needed, utils.iers
        title: Update IERS Earth rotation and leap second tables
        body: |
          This is an automated update of the IERS Earth rotation and leap second tables.

          **Note to maintainers:** please label this to be backported to all current release branches!

name: Auto-update IERS tables

on:
  schedule:
    - cron: '0 0 * * 0'
  workflow_dispatch:

    jobs:
  update-iers:
    name: Auto-update IERS tables
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v2
    - name: Download latest IERS files
      run: ./update_builtin_iers.sh
      working-directory: astropy/utils/iers/data
    - name: Commit changes
      run: |
        git config user.name github-actions
        git config user.email github-actions@github.com
        git add astropy/utils/iers/data/Leap_Second.dat
        git add astropy/utils/iers/data/eopc04_IAU2000.62-now
        git commit -m "Update IERS Earth rotation and leap second tables"
    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v3
      with:
        branch: update-iers
        branch-suffix: timestamp
        delete-branch: true
        labels: no-changelog-entry-needed, utils.iers
        title: Update IERS Earth rotation and leap second tables
        body: |
          This is an automated update of the IERS Earth rotation and leap second tables.

          **Note to maintainers:** please label this to be backported to all current release branches!

Allow IERS table update to be triggered with workflow_dispatch
Allow IERS table update to be triggered with workflow_dispatch
