Set github action to run every month #13
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Python application | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
schedule: | |
- cron: "0 6 2 * *" | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry install | |
sudo apt install -y language-pack-nb wkhtmltopdf | |
sudo dpkg-reconfigure locales | |
locale -a | |
- name: Generate reports | |
env: | |
ELVIA_API_KEY: ${{ secrets.ELVIA_API_KEY }} | |
ZAPTEC_USERNAME: ${{ secrets.ZAPTEC_USERNAME }} | |
ZAPTEC_PASSWORD: ${{ secrets.ZAPTEC_PASSWORD }} | |
run: | | |
poetry run zaptec-costs | |
ls -la | |
- name: Store reports as artefacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: zaptec-reports | |
path: | | |
*.html | |
- name: Send reports via e-mail | |
uses: dawidd6/action-send-mail@v3 | |
with: | |
server_address: smtp.gmail.com | |
server_port: 465 | |
secure: true | |
username: ${{ secrets.MAIL_USERNAME }} | |
password: ${{ secrets.MAIL_PASSWORD }} | |
subject: Zaptec Cost reports are ready | |
to: [email protected] | |
from: Øyvind Evju | |
body: Zaptec Cost reports are attached | |
cc: [email protected] | |
attachments: "*.pdf" |