Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/updateCopyrightDate.yml
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this will work, a schedule GitHub actions will be disabled due to repository inactivity after 60 days so it might not run when it need to.

. In a public repository, scheduled workflows are automatically disabled when no repository activity has occurred in 60 days.
https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/disabling-and-enabling-a-workflow

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Update Copyright Notice

on:
schedule:
- cron: '0 0 1 1 *' # Runs at midnight on the first day of every year
workflow_dispatch:

jobs:
update-copyright:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Update copyright notice
run: |
pwsh -Command "
$configFilePath = 'config.toml'
$configContent = Get-Content -Path $configFilePath
$currentYear = (Get-Date).Year
$PreviousYear = (Get-Date).Year - 1
$UpdatedContent = $Content -replace $PreviousYear, $NewYear
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably make sure it changes the number on only the correct row so there isn't a value of say 2026 in some other place that should not change. 🤔

Set-Content -Path $configFilePath -Value $UpdatedContent
"

- name: Commit changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add config.toml
git commit -m "Update copyright notice for the year $(date +'%Y')"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ title = "DSC Community"
dateFormat = "2 January 2006"
home = "Home"
logo = "DSC Community and Resource Kit"
copyright = "Copyright 2019 the dsccommunity.org contributors."
copyright = "Copyright 2019 to 2025 - the dsccommunity.org contributors."

# navigation
[Languages.en.menu]
Expand Down