Skip to content

Commit

Permalink
BUILD-7128 manage time period in license in a better way
Browse files Browse the repository at this point in the history
  • Loading branch information
SamirM-BE committed Jan 3, 2025
1 parent 0916c5b commit 772a520
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 48 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/update-license.yml

This file was deleted.

15 changes: 15 additions & 0 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import os
import shutil
import datetime

PROJECT_DIRECTORY = os.path.realpath(os.path.curdir)

Expand All @@ -19,6 +20,20 @@ def set_license():
raise ValueError(f"Invalid repository visibility: {visibility}")
shutil.rmtree(os.path.join(PROJECT_DIRECTORY, 'licenses'))

def update_license_year():
current_year = datetime.datetime.now().year
license_path = os.path.join(PROJECT_DIRECTORY, 'licenses/sonarsource.txt')

if os.path.exists(license_path):
with open(license_path, 'r') as file:
content = file.read()

updated_content = content.replace('{{ current_year }}', str(current_year))

with open(license_path, 'w') as file:
file.write(updated_content)
else:
raise FileNotFoundError(f"License file not found at {license_path}")

def use_cirrus_ci():
_use_cirrus_ci = '{{ cookiecutter.use_cirrus_ci }}'
Expand Down

0 comments on commit 772a520

Please sign in to comment.