GitHub Actions

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

Context in Workflow

More contexts at https://docs.github.com/en/actions/learn-github-actions/contexts

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.