From b6d9bb31d55606b3fb174e64ef0be6008c0faba2 Mon Sep 17 00:00:00 2001 From: alexpantyukhin Date: Thu, 6 Apr 2023 14:25:26 +0400 Subject: [PATCH 1/9] Update copyright license --- license_copyright/license.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 license_copyright/license.yml diff --git a/license_copyright/license.yml b/license_copyright/license.yml new file mode 100644 index 0000000..d3ac968 --- /dev/null +++ b/license_copyright/license.yml @@ -0,0 +1,26 @@ +name: 'Update copyright license' +on: + schedule: + - cron: '0 0 1 1 *' +jobs: + stale: + runs-on: ubuntu-latest + steps: + - name: Update the License + run: | + (echo "Copyright (C) 2016-$(date +"%Y") TheAlgorithms and contributors"; tail -n +2 License) > License.tmp + mv License.tmp License + - name: Commit and push changes + uses: stefanzweifel/git-auto-commit-action@v4 + id: commit-push + with: + commit_message: "docs: updating `License` copyright" + branch: "license-${{ github.sha }}" + create_branch: true + - name: Creating and merging the PR + shell: bash + if: steps.commit-push.outputs.changes_detected == 'true' + run: | + gh pr create --base ${GITHUB_REF##*/} --head license-${{ github.sha }} --title 'docs: updating `License` copyright' --body 'Updated License copyright (see the diff. for changes).' + env: + GH_TOKEN: ${{ github.token }} From c152ab3d7e16f3a640cf41a5a12bc5e93c605daf Mon Sep 17 00:00:00 2001 From: Alexander Pantyukhin Date: Fri, 14 Apr 2023 21:59:01 +0400 Subject: [PATCH 2/9] Update license_copyright/license.yml Co-authored-by: Taj --- license_copyright/license.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/license_copyright/license.yml b/license_copyright/license.yml index d3ac968..6a12717 100644 --- a/license_copyright/license.yml +++ b/license_copyright/license.yml @@ -8,8 +8,8 @@ jobs: steps: - name: Update the License run: | - (echo "Copyright (C) 2016-$(date +"%Y") TheAlgorithms and contributors"; tail -n +2 License) > License.tmp - mv License.tmp License + (echo "Copyright (C) 2016-$(date +"%Y") TheAlgorithms and contributors"; tail -n +2 LICENSE) > License.tmp + mv License.tmp LICENSE - name: Commit and push changes uses: stefanzweifel/git-auto-commit-action@v4 id: commit-push From 2236a8f26b5e722428dc52f7d82b6754ff8bf05e Mon Sep 17 00:00:00 2001 From: Alexander Pantyukhin Date: Mon, 17 Apr 2023 09:57:01 +0400 Subject: [PATCH 3/9] Update license_copyright/license.yml Co-authored-by: Taj --- license_copyright/license.yml | 58 ++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/license_copyright/license.yml b/license_copyright/license.yml index 6a12717..2981865 100644 --- a/license_copyright/license.yml +++ b/license_copyright/license.yml @@ -1,26 +1,34 @@ name: 'Update copyright license' -on: - schedule: - - cron: '0 0 1 1 *' -jobs: - stale: - runs-on: ubuntu-latest - steps: - - name: Update the License - run: | - (echo "Copyright (C) 2016-$(date +"%Y") TheAlgorithms and contributors"; tail -n +2 LICENSE) > License.tmp - mv License.tmp LICENSE - - name: Commit and push changes - uses: stefanzweifel/git-auto-commit-action@v4 - id: commit-push - with: - commit_message: "docs: updating `License` copyright" - branch: "license-${{ github.sha }}" - create_branch: true - - name: Creating and merging the PR - shell: bash - if: steps.commit-push.outputs.changes_detected == 'true' - run: | - gh pr create --base ${GITHUB_REF##*/} --head license-${{ github.sha }} --title 'docs: updating `License` copyright' --body 'Updated License copyright (see the diff. for changes).' - env: - GH_TOKEN: ${{ github.token }} +description: Update license years automatically +author: "TheAlgorithms" +inputs: + filename: + description: License file name + required: true + default: LICENSE +runs: + using: composite + steps: + - name: Update the License + run: | + (echo "Copyright (C) 2016-$(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 + if: steps.commit-push.outputs.changes_detected == 'true' + run: | + 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 }} + From 6df065555defb44c635cfd1cf0db7a3de8a10405 Mon Sep 17 00:00:00 2001 From: Alexander Pantyukhin Date: Mon, 12 Jun 2023 10:22:47 +0400 Subject: [PATCH 4/9] Update license_copyright/license.yml Co-authored-by: David Leal --- license_copyright/license.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/license_copyright/license.yml b/license_copyright/license.yml index 2981865..502b1a4 100644 --- a/license_copyright/license.yml +++ b/license_copyright/license.yml @@ -26,7 +26,7 @@ runs: git push - name: Creating and merging the PR shell: bash - if: steps.commit-push.outputs.changes_detected == 'true' + if [[ `git status --porcelain` ]]; then run: | 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: From eb8efba3a09c51084738d32431d5c45feecac874 Mon Sep 17 00:00:00 2001 From: Alexander Pantyukhin Date: Mon, 12 Jun 2023 10:22:55 +0400 Subject: [PATCH 5/9] Update license_copyright/license.yml Co-authored-by: David Leal --- license_copyright/license.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/license_copyright/license.yml b/license_copyright/license.yml index 502b1a4..0fcb259 100644 --- a/license_copyright/license.yml +++ b/license_copyright/license.yml @@ -31,4 +31,3 @@ runs: 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 }} - From 07d3b1cbd479451c884aab1a534ff0b5fb3ac2a2 Mon Sep 17 00:00:00 2001 From: David Leal Date: Mon, 12 Jun 2023 11:17:55 -0600 Subject: [PATCH 6/9] chore: apply suggestions from code review --- license_copyright/license.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/license_copyright/license.yml b/license_copyright/license.yml index 0fcb259..5e37b9d 100644 --- a/license_copyright/license.yml +++ b/license_copyright/license.yml @@ -26,8 +26,8 @@ runs: git push - name: Creating and merging the PR shell: bash - if [[ `git status --porcelain` ]]; then 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 }} From 61daee1b92d76b6a2a4dcf874299f74eb1527a92 Mon Sep 17 00:00:00 2001 From: Alexander Pantyukhin Date: Tue, 13 Jun 2023 09:44:42 +0400 Subject: [PATCH 7/9] Update license_copyright/license.yml Co-authored-by: David Leal --- license_copyright/license.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/license_copyright/license.yml b/license_copyright/license.yml index 5e37b9d..5ffd60f 100644 --- a/license_copyright/license.yml +++ b/license_copyright/license.yml @@ -6,6 +6,10 @@ inputs: 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: From 469c5e99669d03ba91afb8e49fc547aa44cc13c3 Mon Sep 17 00:00:00 2001 From: Alexander Pantyukhin Date: Tue, 13 Jun 2023 09:44:51 +0400 Subject: [PATCH 8/9] Update license_copyright/license.yml Co-authored-by: David Leal --- license_copyright/license.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/license_copyright/license.yml b/license_copyright/license.yml index 5ffd60f..a6647d6 100644 --- a/license_copyright/license.yml +++ b/license_copyright/license.yml @@ -15,7 +15,7 @@ runs: steps: - name: Update the License run: | - (echo "Copyright (C) 2016-$(date +"%Y") TheAlgorithms and contributors"; tail -n +2 ${{ inputs.filename }}) > License.tmp + (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 From d2a4ff84a326e317e0bb7a1c23a9f4d9bfa1d574 Mon Sep 17 00:00:00 2001 From: David Leal Date: Tue, 13 Jun 2023 10:27:00 -0600 Subject: [PATCH 9/9] chore: apply suggestions from code review --- license_copyright/license.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/license_copyright/license.yml b/license_copyright/license.yml index a6647d6..9777188 100644 --- a/license_copyright/license.yml +++ b/license_copyright/license.yml @@ -26,7 +26,7 @@ runs: shell: bash run: | git checkout -b license-update-${{ github.sha }} - git commit -m "docs: updating Copyright license year" + git commit -m "docs: updating copyright license year" git push - name: Creating and merging the PR shell: bash