Skip to content

report tech news

report tech news #453

Workflow file for this run

name: report tech news
on:
schedule:
- cron: "0 9 * * *"
env:
REPORT_HASH_FILE: ./report_news.hash
# Needed by the final `git push origin main` step that updates report_news.hash.
permissions:
contents: write
# Single-in-flight per branch; safe because the next run rebuilds
# report_news.hash from the same upstream APIs, so a cancelled run loses no data.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
defaults:
run:
working-directory: ./.github/workflows/report_news
name: Build And Send
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Send the news api message to osscameroon channel
env:
NEWS_API_KEY: ${{ secrets.NEWS_API_KEY }}
run: make -s run > news_feed_message
- name: Dump message
run: cat news_feed_message
- name: send contribution report to osscameroon channel
uses: appleboy/telegram-action@v1.0.1
with:
to: ${{ secrets.TELEGRAM_OSSCAMEROON_CHANNEL_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message_file: ./.github/workflows/report_news/news_feed_message
- name: check the size of the hash-list and clean outdated hashes
shell: bash
run: |
# Count the number of lines from the hash file, if it's greater than 100
# We remove the top 10 lines hashes from the file
[[ $(cat $REPORT_HASH_FILE | wc -l) -gt 1000 ]] && \
tail -n 990 $REPORT_HASH_FILE > tmp.hash && mv tmp.hash $REPORT_HASH_FILE
- name: Commit list of the articles we have already shared
shell: bash
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com" && \
git config --global user.name "github-actions[bot]" && \
git add $REPORT_HASH_FILE && \
git commit -m 'update report_news.hash' && \
git push origin main