Update Year in README #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Year in README | |
on: | |
schedule: | |
- cron: '0 0 1 1 *' # Runs on January 1st every year | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Update year in README | |
run: | | |
current_year=$(date +"%Y") | |
sed -i "s/\*\([0-9]\{4\}\)\*/\*$current_year\*/g" README.md | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "github-actions@github.com" | |
git commit -am "Update year in README to $(date +"%Y")" || exit 0 | |
git push |