Skip to content

Commit

Permalink
Add workflow to update license
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Mar 4, 2025
1 parent 6baa54c commit 2bf100e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/update-license.yml
Original file line number Diff line number Diff line change
@@ -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 "[email protected]"
git diff --quiet LICENSE.txt || (git add LICENSE.txt && git commit -m "Update MIT License year to $CURRENT_YEAR" && git push)

0 comments on commit 2bf100e

Please sign in to comment.