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

Shower some emoji-love!? #29

Closed
utkarsh2102 opened this issue Sep 22, 2020 · 9 comments
Closed

Shower some emoji-love!? #29

utkarsh2102 opened this issue Sep 22, 2020 · 9 comments
Labels
enhancement New feature or request first-timers-only good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed up-for-grabs

Comments

@utkarsh2102
Copy link

utkarsh2102 commented Sep 22, 2020

Hi @gautamkrishnar,

Thanks for your work on this!

// Building with custom template
const date = dateFormat(cur.date, core.getInput('date_format')); // Formatting date
let content = template
.replace(/\$title\b/g, cur.title)
.replace(/\$url\b/g, cur.url)
.replace(/\$date\b/g, date)
.replace(/\$newline/g, '\n');

As I see it, the "Latest Blog Posts" section could you some emoji-love.
What I mean is, maybe we could use some emoji (at random from a pre-defined set) before the blog post. For example:

  1. 💯 [$title]($url)
  2. 🔥 [$title]($url)
  3. 💫 [$title]($url)
  4. 🚀 [$title]($url)
  5. 🌮 [$title]($url)
@gautamkrishnar
Copy link
Owner

gautamkrishnar commented Sep 22, 2020

Setting a single emoji will be possible via the template argument itself. We can introduce a new template variable as $randomEmoji for randomizing the emojis. We should use a static array of emojis so that there won't be unwanted commits generated for the people who are running the workflow in their repo every hour due to randomization. You can also pass token/feed URL as the seed so that the order of the emojis will stay the same every time when randomized for a single repo.

Thanks for the suggestion @utkarsh2102

@gautamkrishnar gautamkrishnar added enhancement New feature or request first-timers-only good first issue Good for newcomers help wanted Extra attention is needed up-for-grabs labels Sep 22, 2020
@utkarsh2102
Copy link
Author

Aye, you're right!
It's best if we use [💯, 🔥, 💫, 🚀, 🌮] in that order to avoid a ton of unnecessary commits!

Thanks, again, for your work on this! ❤️

@gautamkrishnar
Copy link
Owner

gautamkrishnar commented Sep 27, 2020

Got some more ideas for this, we don't have to hard code emojis:

  • $randomEmoji key can be parametrized, users can use template: "$newline - $randomEmoji(💯,🔥,💫,🚀,🌮) $title $url" in their template if they want to randomly generate posts based on the emojis they had given.
  • $emojiKey key can be used to show emojis in the order he/she has specified eg:. template: "$newline - $emojiKey(💯,🔥,💫) $title" will give them posts like:
    - 💯 title1
    - 🔥 title2
    - 💫 title3
    - 💯 title4
    - 🔥 title5

@gautamkrishnar
Copy link
Owner

@utkarsh2102 this is released on version 1.2.8, you can now use it. Thanks a lot for the suggestion.

@LukePrior
Copy link

It could be a good addition to allow emoji selection based on the post category.

@gautamkrishnar
Copy link
Owner

@LukePrior for now i am not planning to inegrate that in the workflow. You can easily acheive that by using the following code:

name: Latest blog post workflow
on:
  schedule: # Run workflow automatically
    - cron: '0 * * * *' # Runs every hour, on the hour
  workflow_dispatch: # Run workflow manually (without waiting for the cron to be called), through the Github Actions Workflow page directly

jobs:
  update-readme-with-blog:
    name: Update this repo's README with latest blog posts
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Pull in dev.to posts
        uses: gautamkrishnar/blog-post-workflow@master
        with:
          feed_list: "https://dev.to/feed/gautamkrishnar,https://www.gautamkrishnar.com/feed/"
          item_exec: |
                if (post.categories.includes("category-name")) {
                    post.title = "😃  " + post.title;
                |

@LukePrior
Copy link

@LukePrior for now i am not planning to inegrate that in the workflow. You can easily acheive that by using the following code:

name: Latest blog post workflow
on:
  schedule: # Run workflow automatically
    - cron: '0 * * * *' # Runs every hour, on the hour
  workflow_dispatch: # Run workflow manually (without waiting for the cron to be called), through the Github Actions Workflow page directly

jobs:
  update-readme-with-blog:
    name: Update this repo's README with latest blog posts
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Pull in dev.to posts
        uses: gautamkrishnar/blog-post-workflow@master
        with:
          feed_list: "https://dev.to/feed/gautamkrishnar,https://www.gautamkrishnar.com/feed/"
          item_exec: |
                if (post.categories.includes("category-name")) {
                    post.title = "😃  " + post.title;
                |

Hi, thanks for this code.

I am trying it out but I seem to be running into an issue.

My Action:

jobs:
  update-readme-with-blog:
    name: Update README blog posts
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Pull in dev.to posts
        uses: gautamkrishnar/blog-post-workflow@master
        with:
          feed_list: "https://lukeprior.github.io/blog/feed"
          item_exec: |
            if (post.categories.includes("SondeHub")) { post.title = "🎈  " + post.title; }

My feed:

https://lukeprior.github.io/blog/feed

My logs:

image

Result:

image

Expected result:

image

I was just wondering if you could spot any obvious errors as to why this might not be working?

@gautamkrishnar
Copy link
Owner

gautamkrishnar commented May 27, 2022

@LukePrior categories array is empty from your feed.
Screenshot 2022-05-27 at 8 39 57 PM

Your feed should have <category>SondeHub</category> for this to work, see: #105 (comment). You currently have <category term="SondeHub"/> which is not a RSS standard way of representing category.

@Qiamast
Copy link

Qiamast commented Jun 22, 2022

i make this template :)
template: "$newline - $randomEmoji(💯,🔥,💫,🚀,🌮)[$title]($url) $newline - $description $newline"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request first-timers-only good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed up-for-grabs
Projects
None yet
Development

No branches or pull requests

4 participants