From 7a5177f26748afa9216fc7639f2f0e8f79c2295b Mon Sep 17 00:00:00 2001 From: Bhupesh-V Date: Mon, 13 Apr 2020 12:19:41 +0530 Subject: [PATCH] minor changes --- .github/workflows/integration.yml | 1 - .github/workflows/python.yml | 2 +- action.yml | 6 +++++- main.py | 6 ++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 48e6366..7540828 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -8,7 +8,6 @@ jobs: - name: Self test id: selftest - # Put your action repo here uses: Bhupesh-V/memer-action@master with: filter: "new" diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index ce1223a..5e01890 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -15,4 +15,4 @@ jobs: - name: Lint run: | pip install flake8 - flake8 main.py + flake8 main.py --ignore=E501 diff --git a/action.yml b/action.yml index 8e27db5..ac3d764 100644 --- a/action.yml +++ b/action.yml @@ -1,13 +1,17 @@ name: "Memer Action" description: "A GitHub Action for Programmer Memes" author: "Bhupesh Varshney" +inputs: + filter: + description: "Sort posts on reddit by (hot, new, top & rising) by default hot" + required: false outputs: title: description: "The Post Title" source: description: "The Source of the meme" meme: - description: "The meme image" + description: "The Meme Image" runs: using: "docker" image: "Dockerfile" diff --git a/main.py b/main.py index 8668cd4..0c7d1ed 100644 --- a/main.py +++ b/main.py @@ -11,8 +11,10 @@ def getMeme(filter_posts="hot"): memedict = {} f = feedparser.parse(f"{HOST_URL}/{filter_posts}.rss") for entry in f.entries: - x = entry['content'][0]['value'] - img = x[x.find("https://i.redd.it"): x.find("link") - 3] + post_content = entry["content"][0]["value"] + img = post_content[ + post_content.find("https://i.redd.it"): post_content.find("link") - 3 + ] if img != "": memedict["title"] = entry["title"] memedict["src"] = str(entry["link"])