Skip to content
Open
Show file tree
Hide file tree
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
19 changes: 19 additions & 0 deletions .ci/bump-license-year.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -e

PREV_YEAR=$1
CURR_YEAR=$2
DIR=$3

OLD_VALUE="// Copyright (C) 2001-$PREV_YEAR the original author or authors."
NEW_VALUE="// Copyright (C) 2001-$CURR_YEAR the original author or authors."

find "$DIR" -type f \( -name *.java -o -name *.header -o -name *.g4 \) \
-exec sed -i "s|$OLD_VALUE|$NEW_VALUE|g" {} +

BASEDIR=$(pwd)
echo "Distinct Diff in $DIR is:"
cd "$DIR"
git diff | grep -Eh "^\+" | grep -v "+++ b" | sort | uniq
cd "$BASEDIR"
37 changes: 37 additions & 0 deletions .github/workflows/bump-license-year.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#############################################################################
# GitHub Action to bump license year
#
# Workflow starts every new year.
#
#############################################################################
name: "Bump license year"
on:
schedule:
- cron: '0 12 1 1 *'
permissions:
contents: write
pull-requests: write
jobs:
bump:
name: Bump license year
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set Current Year
id: CURRENT_YEAR
run: |
echo "::set-output name=year::$(date +'%Y')"
- name: Modify Files
run: |
./.ci/bump-license-year.sh $(expr ${{ env.YEAR }} - 1) ${{ env.YEAR }} .
env:
YEAR: ${{ steps.CURRENT_YEAR.outputs.year }}
- name: Push commit
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git commit -am "minor: Bump year to ${{ env.YEAR }}"
git push