Skip to content

Instantly share code, notes, and snippets.

@allixsenos
Last active December 14, 2022 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save allixsenos/f12977de767f32450f435ec2f33b93f0 to your computer and use it in GitHub Desktop.
Save allixsenos/f12977de767f32450f435ec2f33b93f0 to your computer and use it in GitHub Desktop.
dkorunic/e-dnevnik-bot + Github Actions = <3
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 <actions@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment