From 2bf100e948aac0bf5eec3ace8a7ba516d2a13ada Mon Sep 17 00:00:00 2001 From: Borewit Date: Tue, 4 Mar 2025 11:20:23 +0100 Subject: [PATCH] Add workflow to update license --- .github/workflows/update-license.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/update-license.yml diff --git a/.github/workflows/update-license.yml b/.github/workflows/update-license.yml new file mode 100644 index 000000000..e39dd90c2 --- /dev/null +++ b/.github/workflows/update-license.yml @@ -0,0 +1,27 @@ +name: Update License Year + +on: + schedule: + - cron: "0 0 1 1 *" # Runs on January 1st every year + workflow_dispatch: # Allows manual triggering from GitHub Actions UI + +jobs: + update-license: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Update LICENSE year + run: | + CURRENT_YEAR=$(date +"%Y") + sed -i "s/(Copyright © [0-9]\{4\})/(Copyright © $CURRENT_YEAR)/" LICENSE.txt + + - name: Commit and push changes + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions@github.com" + git diff --quiet LICENSE.txt || (git add LICENSE.txt && git commit -m "Update MIT License year to $CURRENT_YEAR" && git push) \ No newline at end of file