GitHub Actions with CRON

https://www.notion.so/GitHub-Actions-with-CRON-07bb3aca648f407a91d8ecbcecdfa59d

About CRON

1
2
3
4
5
6
7
8
9
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6)
# │ │ │ │ │                       
# │ │ │ │ │
# │ │ │ │ │
# * * * * * <command to execute>

Examples

1
2
3
4
5
6
7
name: Test Build

on:  
  push:
  pull_request:
  schedule:
    - cron: '00 1 * * 1'  # At 01:00 on Mondays.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
name: Sync Notion pages to posts

on:
  schedule:
    # Runs "At 20:00 on every day-of-week"
    - cron: '0 20 * * *'
    
jobs:
  # Build job
  sync:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Generate posts
        uses: bndynet/github-action-notion@v1
        with:
          notion-token: $
          root-page-id: $

      - name: Commit posts
        uses: EndBug/add-and-commit@v9  # https://github.com/marketplace/actions/add-commit
        with:
          add: '_posts'
          message: Sync Notion pages to posts by GitHub Actions
          committer_name: Bendy Zhang
          committer_email: email@your.com
This post is licensed under CC BY 4.0 by the author.