.github/workflows/modem-restart.yaml #27
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
on: | |
# see: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows | |
schedule: | |
- cron: "30 12 * * *" # every day at 12:30 PM UTC (8:30 AM EDT, 7:30 AM EST) | |
workflow_dispatch: # allow manual triggering | |
env: | |
DRY_RUN: "false" | |
jobs: | |
modem-restart: | |
runs-on: ubuntu-latest | |
steps: | |
# See: https://github.com/actions/checkout | |
- uses: actions/checkout@v4 | |
# See: https://docs.astral.sh/uv/guides/integration/github/ | |
- name: Install uv and enable caching | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: pyproject.toml | |
- name: Install the project | |
run: uv sync --all-extras --dev | |
# See: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable | |
- name: Set PYTHONPATH | |
run: echo "PYTHONPATH=$(pwd)" >> $GITHUB_ENV | |
# TODO: narrow to the relevant tests for this action | |
# - name: Run tests | |
# run: uv run pytest tests | |
# See: https://github.com/1Password/install-cli-action | |
- name: Install 1Password CLI | |
uses: 1password/install-cli-action@v1 | |
# See: https://github.com/marketplace/actions/connect-tailscale | |
# See: https://tailscale.com/kb/1215/oauth-clients | |
# See: https://www.youtube.com/watch?v=WXCokV-FeFw | |
- name: Connect to Tailscale network | |
uses: tailscale/github-action@v2 | |
with: | |
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} | |
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} | |
tags: tag:ci | |
# See: https://www.youtube.com/watch?v=UmVMaymH1-s | |
- name: Verify Tailscale subnet route access | |
run: tailscale ping 192.168.2.1 | |
- name: Download Playwright browsers | |
# The GitHub Actions server looks for /home/runner/.cache/ms-playwright/chromium-1140/chrome-linux/chrome | |
run: uv run playwright install chromium --with-deps | |
- name: Restart modem | |
run: uv run modem/restart.py | |
env: | |
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} |