Skip to content

Bump License Year

Bump License Year #4

name: Bump License Year
on:
schedule:
- cron: 0 0 1 1 *
workflow_dispatch:
jobs:
bump-license-year:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set the current year
run: |
echo "CURRENT_YEAR=$(date +'%Y')" >> $GITHUB_ENV
- name: Update license year
run: |
OLD_YEAR=$(grep -oP '\d{4}' LICENSE | tail -n 1)
echo "Old year: $OLD_YEAR"
echo "Current year: ${CURRENT_YEAR}"
if [ "$OLD_YEAR" != "${CURRENT_YEAR}" ]; then
sed -i "s/$OLD_YEAR/${CURRENT_YEAR}/g" LICENSE
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
chore: bump license year to ${{ env.CURRENT_YEAR }}
sign-commits: true
title: |
Bump license year to ${{ env.CURRENT_YEAR }}
body: |
- Bump license year to ${{ env.CURRENT_YEAR }}
branch: bump-license-year-${{ env.CURRENT_YEAR }}
base: main