Finds twingos every 30 minutes #192
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: Finds twingos every 30 minutes | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "*/30 * * * *" # This cron expression runs every 30 minutes | |
jobs: | |
find-twingos: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Twingo needs the repository | |
uses: actions/checkout@v3 | |
- name: Twingo requires Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '22' | |
- name: Twingo requires packages | |
run: npm install | |
- name: Scraping twingos... | |
id: scraping-twingos | |
run: | | |
OUTPUT=$(node index.js) | |
echo "scraping_result=$OUTPUT" >> $GITHUB_OUTPUT | |
- name: New twingos were found! Sending email... | |
if: ${{ steps.scraping-twingos.outputs.scraping_result == 1 }} | |
uses: dawidd6/action-send-mail@v4 | |
with: | |
server_address: ${{ vars.MAIL_SERVER_ADDRESS }} | |
server_port: ${{ vars.MAIL_SERVER_PORT }} | |
username: ${{ secrets.MAIL_USERNAME }} | |
password: ${{ secrets.MAIL_PASSWORD }} | |
subject: New Twingos found! | |
to: ${{ vars.MAIL_TO }} | |
from: Twingo Finder | |
html_body: file://twingos-email.html | |
- name: Pushing twingos (possible updates of twingos-email.html and twingos.json) | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "Pushing twingos" | |
commit_user_name: "GitHub Action" | |
commit_user_email: "[email protected]" | |