report tech news #257
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: report tech news | |
on: | |
schedule: | |
- cron: "0 9 * * *" | |
env: | |
REPORT_HASH_FILE: ./report_news.hash | |
jobs: | |
build: | |
defaults: | |
run: | |
working-directory: ./.github/workflows/report_news | |
name: Build And Send | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GA_WORKFLOW_DEPLOYMENTS_TOKEN }} | |
- 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/[email protected] | |
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) > 1000 ]] &&\ | |
tail -n +990 $REPORT_HASH_FILE > $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 |