Skip to content

Commit 953ffae

Browse files
authored
Create update-license-year.yml
1 parent 732ce54 commit 953ffae

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Update License Year
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 1 1 *' # 每年1月1日运行
6+
workflow_dispatch: # 允许手动触发
7+
8+
jobs:
9+
update-license-year:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Update year in LICENSE
19+
run: |
20+
# 获取当前年份
21+
CURRENT_YEAR=$(date +%Y)
22+
# 更新 LICENSE 文件中的年份
23+
sed -i "s/Copyright (c) [0-9]\{4\}/Copyright (c) ${CURRENT_YEAR}/" LICENSE
24+
25+
- name: Create Pull Request
26+
uses: peter-evans/create-pull-request@v5
27+
with:
28+
commit-message: "chore: update license year to ${{ env.CURRENT_YEAR }}"
29+
title: "chore: update license year"
30+
body: |
31+
Automated changes:
32+
- Updated copyright year in LICENSE file to current year
33+
branch: update-license-year
34+
base: main
35+
delete-branch: true

0 commit comments

Comments
 (0)