Skip to content

Commit

Permalink
Merge pull request #26 from MarcChen/fix/workflow_run_2.0.0
Browse files Browse the repository at this point in the history
fixing workflow issue from 2.0.0 bump version
  • Loading branch information
MarcChen authored Feb 1, 2025
2 parents 4851671 + aca0232 commit 2752a7b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/sync_notion_to_google.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ jobs:
poetry check
working-directory: ${{ github.workspace }}

# 4) Install Dependencies
- name: Install Dependencies
# 4) Configure Poetry environment to use Python 3.10
- name: Set Poetry Env to Python 3.10
shell: bash
run: |
poetry install
poetry env use python3.10
working-directory: ${{ github.workspace }}

# 5) Run Unit Tests
- name: Run Unit Tests
# 5) Install Dependencies
- name: Install Dependencies
shell: bash
run: |
poetry run pytest tests/unit --maxfail=1 --disable-warnings
poetry install
working-directory: ${{ github.workspace }}

# 6) Install jq for JSON parsing
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
- name: Generate Google API Token
shell: bash
run: |
poetry run python3.10 services/google_task/config/config_creds.py --save_dir .
poetry run python services/google_task/config/config_creds.py --save_dir .
working-directory: ${{ github.workspace }}
env:
GOOGLE_ACCESS_TOKEN: ${{ secrets.GOOGLE_ACCESS_TOKEN }}
Expand All @@ -137,7 +137,7 @@ jobs:
shell: bash
run: |
export TOKEN_PATH="${{ github.workspace }}/token.json"
poetry run python3.10 main.py
poetry run python main.py
working-directory: ${{ github.workspace }}
env:
NOTION_API: ${{ secrets.NOTION_API }}
Expand Down
2 changes: 0 additions & 2 deletions services/google_task/src/authentification.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,5 @@ def print_token_ttl(credentials):
if credentials.expiry:
expiry_aware = credentials.expiry.replace(tzinfo=datetime.timezone.utc)
now_aware = datetime.datetime.now(tz=datetime.timezone.utc)
ttl = (expiry_aware - now_aware).total_seconds()
print(f"Token TTL (seconds): {ttl}")
else:
print("No expiry information available for the token.")
14 changes: 5 additions & 9 deletions services/sync_notion_google_task/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ def sync_pages_to_google_tasks(self):
parent_page_name = page["parent_page_name"] or None

console.print(
f"[bold]Processing Page: {page_title} (ID: {page_id})[/bold]"
f"[bold]Processing Page ID: {page_id}[/bold]"
)

if self.task_exists(google_task_lists, page_id):
console.print(
f"[yellow]Task for page '{page_title}' already exists. Skipping...[/yellow]"
f"[yellow]Task for page ID '{page_id}' already exists. Skipping...[/yellow]"
)
progress.advance(task)
continue
Expand All @@ -79,9 +79,6 @@ def sync_pages_to_google_tasks(self):
tasklist_id = self.ensure_tasklist_exists(
tag, google_task_lists
)
console.print(
f" Task List ID for tag '{tag}': {tasklist_id}"
)
except Exception as e:
console.print(
f"[red]Error ensuring task list for tag '{tag}': {e}[/red]"
Expand All @@ -96,7 +93,6 @@ def sync_pages_to_google_tasks(self):
task_description = self.build_task_description(
importance, text, urls, due_date
)
console.print(f" Task Description: {task_description}")
except Exception as e:
console.print(
f"[red]Error building task description: {e}[/red]"
Expand All @@ -115,14 +111,14 @@ def sync_pages_to_google_tasks(self):
due_date=recomputed_due_date,
)
console.print(
f"[green]Task for page '{page_title}' created successfully![/green]"
f"[green]Task for page ID '{page_id}' created successfully![/green]"
)
except Exception as e:
console.print(
f"[red]Error creating task for page '{page_title}': {e}[/red]"
f"[red]Error creating task for page ID '{page_id}': {e}[/red]"
)
self.sms_altert.send_sms(
f"Error creating task for page '{page_title}': {e}"
f"Error creating task for page ID '{page_id}': {e}"
)
raise e

Expand Down

0 comments on commit 2752a7b

Please sign in to comment.