diff --git a/license_copyright/license.yml b/license_copyright/license.yml new file mode 100644 index 0000000..9777188 --- /dev/null +++ b/license_copyright/license.yml @@ -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 }}