Skip to content
37 changes: 37 additions & 0 deletions license_copyright/license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 'Update copyright license'
description: Update license years automatically
author: "TheAlgorithms"
inputs:
filename:
description: License file name
required: true
default: LICENSE
initial_year:
description: Year of the repository's creation
required: true
default: 2016
runs:
using: composite
steps:
- name: Update the License
run: |
(echo "Copyright (C) ${{ inputs.initial_year }}-$(date +"%Y") TheAlgorithms and contributors"; tail -n +2 ${{ inputs.filename }}) > License.tmp
mv License.tmp ${{ inputs.filename }}
- name: Setup Git configurations
shell: bash
run: |
git config --global user.name github-actions[bot]
git config --global user.email 'github-actions@users.noreply.github.com'
- name: Commit to a new branch and push changes
shell: bash
run: |
git checkout -b license-update-${{ github.sha }}
git commit -m "docs: updating copyright license year"
git push
- name: Creating and merging the PR
shell: bash
run: |
if [[ `git status --porcelain` ]]; then
gh pr create --base master --head license-update-${{ github.sha }} --title 'docs: updating `License` copyright' --body 'Updated License copyright (see the diff. for changes).'
env:
GH_TOKEN: ${{ github.token }}