Skip to content

Hacker News links to Telegram #78

Hacker News links to Telegram

Hacker News links to Telegram #78

name: 'Hacker News links to Telegram'
on:
schedule:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
# https://crontab.guru/
- cron: '55 10 * * 1' # UTC time
workflow_dispatch:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
# You can trigger this workflow manually using the GitHub CLI:
# gh workflow run "Hacker News links to Telegram" --ref branch-name
jobs:
steampipe-hn-telegram:
name: Hacker News links to Telegram
runs-on: ubuntu-latest
steps:
- name: 🛎️ Checkout repo
uses: actions/checkout@v4
- name: 🖥️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: latest
- run: npm ci
- name: Setup Steampipe and its plugins
# https://github.com/marketplace/actions/setup-steampipe
uses: turbot/steampipe-action-setup@v1
with:
steampipe-version: latest
# https://hub.steampipe.io/plugins/turbot/hackernews#configuration
plugin-connections: |
connection "hackernews" {
plugin = "hackernews"
max_items = 5000
}
- name: 🔗 Hacker News links
env:
DEBUG: hn:*,script:*
TELEGRAM: ${{ secrets.TELEGRAM }}
run: |
delimiter=$(openssl rand -hex 8)
echo "TELEGRAM_MESSAGE<<$delimiter" >> $GITHUB_ENV
node scripts/hacker-news/job-links.mjs -d 'Jobs from YC-backed startups on HN this week' -q 'hacker-news-jobs-YC.sql' >> $GITHUB_ENV
echo "$delimiter" >> $GITHUB_ENV
- name: 💬 Send Hacker News link to Telegram
uses: appleboy/telegram-action@v0.1.1
with:
to: ${{ fromJSON(secrets.TELEGRAM).chat_id }}
token: ${{ fromJSON(secrets.TELEGRAM).token }}
format: html
disable_web_page_preview: true
message: ${{ env.TELEGRAM_MESSAGE }}