Skip to content

Commit 52581d3

Browse files
committed
CI: Keep MIT license up to date
1 parent f3bcdb8 commit 52581d3

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Update License Year
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 1 1 *" # Runs on January 1st every year
6+
workflow_dispatch: # Allows manual triggering
7+
8+
jobs:
9+
update-license:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
with:
16+
token: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- name: Update LICENSE year
19+
run: |
20+
CURRENT_YEAR=$(date +"%Y")
21+
sed -E -i "s/(Copyright © )[0-9]{4}/\1$CURRENT_YEAR/" LICENSE.txt
22+
23+
- name: Commit and push changes
24+
run: |
25+
CURRENT_YEAR=$(date +"%Y")
26+
git config --global user.name "Borewit"
27+
git config --global user.email "[email protected]"
28+
git diff --quiet LICENSE.txt || (git add LICENSE.txt && git commit -m "Update license year to $CURRENT_YEAR" && git push)

LICENSE renamed to LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Borewit
3+
Copyright © 2024 Borewit
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Since Node.js 22.12, `require` can load **some** ESM modules, but there are [doc
125125

126126
## License
127127

128-
[MIT](./LICENSE)
128+
[MIT](./LICENSE.txt)
129129

130130
---
131131

0 commit comments

Comments
 (0)