Skip to content

Commit

Permalink
refactor: use composite tweet article action
Browse files Browse the repository at this point in the history
  • Loading branch information
LayZeeDK committed Dec 7, 2021
1 parent 9c38e32 commit 952a3f1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 47 deletions.
39 changes: 15 additions & 24 deletions workflows/this-is-angular-rss.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
on:
rss:
url: https://dev.to/feed/this-is-angular
url: https://dev.to/feed/this-is-learning

concurrency: this-is-angular-rss

jobs:
Tweet:
name: Tweet
tweet:
name: Tweet article
runs-on: ubuntu-latest
steps:
- name: categories to tags
uses: actions/github-script@v4
id: categories-to-tag
env:
categories: ${{ on.rss.outputs.categories }}
with:
script: |
if(!process.env?.categories) {
return "";
}
return process.env.categories.split(",").map(t => `#${t}`).join(" ");
result-encoding: string
- name: Post To This is Angular
uses: ethomson/send-tweet-action@v1
- name: Tweet about article
uses: ./actions/tweet-article
with:
status: |
"${{ on.rss.outputs.title }}" by ${{ on.rss.outputs.author }} ${{steps.categories-to-tag.outputs.result}}
${{ on.rss.outputs.link }}
consumer-key: ${{ secrets.TIA_TWITTER_CONSUMER_KEY }}
consumer-secret: ${{ secrets.TIA_TWITTER_CONSUMER_SECRET }}
access-token: ${{ secrets.TIA_TWITTER_ACCESS_TOKEN }}
access-token-secret: ${{ secrets.TIA_TWITTER_ACCESS_SECRET }}
rss-author: ${{ on.rss.outputs.author }}
rss-categories: ${{ on.rss.outputs.categories }}
rss-link: ${{ on.rss.outputs.link }}
rss-title: ${{ on.rss.outputs.title }}
twitter-authentication-access-token: ${{ secrets.TIA_TWITTER_ACCESS_TOKEN }}
twitter-authentication-access-token-secret: ${{ secrets.TIA_TWITTER_ACCESS_SECRET }}
twitter-consumer-api-key: ${{ secrets.TIA_TWITTER_CONSUMER_KEY }}
twitter-consumer-api-key-secret: ${{ secrets.TIA_TWITTER_CONSUMER_SECRET }}
37 changes: 14 additions & 23 deletions workflows/this-is-learning-rss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,21 @@ on:
rss:
url: https://dev.to/feed/this-is-learning

concurrency: this-is-learning-rss

jobs:
Tweet:
name: Tweet
tweet:
name: Tweet article
runs-on: ubuntu-latest
steps:
- name: categories to tags
uses: actions/github-script@v4
id: categories-to-tag
env:
categories: ${{ on.rss.outputs.categories }}
with:
script: |
if(!process.env?.categories) {
return "";
}
return process.env.categories.split(",").map(t => `#${t}`).join(" ");
result-encoding: string
- name: Post to This is Learning
uses: ethomson/send-tweet-action@v1
- name: Tweet about article
uses: ./actions/tweet-article
with:
status: |
"${{ on.rss.outputs.title }}" by ${{ on.rss.outputs.author }} ${{steps.categories-to-tag.outputs.result}}
${{ on.rss.outputs.link }}
consumer-key: ${{ secrets.TIL_TWITTER_CONSUMER_KEY }}
consumer-secret: ${{ secrets.TIL_TWITTER_CONSUMER_SECRET }}
access-token: ${{ secrets.TIL_TWITTER_ACCESS_TOKEN }}
access-token-secret: ${{ secrets.TIL_TWITTER_ACCESS_SECRET }}
rss-author: ${{ on.rss.outputs.author }}
rss-categories: ${{ on.rss.outputs.categories }}
rss-link: ${{ on.rss.outputs.link }}
rss-title: ${{ on.rss.outputs.title }}
twitter-authentication-access-token: ${{ secrets.TIL_TWITTER_ACCESS_TOKEN }}
twitter-authentication-access-token-secret: ${{ secrets.TIL_TWITTER_ACCESS_SECRET }}
twitter-consumer-api-key: ${{ secrets.TIL_TWITTER_CONSUMER_KEY }}
twitter-consumer-api-key-secret: ${{ secrets.TIL_TWITTER_CONSUMER_SECRET }}

0 comments on commit 952a3f1

Please sign in to comment.