random awesome-stars #746
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
# from: https://github.com/maguowei/awesome-stars/blob/master/.github/workflows/schedules.yml | |
name: random awesome-stars | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 30 0 * * * | |
jobs: | |
random-awesome-stars: | |
name: random awesome-stars | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends curl pandoc | |
- name: Send Email | |
shell: bash | |
run: | | |
export RESULT=$(grep -E "^- \[.+$" README.md | grep '](http' | shuf -n 10 | pandoc --from markdown --to html) | |
export DATE=$(date +"%Y-%m-%d") | |
[[ ! -z $RESULT ]] \ | |
&& curl \ | |
-s \ | |
--user 'api:${{ secrets.MAILGUN_API_KEY }}' \ | |
https://api.mailgun.net/v3/${{ secrets.MAILGUN_DOMAIN_NAME }}/messages \ | |
-F from='awesome-stars <postmaster@${{ secrets.MAILGUN_DOMAIN_NAME }}>' \ | |
-F to=${{ secrets.EMAIL_TO }} -F subject="Awesome stars · $DATE" \ | |
--form-string html="<html>$RESULT</html>" |