Skip to content

Commit

Permalink
Add automatic license year update
Browse files Browse the repository at this point in the history
  • Loading branch information
seriousme committed Feb 11, 2024
1 parent b4fca9a commit 2df724e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/update-license-year.sh
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions .github/workflows/update-license-year.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2df724e

Please sign in to comment.