name: Update copyright year(s) in license file

on:
  schedule:
    - cron: "0 3 1 1 *"

jobs:
  update-license-year:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - uses: FantasticFiasco/action-update-license-year@v2
        with:
          path: LICENSE.md
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Merge pull request
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh pr merge --merge --delete-branch
