Commit 52307ce 1 parent 953ffae commit 52307ce Copy full SHA for 52307ce
File tree 1 file changed +16
-3
lines changed
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -10,21 +10,34 @@ jobs:
10
10
runs-on : ubuntu-latest
11
11
permissions :
12
12
contents : write
13
+ pull-requests : write
13
14
steps :
14
15
- uses : actions/checkout@v2
15
16
with :
16
17
fetch-depth : 0
17
18
18
19
- name : Update year in LICENSE
19
20
run : |
20
- # 获取当前年份
21
21
CURRENT_YEAR=$(date +%Y)
22
- # 更新 LICENSE 文件中的年份
23
- sed -i "s/Copyright (c) [0-9]\{4\}/Copyright (c) ${CURRENT_YEAR}/" LICENSE
22
+ echo "CURRENT_YEAR=$CURRENT_YEAR" >> $GITHUB_ENV
23
+ if [ -f LICENSE ]; then
24
+ sed -i "s/Copyright (c) [0-9]\{4\}/Copyright (c) ${CURRENT_YEAR}/" LICENSE
25
+ fi
26
+
27
+ - name : Check for changes
28
+ id : changes
29
+ run : |
30
+ if git diff --quiet; then
31
+ echo "changed=false" >> $GITHUB_OUTPUT
32
+ else
33
+ echo "changed=true" >> $GITHUB_OUTPUT
34
+ fi
24
35
25
36
- name : Create Pull Request
37
+ if : steps.changes.outputs.changed == 'true'
26
38
uses : peter-evans/create-pull-request@v5
27
39
with :
40
+ token : ${{ secrets.GITHUB_TOKEN }}
28
41
commit-message : " chore: update license year to ${{ env.CURRENT_YEAR }}"
29
42
title : " chore: update license year"
30
43
body : |
You can’t perform that action at this time.
0 commit comments