Last active
December 14, 2022 11:11
-
-
Save allixsenos/f12977de767f32450f435ec2f33b93f0 to your computer and use it in GitHub Desktop.
dkorunic/e-dnevnik-bot + Github Actions = <3
This file contains hidden or 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: e-imenik run | |
# Controls when the action will run. | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Run on push to any branch for testing | |
push: | |
# Run every 6 hours | |
schedule: | |
- cron: "0 */6 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Render the config file | |
run: | | |
cat > .e-dnevnik.toml <<EOF | |
[[user]] | |
username = "$SKOLE_USERNAME" | |
password = "$SKOLE_PASSWORD" | |
[telegram] | |
token = "$TELEGRAM_TOKEN" | |
chatids = [ "$TELEGRAM_CHATID" ] | |
EOF | |
env: | |
SKOLE_USERNAME: ${{ secrets.SKOLE_USERNAME }} | |
SKOLE_PASSWORD: ${{ secrets.SKOLE_PASSWORD }} | |
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
TELEGRAM_CHATID: ${{ secrets.TELEGRAM_CHATID }} | |
- name: Run dkorunic/e-dnevnik-bot | |
run: | | |
docker run -t \ | |
--volume "$(pwd):/ednevnik" \ | |
--user $(id -u):$(id -g) \ | |
dkorunic/e-dnevnik-bot \ | |
--verbose \ | |
--database /ednevnik/.e-dnevnik.db \ | |
--conffile /ednevnik/.e-dnevnik.toml | |
- name: Delete the config file so it doesn't get committed back :) | |
run: rm .e-dnevnik.toml | |
- name: Commit the DB | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_author: GitHub Actions <[email protected]> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment