Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update copyright #8701

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/copyright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: ci/gh-actions/copyright
on:
schedule:
- cron: '0 0 1 1 *'
jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Make changes to pull request
continue-on-error: true
shell: bash
run: |
year=$(date +%Y)
echo "YEAR=$(echo $year)" >> $GITHUB_ENV
find . -print0 | while IFS= read -r -d '' file
do
if [[ -d $file ]] || [[ $file == *".git"* ]]; then
continue
fi
line=$(grep .*Copyright.*Monero.* $file || true)
if [[ -z $line ]]; then
continue
fi
fromTo=$(grep -o "[0-9]\{4\}-[0-9]\{4\}" <<< $line || true)
if [[ ! -z $fromTo ]]; then
# string contains "FROM-TO"
# we need to replace FROM with current year
to=$(awk '{split($0, array, "-"); print array[2]}' <<< ${fromTo})
repl=${line/"$to"/"$year"}
else
# we only have a FROM year
# find occurance of 4 digits
from=$(grep -o "[0-9]\{4\}" <<< $line || true)
fromTo="${from}-${year}"
# replace FROM with FROM-TO
repl=${line/"$from"/"$fromTo"}
fi
sed -i "s|${line}|${repl}|g" $file
done
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Copyright: Update to ${{ env.YEAR }}"
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: bump-copyright-year
delete-branch: true
title: "Copyright: Update to ${{ env.YEAR }}"
body: |
Happy new year!
draft: false