Ask Your Question
1

What is the process to set up a timer in Github actions that executes on Ubuntu?

asked 2023-03-02 11:00:00 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-02-21 04:00:00 +0000

qstack gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-03-02 11:00:00 +0000

Seen: 13 times

Last updated: Feb 21 '23