-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b2c3dc
commit 2ec9833
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Update License Year | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 1 1 *' # 每年 1 月 1 日运行 | ||
workflow_dispatch: # 允许手动触发 | ||
|
||
jobs: | ||
update-license-year: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Update license year | ||
run: | | ||
CURRENT_YEAR=$(date +%Y) | ||
# 使用 sed 更新年份 | ||
sed -i "s/Copyright (c) [0-9]* Chan Meng/Copyright (c) ${CURRENT_YEAR} Chan Meng/" LICENSE | ||
- name: Check for changes | ||
id: check_changes | ||
run: | | ||
git diff --quiet LICENSE || echo "changes=true" >> $GITHUB_OUTPUT | ||
- name: Create Pull Request | ||
if: steps.check_changes.outputs.changes == 'true' | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
commit-message: "chore: update license year to ${{ steps.get_year.outputs.year }}" | ||
title: "chore: update license year" | ||
body: "Automatically update license year to ${{ steps.get_year.outputs.year }}" | ||
branch: "chore/update-license-year" | ||
delete-branch: true |