10000 Create copyright license script (#22) · TheAlgorithms/scripts@d10fd51 · GitHub
[go: up one dir, main page]

Skip to content

Commit d10fd51

Browse files
alexpantyukhintjgurwara99Panquesito7
authored
Create copyright license script (#22)
* Update copyright license * Update license_copyright/license.yml Co-authored-by: Taj <tjgurwara99@users.noreply.github.com> * Update license_copyright/license.yml Co-authored-by: Taj <tjgurwara99@users.noreply.github.com> * Update license_copyright/license.yml Co-authored-by: David Leal <halfpacho@gmail.com> * Update license_copyright/license.yml Co-authored-by: David Leal <halfpacho@gmail.com> * chore: apply suggestions from code review * Update license_copyright/license.yml Co-authored-by: David Leal <halfpacho@gmail.com> * Update license_copyright/license.yml Co-authored-by: David Leal <halfpacho@gmail.com> * chore: apply suggestions from code review --------- Co-authored-by: Taj <tjgurwara99@users.noreply.github.com> Co-authored-by: David Leal <halfpacho@gmail.com>
1 parent 6b29901 commit d10fd51

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

license_copyright/license.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 'Update copyright license'
2+
description: Update license years automatically
3+
author: "TheAlgorithms"
4+
inputs:
5+
filename:
6+
description: License file name
7+
required: true
8+
default: LICENSE
9+
initial_year:
10+
description: Year of the repository's creation
11+
required: true
12+
default: 2016
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Update the License
17+
run: |
18+
(echo "Copyright (C) ${{ inputs.initial_year }}-$(date +"%Y") TheAlgorithms and contributors"; tail -n +2 ${{ inputs.filename }}) > License.tmp
19+
mv License.tmp ${{ inputs.filename }}
20+
- name: Setup Git configurations
21+
shell: bash
22+
run: |
23+
git config --global user.name github-actions[bot]
24+
git config --global user.email 'github-actions@users.noreply.github.com'
25+
- name: Commit to a new branch and push changes
26+
shell: bash
27+
run: |
28+
git checkout -b license-update-${{ github.sha }}
29+
git commit -m "docs: updating copyright license year"
30+
git push
31+
- name: Creating and merging the PR
32+
shell: bash
33+
run: |
34+
if [[ `git status --porcelain` ]]; then
35+
gh pr create --base master --head license-update-${{ github.sha }} --title 'docs: updating `License` copyright' --body 'Updated License copyright (see the diff. for changes).'
36+
env:
37+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)
0