Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To set up a timer in Github actions that executes on Ubuntu, follow these steps:

  1. Create a new workflow file in your repository under .github/workflows/.

  2. Define the name of the workflow and specify that it should run on an Ubuntu environment. For example:

name: Timer Workflow on Ubuntu
on:
  schedule:
    - cron: '30 23 * * *'
  push:
    branches:
      - master
jobs:
  timer:
    runs-on: ubuntu-latest

This workflow runs on a schedule every day at 11:30 PM and also when changes are pushed to the master branch.

  1. Inside the timer job, define the steps that should be executed when the timer is triggered. For example:
jobs:
  timer:
    runs-on: ubuntu-latest
    steps:
      - name: Run a script
        run: /path/to/your/script.sh

This example runs a shell script located at /path/to/your/script.sh.

  1. Commit and push your changes to GitHub, and your timer workflow will now run on the specified schedule.

Note that Github actions has limitations on the frequency and duration of scheduled workflows. Read here for more details on scheduling limitations.