Skip to content

Commit 2236a8f

Browse files
Update license_copyright/license.yml
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
1 parent c152ab3 commit 2236a8f

File tree

1 file changed

+33
-25
lines changed

1 file changed

+33
-25
lines changed

license_copyright/license.yml

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
name: 'Update copyright license'
2-
on:
3-
schedule:
4-
- cron: '0 0 1 1 *'
5-
jobs:
6-
stale:
7-
runs-on: ubuntu-latest
8-
steps:
9-
- name: Update the License
10-
run: |
11-
(echo "Copyright (C) 2016-$(date +"%Y") TheAlgorithms and contributors"; tail -n +2 LICENSE) > License.tmp
12-
mv License.tmp LICENSE
13-
- name: Commit and push changes
14-
uses: stefanzweifel/git-auto-commit-action@v4
15-
id: commit-push
16-
with:
17-
commit_message: "docs: updating `License` copyright"
18-
branch: "license-${{ github.sha }}"
19-
create_branch: true
20-
- name: Creating and merging the PR
21-
shell: bash
22-
if: steps.commit-push.outputs.changes_detected == 'true'
23-
run: |
24-
gh pr create --base ${GITHUB_REF##*/} --head license-${{ github.sha }} --title 'docs: updating `License` copyright' --body 'Updated License copyright (see the diff. for changes).'
25-
env:
26-
GH_TOKEN: ${{ github.token }}
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+
runs:
10+
using: composite
11+
steps:
12+
- name: Update the License
13+
run: |
14+
(echo "Copyright (C) 2016-$(date +"%Y") TheAlgorithms and contributors"; tail -n +2 ${{ inputs.filename }}) > License.tmp
15+
mv License.tmp ${{ inputs.filename }}
16+
- name: Setup Git configurations
17+
shell: bash
18+
run: |
19+
git config --global user.name github-actions[bot]
20+
git config --global user.email 'github-actions@users.noreply.github.com'
21+
- name: Commit to a new branch and push changes
22+
shell: bash
23+
run: |
24+
git checkout -b license-update-${{ github.sha }}
25+
git commit -m "docs: updating Copyright license year"
26+
git push
27+
- name: Creating and merging the PR
28+
shell: bash
29+
if: steps.commit-push.outputs.changes_detected == 'true'
30+
run: |
31+
gh pr create --base master --head license-update-${{ github.sha }} --title 'docs: updating `License` copyright' --body 'Updated License copyright (see the diff. for changes).'
32+
env:
33+
GH_TOKEN: ${{ github.token }}
34+

0 commit comments

Comments
 (0)