File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ name : ' Update Copyright Year'
2+
3+ on :
4+ schedule :
5+ # Run on January 1st at 00:00 UTC every year
6+ - cron : ' 0 0 1 1 *'
7+ workflow_dispatch : # Allow manual trigger
8+
9+ jobs :
10+ update-copyright :
11+ name : Update Copyright Year to Current Year
12+ runs-on : ubuntu-latest
13+ permissions :
14+ contents : write
15+ pull-requests : write
16+ steps :
17+ - name : Checkout repository
18+ uses : actions/checkout@v4
19+
20+ - name : Get current year
21+ id : year
22+ run : echo "current_year=$(date +'%Y')" >> $GITHUB_OUTPUT
23+
24+ - name : Get previous year
25+ id : prev_year
26+ run : echo "previous_year=$(date -d 'last year' +'%Y')" >> $GITHUB_OUTPUT
27+
28+ - name : Update copyright year in all .sh files
29+ run : |
30+ find . -type f -name "*.sh" -exec sed -i 's/© - ${{ steps.prev_year.outputs.previous_year }}/© - ${{ steps.year.outputs.current_year }}/g' {} \;
31+
32+ - name : Check for changes
33+ id : verify_diff
34+ run : |
35+ git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
36+
37+ - name : Create Pull Request
38+ if : steps.verify_diff.outputs.changed == 'true'
39+ uses : peter-evans/create-pull-request@v6
40+ with :
41+ commit-message : ' Update copyright year to ${{ steps.year.outputs.current_year }}'
42+ title : ' Update copyright year to ${{ steps.year.outputs.current_year }}'
43+ body : |
44+ Automated update of copyright year from ${{ steps.prev_year.outputs.previous_year }} to ${{ steps.year.outputs.current_year }}.
45+
46+ Updated all `© - ${{ steps.prev_year.outputs.previous_year }}` to `© - ${{ steps.year.outputs.current_year }}` in .sh files.
47+ branch : ' automated/copyright-${{ steps.year.outputs.current_year }}'
48+ delete-branch : true
49+ labels : |
50+ automated
51+ maintenance
You can’t perform that action at this time.
0 commit comments