-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (28 loc) · 923 Bytes
/
Copy pathupdate-license-year.yml
File metadata and controls
34 lines (28 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Update License Year
on:
schedule:
- cron: '0 0 1 1 *'
workflow_dispatch:
jobs:
update-license:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout your repository using git
uses: actions/checkout@v6
- name: Update year in LICENSE
run: |
CURRENT_YEAR=$(date +'%Y')
sed -i -E "s/Copyright \(c\) [0-9]{4}/Copyright (c) $CURRENT_YEAR/g" LICENSE
- name: Commit and push changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if [[ -n "$(git status --porcelain)" ]]; then
git add LICENSE
git commit -m "Update license year to $(date +'%Y')"
git push
else
echo "No changes needed; LICENSE is already up to date."
fi