Remove action

This commit is contained in:
Chuck Smith 2024-07-15 08:18:55 -04:00
parent 976bfb8f65
commit f6067d4bf8
3 changed files with 0 additions and 61 deletions

View File

@ -1,32 +0,0 @@
name: Update List Count Banner
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- master
push:
branches:
- master
jobs:
update-banner:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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 origin HEAD:master # Ensure this matches your repository's default branch

View File

@ -9,8 +9,6 @@ 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: 611
---
**Jump to:** [A](#a) | [B](#b) | [C](#c) | [D](#d) | [E](#e) | [F](#f) | [G](#g) | [H](#h) | [I](#i) | [J](#j) | [K](#k) | [L](#l) | [M](#m) | [N](#n) | [O](#o) | [P](#p) | [Q](#q) | [R](#r) | [S](#s) | [T](#t) | [U](#u) | [V](#v) | [W](#w) | [Y](#y) | [Z](#z)

View File

@ -1,27 +0,0 @@
import re
import os
# Set the correct path to the README.md file
script_dir = os.path.dirname(__file__) # Get the directory where the script is located
root_dir = os.path.join(script_dir, '..') # Move up to the root directory
readme_path = os.path.join(root_dir, 'README.md') # Path to the README.md in the root
# Load the README file
with open(readme_path, 'r', encoding='utf-8') as file:
readme_contents = file.read()
# 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:
file.write(new_readme_contents)