From 49c42fbaac617c660989462ca7fa8ed9408611c0 Mon Sep 17 00:00:00 2001 From: Chuck Smith Date: Mon, 15 Jul 2024 08:10:12 -0400 Subject: [PATCH] Add commit step to actions --- .github/workflows/update-banner.yml | 9 +++++++++ README.md | 2 +- src/update_banner.py | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-banner.yml b/.github/workflows/update-banner.yml index 9ba584cf..087dd9bf 100644 --- a/.github/workflows/update-banner.yml +++ b/.github/workflows/update-banner.yml @@ -19,3 +19,12 @@ jobs: - name: Count list items and update README run: python3 src/update_banner.py + + - name: Commit changes + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add README.md + git commit -m "Update list count in README" -a || echo "No changes to commit" + git push + diff --git a/README.md b/README.md index b3d6bfcc..9a07523a 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This repo was inspired by [Ali Spittel's](https://twitter.com/ASpittel) tweet Hopefully this repo can serve as a source of inspiration for your portfolio! -## Current List Count: 4 +## Current List Count: 613 --- diff --git a/src/update_banner.py b/src/update_banner.py index bfa70f20..5a7a04a5 100644 --- a/src/update_banner.py +++ b/src/update_banner.py @@ -12,12 +12,15 @@ # Count the list items list_count = len(re.findall(r'^\s*-\s', readme_contents, re.MULTILINE)) +print(list_count) # Define the new banner message new_banner = f'## Current List Count: {list_count}' +print(new_banner) # Replace old banner with new banner in README new_readme_contents = re.sub(r'## Current List Count: \d+', new_banner, readme_contents) +print(new_readme_contents) # Save the changes back to README.md with open(readme_path, 'w', encoding='utf-8') as file: