-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from core-coin/update/status-01
Auto update status
- Loading branch information
Showing
12 changed files
with
181 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Update Front Matter | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 */2 * *' # Runs at 00:00 UTC every 2 days | ||
|
||
jobs: | ||
update-front-matter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
pip3 install python-frontmatter pyyaml | ||
- name: Update Front Matter in Markdown Files | ||
run: python3 update_frontmatter.py | ||
|
||
- name: Commit changes | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Action" | ||
git add -A | ||
git diff --staged --quiet || git commit -m "Update front matter tags based on dates" | ||
git push |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,7 +83,7 @@ Supported formats: | |
- `First Last <email>`: Email address. | ||
- `First Last (@github)`: GitHub username. | ||
- `First Last (@[email protected])`: Nickname and pod (e.g., @coretalk.space). | ||
- `First Last` `(cb00…@cp)` or `<corepass:cb00…>`: CoreID from CorePass. | ||
- `First Last` `[cb00…@coreid]` or `<corepass:cb00…>`: CoreID from CorePass. | ||
|
||
## Auxiliary Files | ||
|
||
|
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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "Core CIP", | ||
"short_name": "CoreCip", | ||
"start_url": "./index.html", | ||
"display": "standalone", | ||
"theme_color": "#3b9a3e", | ||
"background_color": "#1c1e21", | ||
"description": "Core Improvement Proposals", | ||
"icons": [ | ||
{ | ||
"src": "img/icons/icon-32.png", | ||
"sizes": "32x32", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "img/icons/icon-48.png", | ||
"sizes": "48x48", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "img/icons/icon-64.png", | ||
"sizes": "64x64", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "img/icons/icon-128.png", | ||
"sizes": "128x128", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "img/icons/icon-256.png", | ||
"sizes": "256x256", | ||
"type": "image/png" | ||
} | ||
], | ||
"related_applications": [ | ||
{ | ||
"platform": "webapp", | ||
"url": "https://cip.coreblockchain.net/manifest.json" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import frontmatter | ||
import os | ||
from datetime import datetime, timedelta | ||
|
||
def parse_date(date_str): | ||
formats = ['%Y-%m-%d', '%Y-%m-%dT%H:%M:%S.%fZ', '%Y-%m-%dT%H:%M:%SZ'] | ||
for fmt in formats: | ||
try: | ||
return datetime.strptime(date_str, fmt) | ||
except ValueError: | ||
pass | ||
raise ValueError(f"Date format not recognized: {date_str}") | ||
|
||
def update_tags(post, today): | ||
try: | ||
creation_date = parse_date(post['date']) | ||
except ValueError as e: | ||
print(e) | ||
return False | ||
|
||
diff = today - creation_date | ||
new_tag = None | ||
|
||
if diff.days >= 42: | ||
new_tag = 'final' | ||
elif diff.days >= 28: | ||
new_tag = 'accepted' | ||
elif diff.days >= 14: | ||
new_tag = 'last call' | ||
|
||
if new_tag: | ||
tags = post.get('tags', []) | ||
if new_tag not in tags: | ||
tags = [tag for tag in tags if tag not in ['draft', 'last call', 'accepted', 'final']] | ||
tags.append(new_tag) | ||
post['tags'] = tags | ||
return True | ||
return False | ||
|
||
def process_markdown_files(): | ||
for subdir, dirs, files in os.walk('cip'): | ||
for file in files: | ||
if file.endswith('.md') or file.endswith('.mdx'): | ||
filepath = os.path.join(subdir, file) | ||
with open(filepath, 'r', encoding='utf-8') as f: | ||
post = frontmatter.load(f) | ||
if update_tags(post, datetime.now()): | ||
with open(filepath, 'w', encoding='utf-8') as f: | ||
frontmatter.dump(post, f) | ||
|
||
if __name__ == "__main__": | ||
process_markdown_files() |