From 4469b8d097d5499cc8b78ad71f78be8e17a42c6d Mon Sep 17 00:00:00 2001 From: Dheeraj Kumar Sharma Date: Sun, 19 Jan 2025 16:52:35 +0530 Subject: [PATCH] Create update-year.yml --- .github/workflows/update-year.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/update-year.yml diff --git a/.github/workflows/update-year.yml b/.github/workflows/update-year.yml new file mode 100644 index 0000000..88b1b67 --- /dev/null +++ b/.github/workflows/update-year.yml @@ -0,0 +1,25 @@ +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