-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (38 loc) · 1.18 KB
/
bump-license-year.yml
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
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Bump License Year
on:
schedule:
- cron: 0 0 1 1 *
workflow_dispatch:
jobs:
bump-license-year:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set the current year
run: |
echo "CURRENT_YEAR=$(date +'%Y')" >> $GITHUB_ENV
- name: Update license year
run: |
OLD_YEAR=$(grep -oP '\d{4}' LICENSE | tail -n 1)
echo "Old year: $OLD_YEAR"
echo "Current year: ${CURRENT_YEAR}"
if [ "$OLD_YEAR" != "${CURRENT_YEAR}" ]; then
sed -i "s/$OLD_YEAR/${CURRENT_YEAR}/g" LICENSE
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
chore: bump license year to ${{ env.CURRENT_YEAR }}
sign-commits: true
title: |
Bump license year to ${{ env.CURRENT_YEAR }}
body: |
- Bump license year to ${{ env.CURRENT_YEAR }}
branch: bump-license-year-${{ env.CURRENT_YEAR }}
base: main