Skip to content

Commit b041569

Browse files
committed
Add GitHub Actions workflow to update copyright dates
1 parent 03868d2 commit b041569

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Update copyright dates
2+
3+
on:
4+
schedule:
5+
# Run every first day of the year at 09:00 AM UTC
6+
- cron: '0 9 1 1 *'
7+
workflow_dispatch:
8+
# Allow manual triggering
9+
push:
10+
branches:
11+
- "*"
12+
13+
jobs:
14+
check-links:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.x'
28+
29+
- name: Install bdip-tools
30+
run: pip install --extra-index-url https://maven.sing-group.org/repository/python-snapshots/simple/ bdip-tools
31+
32+
- name: Create new branch
33+
run: git switch -c update-copyright-dates
34+
35+
- name: Update copyright dates
36+
id: update-dates
37+
run: |
38+
set +e
39+
bdip update-copyright-dates --git .
40+
EXIT_CODE=$?
41+
set -e
42+
43+
if [ $EXIT_CODE -eq 0 ]; then
44+
echo "Changes were made and committed to branch"
45+
echo "has_changes=true" >> $GITHUB_OUTPUT
46+
else
47+
echo "No copyright updates needed"
48+
echo "has_changes=false" >> $GITHUB_OUTPUT
49+
fi
50+
51+
- name: Create Pull Request
52+
if: steps.update-dates.outputs.has_changes == 'true'
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
run: |
56+
YEAR=$(date +%Y)
57+
gh pr create \
58+
--title "Update copyright dates to $YEAR" \
59+
--base master \
60+
--head update-copyright-dates \
61+
--label "maintenance"

0 commit comments

Comments
 (0)