Scheduled Container Run #121
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: Scheduled Container Run | |
on: | |
schedule: | |
- cron: '0 * * * *' # Run every hour | |
workflow_dispatch: # Allow manual triggers | |
permissions: | |
contents: read | |
packages: read | |
jobs: | |
run-container: | |
runs-on: ubuntu-latest | |
timeout-minutes: 1 | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/#-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Pull and run container | |
run: | | |
REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | |
docker pull ghcr.io/${REPO}:latest | |
docker run --rm \ | |
-e WEATHERAPICOM_API_KEY="${{ secrets.WEATHERAPICOM_API_KEY }}" \ | |
-e LAT="${{ secrets.LAT }}" \ | |
-e LON="${{ secrets.LON }}" \ | |
-e GITHUB_TOKEN="${{ secrets.GH_PAT }}" \ | |
ghcr.io/${REPO}:latest |