Skip to content

Commit e73f791

Browse files
Merge pull request #4 from Sanjay-python27/github-actions-tutorial
GitHub actions tutorial
2 parents 35790eb + 8768c0d commit e73f791

4 files changed

Lines changed: 27 additions & 22 deletions

File tree

‎.github/workflows/lint.yml‎

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
1-
name: Sanjay Lint Python Code
1+
name: Sanjay - GitHub Actions Learning
22

33
on:
44
pull_request:
55
branches:
6-
- master
76
- github-actions-tutorial
8-
9-
push:
10-
branches:
11-
- master
7+
- main
128

139
workflow_dispatch:
1410

1511
jobs:
16-
lint:
12+
Linting-check:
1713
runs-on: ubuntu-latest
1814

1915
steps:
20-
- uses: actions/checkout@v4
16+
- name: Say Hello
17+
run: echo "Hello Sanjay! My first GitHub Action is running."
18+
19+
- name: Checkout Code
20+
uses: actions/checkout@v4
2121

22-
- uses: actions/setup-python@v5
22+
- name: Setup Python
23+
uses: actions/setup-python@v5
2324
with:
24-
python-version: "3.13"
25-
cache: "pip"
25+
python-verson: "3.13"
2626

27-
- name: Install dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
python -m pip install ruff
27+
- name: Install Ruff
28+
run: python -m pip install Ruff
3129

3230
- name: Run Ruff
33-
run: ruff check --output-format=github
31+
run: ruff check .

‎src/reader/feed.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Interact with the Real Python feed."""
22
# Standard library imports
3-
from typing import Dict, List
3+
from __future__ import annotations
44

55
# Third party imports
66
import feedparser
@@ -9,7 +9,7 @@
99
# Reader imports
1010
from reader import URL
1111

12-
_CACHED_FEEDS: Dict[str, feedparser.FeedParserDict] = {}
12+
_CACHED_FEEDS: dict[str, feedparser.FeedParserDict] = {}
1313

1414

1515
def _feed(url: str = URL) -> feedparser.FeedParserDict:
@@ -21,8 +21,11 @@ def _feed(url: str = URL) -> feedparser.FeedParserDict:
2121

2222
def get_site(url: str = URL) -> str:
2323
"""Get name and link to website of the feed."""
24+
# info = _feed(url)
25+
# if exception := info.get("bozo_exception"):
2426
info = _feed(url)
25-
if exception := info.get("bozo_exception"):
27+
exception = info.get("bozo_exception")
28+
if exception:
2629
message = f"Could not read feed at {url}"
2730
if "CERTIFICATE_VERIFY_FAILED" in str(exception):
2831
message += (
@@ -58,7 +61,7 @@ def get_article(article_id: str, links: bool = False, url: str = URL) -> str:
5861
return f"# {article.title}\n\n{text}"
5962

6063

61-
def get_titles(url: str = URL) -> List[str]:
64+
def get_titles(url: str = URL) -> list[str]:
6265
"""List titles in feed."""
6366
articles = _feed(url).entries
6467
return [a.title for a in articles]

‎src/reader/ruff_issue.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import os
2+
3+
def calculate(x, y):
4+
return x + y

‎src/reader/viewer.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"""Functions for displaying the Real Python feed."""
22

33
# Standard library imports
4-
from typing import List
4+
from __future__ import annotations
55

66

77
def show(article: str) -> None:
88
"""Show one article."""
99
print(article)
1010

1111

12-
def show_list(site: str, titles: List[str]) -> None:
12+
def show_list(site: str, titles: list[str]) -> None:
1313
"""Show list of articles."""
1414
print(f"The latest tutorials from {site}")
1515
for article_id, title in enumerate(titles):

0 commit comments

Comments
 (0)