Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corrige un problème avec la génération des ID sur github actions #58

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/retrieve_writefreely.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
steps:
- uses: "actions/checkout@v4"
with:
ref: ${{ github.head_ref }}
ref: ${{ github.ref_name }}
- uses: "actions/setup-python@v2"
with:
python-version: "3.9"
python-version: "3.12"
- name: "go to `./scripts`"
run: |
cd scripts
Expand Down
11 changes: 9 additions & 2 deletions scripts/import_wf_offload.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
import requests
import frontmatter

from dateutil import parser
import datetime
import pytz

# %%
source = 'https://write.apreslanu.it/api/collections/offload/posts'
Expand Down Expand Up @@ -51,9 +52,10 @@ def get_posts():

# %%
def write_posts(posts):
tz = pytz.timezone('Europe/Paris')

for p in posts:
filename = parser.parse(p['created']).strftime('%s')
filename = datetime.datetime.fromisoformat(p['created'][:19]+"Z").astimezone(tz).strftime('%s')
url = source.replace('/api/collections', '').replace('posts', p['slug'])

post = frontmatter.Post(
Expand All @@ -64,6 +66,11 @@ def write_posts(posts):
)

print(filename)
print(p['created'][:19]+"Z")
print(datetime.datetime.fromisoformat(p['created'][:19]+"Z"))
print(datetime.datetime.fromisoformat(p['created'][:19]+"Z").strftime('%s'))
print(datetime.datetime.fromisoformat(p['created'][:19]+"Z").astimezone(tz))
print(datetime.datetime.fromisoformat(p['created'][:19]+"Z").astimezone(tz).strftime('%s'))
print(post['title'])
print(post['source'])

Expand Down
6 changes: 4 additions & 2 deletions scripts/import_wf_tk.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
import requests
import frontmatter

from dateutil import parser
import datetime
import pytz

# %%
source = 'https://write.apreslanu.it/api/collections/tk/posts'
Expand Down Expand Up @@ -51,9 +52,10 @@ def get_posts():

# %%
def write_posts(posts):
tz = pytz.timezone('Europe/Paris')

for p in posts:
filename = parser.parse(p['created']).strftime('%s')
filename = datetime.datetime.fromisoformat(p['created']).astimezone(tz).strftime('%s')
url = source.replace('/api/collections', '').replace('posts', p['slug'])

post = frontmatter.Post(
Expand Down
1 change: 1 addition & 0 deletions scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
requests
python-frontmatter
python-dateutil
pytz
Loading