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

implement rss-to-twitter workflow #1216

Merged
merged 6 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/rss-to-twitter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: rss-to-twitter

on:
schedule:
# everyday at 01:00 UTC (10:00 JST)
cm-ayf marked this conversation as resolved.
Show resolved Hide resolved
- cron: '0 1 * * *'

jobs:
twitter:
runs-on: ubuntu-latest
steps:
- uses: azu/rss-to-twitter@v2
with:
# RSS feed URL
RSS_URL: "https://utelecon.adm.u-tokyo.ac.jp/notice/rss.xml"
# UPDATE_WITHIN_MINUTES is calculated from cron schedule to be 1 day
TWEET_TEMPLATE: '%title% %url%'
TWITTER_APIKEY: ${{ secrets.TWITTER_APIKEY }}
TWITTER_APIKEY_SECRET: ${{ secrets.TWITTER_APIKEY_SECRET }}
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
twitter-en:
runs-on: ubuntu-latest
steps:
- uses: azu/rss-to-twitter@v2
with:
# RSS feed URL
RSS_URL: "https://utelecon.adm.u-tokyo.ac.jp/en/notice/rss.xml"
# UPDATE_WITHIN_MINUTES is calculated from cron schedule to be 1 day
TWEET_TEMPLATE: '%title% %url%'
TWITTER_APIKEY: ${{ secrets.TWITTER_EN_APIKEY }}
TWITTER_APIKEY_SECRET: ${{ secrets.TWITTER_EN_APIKEY_SECRET }}
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_EN_ACCESS_TOKEN }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_EN_ACCESS_TOKEN_SECRET }}
3 changes: 2 additions & 1 deletion src/components/pages/rss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export async function rss({ title, description, url, lang }: RssParams) {
itemsMap.set(link, {
title,
link,
pubDate: new Date(notice.date),
// 12:00 of the day in order for rss-to-twitter to work correctly
pubDate: new Date(notice.date.getTime() + 12 * 60 * 60 * 1000),
});
}

Expand Down