Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update headers with new year #66

Open
wants to merge 1 commit into
base: release
Choose a base branch
from
Open

Update headers with new year #66

wants to merge 1 commit into from

Conversation

mariogeiger
Copy link
Collaborator

@mariogeiger mariogeiger commented Jan 15, 2025

Using the script:

def modification_year_range(file: str) -> str:
    # Use git to get the modification year range
    result = subprocess.run(
        ["git", "log", "--follow", "--format=%ad", "--date=format:%Y", "--", file],
        capture_output=True,
    )
    # output is like "2025\n2024\n2024\n2024"
    years = [int(line) for line in result.stdout.decode("utf-8").split("\n") if line]
    if not years:
        return str(datetime.datetime.now().year)
    min_year, max_year = min(years), max(years)
    if min_year == max_year:
        return str(min_year)
    return f"{min_year}-{max_year}"

@mariogeiger mariogeiger requested a review from kucukben January 15, 2025 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant