diff --git a/.github/workflows/update-license-year.sh b/.github/workflows/update-license-year.sh new file mode 100644 index 0000000..ac20777 --- /dev/null +++ b/.github/workflows/update-license-year.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +license='LICENSE.txt' +prefix='2016-' +current_year=$(date +%Y) +sed -i -e "s/$prefix\([0-9\]\+\)/$prefix$current_year/" $license + +if [ "$(git diff $license)" ]; then + git add $license + git commit -m "Update license year to $current_year" + git push +else + echo "No changes detected in $license" +fi \ No newline at end of file diff --git a/.github/workflows/update-license-year.yml b/.github/workflows/update-license-year.yml new file mode 100644 index 0000000..a7373d7 --- /dev/null +++ b/.github/workflows/update-license-year.yml @@ -0,0 +1,13 @@ +name: Update License Year + +on: + schedule: + - cron: '5 12 1 1 *' + +jobs: + update_license: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Update license year + run: ./update_license.sh \ No newline at end of file