From 017dc0dee6d7c4f4ae0df2b542f5771f650b036b Mon Sep 17 00:00:00 2001 From: DanielFran Date: Tue, 2 Jan 2024 15:12:35 +0000 Subject: [PATCH 1/7] Add workflows write permission --- .github/workflows/copyright-update.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/copyright-update.yml b/.github/workflows/copyright-update.yml index e320df6a8fd4..3bbc8940bdf6 100644 --- a/.github/workflows/copyright-update.yml +++ b/.github/workflows/copyright-update.yml @@ -29,6 +29,7 @@ jobs: permissions: contents: write # for peter-evans/create-pull-request to create branch pull-requests: write # for peter-evans/create-pull-request to create a PR + workflows: write # for peter-evans/create-pull-request to create a PR name: copyright update if: github.repository == 'jhipster/generator-jhipster' runs-on: ubuntu-latest From 9987b3198c4108a6bdbe3d1b6b4549edbb3ddfd6 Mon Sep 17 00:00:00 2001 From: DanielFran Date: Tue, 2 Jan 2024 15:14:22 +0000 Subject: [PATCH 2/7] Allow pull_request workflow for testing --- .github/workflows/copyright-update.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/copyright-update.yml b/.github/workflows/copyright-update.yml index 3bbc8940bdf6..5b6593b95878 100644 --- a/.github/workflows/copyright-update.yml +++ b/.github/workflows/copyright-update.yml @@ -18,6 +18,7 @@ name: Copyright Update on: + pull_request: schedule: - cron: '0 0 31 12 *' # Repeats December 31st every year @@ -42,6 +43,8 @@ jobs: fetch-depth: 0 # Update the copyright headers - name: Find and Replace +# CURRENT_YEAR=$(date +'%Y') +# NEW_YEAR=$(($CURRENT_YEAR + 1)) run: | CURRENT_YEAR=$(date +'%Y') NEW_YEAR=$(($CURRENT_YEAR + 1)) From 761b82fc52d0a093b91ad56ff76340ef338cc91b Mon Sep 17 00:00:00 2001 From: DanielFran Date: Tue, 2 Jan 2024 15:15:17 +0000 Subject: [PATCH 3/7] Calculate current year --- .github/workflows/copyright-update.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/copyright-update.yml b/.github/workflows/copyright-update.yml index 5b6593b95878..9c9a76b0d677 100644 --- a/.github/workflows/copyright-update.yml +++ b/.github/workflows/copyright-update.yml @@ -46,8 +46,8 @@ jobs: # CURRENT_YEAR=$(date +'%Y') # NEW_YEAR=$(($CURRENT_YEAR + 1)) run: | - CURRENT_YEAR=$(date +'%Y') - NEW_YEAR=$(($CURRENT_YEAR + 1)) + NEW_YEAR=$(date +'%Y') + CURRENT_YEAR=$(($NEW_YEAR - 1)) grep -rlZE "Copyright ([0-9]+)-$CURRENT_YEAR" . | xargs -0 sed -i -E "s/Copyright ([0-9]+)-$CURRENT_YEAR/Copyright \1-$NEW_YEAR/g" # Create PR - name: Create Pull Request From e5cd9ff4dcd0bec4c8f22ccd5c37fa82c00d3cdb Mon Sep 17 00:00:00 2001 From: DanielFran Date: Tue, 2 Jan 2024 15:17:48 +0000 Subject: [PATCH 4/7] Formatting --- .github/workflows/copyright-update.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/copyright-update.yml b/.github/workflows/copyright-update.yml index 9c9a76b0d677..0b1633d728a6 100644 --- a/.github/workflows/copyright-update.yml +++ b/.github/workflows/copyright-update.yml @@ -43,8 +43,8 @@ jobs: fetch-depth: 0 # Update the copyright headers - name: Find and Replace -# CURRENT_YEAR=$(date +'%Y') -# NEW_YEAR=$(($CURRENT_YEAR + 1)) + # CURRENT_YEAR=$(date +'%Y') + # NEW_YEAR=$(($CURRENT_YEAR + 1)) run: | NEW_YEAR=$(date +'%Y') CURRENT_YEAR=$(($NEW_YEAR - 1)) From 64bb52be2370e920c8fa047451fedb00d7bb8270 Mon Sep 17 00:00:00 2001 From: DanielFran Date: Tue, 2 Jan 2024 15:23:20 +0000 Subject: [PATCH 5/7] Formatting --- .github/workflows/copyright-update.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/copyright-update.yml b/.github/workflows/copyright-update.yml index 0b1633d728a6..89bb7bc8f329 100644 --- a/.github/workflows/copyright-update.yml +++ b/.github/workflows/copyright-update.yml @@ -43,8 +43,8 @@ jobs: fetch-depth: 0 # Update the copyright headers - name: Find and Replace - # CURRENT_YEAR=$(date +'%Y') - # NEW_YEAR=$(($CURRENT_YEAR + 1)) + # CURRENT_YEAR=$(date +'%Y') + # NEW_YEAR=$(($CURRENT_YEAR + 1)) run: | NEW_YEAR=$(date +'%Y') CURRENT_YEAR=$(($NEW_YEAR - 1)) From 40a5fb5bc58ae5f127569c36ac3d1a59c6e5bc98 Mon Sep 17 00:00:00 2001 From: DanielFran Date: Tue, 2 Jan 2024 15:36:44 +0000 Subject: [PATCH 6/7] Remove workflows write permission --- .github/workflows/copyright-update.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/copyright-update.yml b/.github/workflows/copyright-update.yml index 89bb7bc8f329..b5b33c37bd9b 100644 --- a/.github/workflows/copyright-update.yml +++ b/.github/workflows/copyright-update.yml @@ -30,7 +30,6 @@ jobs: permissions: contents: write # for peter-evans/create-pull-request to create branch pull-requests: write # for peter-evans/create-pull-request to create a PR - workflows: write # for peter-evans/create-pull-request to create a PR name: copyright update if: github.repository == 'jhipster/generator-jhipster' runs-on: ubuntu-latest From fdd8813a21d63f298dfb98f8efc6cd4c2c9e8f73 Mon Sep 17 00:00:00 2001 From: DanielFran Date: Tue, 2 Jan 2024 15:39:30 +0000 Subject: [PATCH 7/7] Remove copyright dates from stale workflow --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 1ccf61335d12..8c09a0f1c8e2 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,5 +1,5 @@ # -# Copyright 2013-2023 the original author or authors from the JHipster project. +# Copyright the original author or authors from the JHipster project. # # This file is part of the JHipster project, see https://www.jhipster.tech/ # for more information.