Github action that fails if no commit for 24 hours

Viewed 28

We are using github to backup configuration files automatically from our servers.

To check that the cron job is working correctly is there a way to have an action failing if there is a no commit for the last 24 hours ?

1 Answers

You can use action with below structure

  1. Github scheduled action, Uses cron syntax
    1. Step actions/checkout step to checkout code
    2. Custom step to get last commit date time e.q.
      1. git log -1 --format=%cd //Outputs: time of last commit
      2. git log -1 --format=%cr //Output: X days ago
    3. Check this and fail the workflow, if condition met.
Related