Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 10, 2022 01:04 pm GMT

GitHub Action Schedules

Table of Contents

  1. GitHub Actions
  2. GitHub Actions Schedules

GitHub Actions

GitHub actions was launched in 2018 to help developers automate their workflows and goes beyon the typical testing, building, and deploying. It supports C, C++, C#, Java, JavaScript, PHP, Python, Ruby, Scala, and TypeScript. GitHub actions brings automation into the development cycle through event-driven triggers and can range from creating a pull request for building a new brand in a repository.

All GitHub actions are handled via YAML files stored in .github/workflows directory. Every workflow consists of:

  • Events = triggers that start the workflow
  • Jobs = steps that execute
  • Steps = individual tasks that run commands
  • Actions = a command that's executed
  • Runners = a GitHub Actions server

GitHub actions is completely free and available to use on any public repository and self-hosted runner. With the free plan, there is 500MB of workflows.

GitHub Action Schedules

The word schedule defines when your workflow runs on. Let's take a look at this:

name: run this thing every 60 minuteson:    schedule:        - cron: "*/60 * * * *"

When you type this into your YAML file, a blue squiggly line will appear below "*/60 * * * *". If you hover your mouse over this area and your cursor turns into the question mark/hook icon, you will get a pop-up with the schedule you've set. In this case it would say "Runs every hour, on the hour. Actions schedules run at most every 5 minutes."

If you want to change the schedule to your needs, the asterisks work like so:

*    *    *    *    *                                   Weekday  (0=Sun .. 6=Sat)              Month    (1..12)          Day      (1..31)      Hour     (0..23)  Minute   (0..59)
OperatorDescription
*all values
,separate individual values
-a range of values
/divide a value into steps

Here are some examples that may help

ExampleDescription
0 * * * *every hour
*/15 * * * *every 15 mins
0 */2 * * *every 2 hours
0 18 * * 0-6every week Mon-Sat at 6pm
10 2 * * 6,7every Sat and Sun on 2:10am
0 0 * * 0every Sunday midnight
------
@rebootevery reboot

Each is considered an allotted time period and are based in UTC timezone. Be careful because some of you may need to do some timezone conversions!

Check out these articles by @kalashin1 and @himanshugarg574

Happy coding!


Original Link: https://dev.to/tmchuynh/github-action-schedules-ad5

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To