Skip to content

Commit

Permalink
Issue checkstyle#11194: Automate bumping license year
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyom-Yadav committed Jan 15, 2022
1 parent a6d4f0d commit b0fe26c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .ci/bump-license-year.sh
Expand Up @@ -2,9 +2,9 @@

set -e

PREV_YEAR=$1
CURR_YEAR=$2
DIR=$3
CURR_YEAR=$(date +"%Y")
PREV_YEAR=$(expr $CURR_YEAR - 1)
DIR=$PWD

OLD_VALUE="// Copyright (C) 2001-$PREV_YEAR the original author or authors."
NEW_VALUE="// Copyright (C) 2001-$CURR_YEAR the original author or authors."
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/bump_license_year.yml
@@ -0,0 +1,41 @@
#############################################################################
# Github Action to bump license year
#
# Workflow starts every new year.
#
#############################################################################
name: "Bump license year"
on:
push:
schedule:
- cron: "0 0 1 1 *"
# So we can manually trigger if required
workflow_dispatch:
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: Modify File
run: |
./.ci/bump-license-year.sh
- name: Set Current Year
id: CURRENT_YEAR
run: |
echo "::set-output name=year::$(date +'%Y')"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
env:
YEAR: ${{ steps.CURRENT_YEAR.outputs.year }}
with:
commit-message: "minor: Bump year to ${{ env.YEAR }}"
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: bump-year
delete-branch: true
body: "minor: Bump year to ${{ env.YEAR }}"
title: "minor: Bump year to ${{ env.YEAR }}"

0 comments on commit b0fe26c

Please sign in to comment.