How to set schedule by github actions?

Let's start a simple schedule in github actions.

Github Actions: Schedule

Here is a trick to record a day the Miliky Way hasn’t collided with the Andromeda Galaxy.

 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
29
30
31
32
33
34
35
36
name: Has the Milky Way collided with the Andromeda Galaxy?

# daily job
on:
    schedule:
        -
            cron: 0 0 * * *

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
    # This workflow contains a single job called "build"
    build:
        # The type of runner that the job will run on
        runs-on: ubuntu-latest

        # Steps represent a sequence of tasks that will be executed as part of the job
        steps:
            # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
            -
                uses: actions/checkout@v2

            # Setup git
            -
                name: Setup Git Infomation
                run: |
                    git config --global user.name 'user'
                    git config --global user.email 'email'                    
            # Record (use record.sh or record2.sh)
            -
                name: Recording
                run: |
                    sh ./record.sh                    
            -
                name: Pushing
                run: |
                    git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:${{ github.ref }} || echo "No changes to commit"                    

For the complete project, you can follow here.

Licensed under CC BY-NC-SA 4.0
Last updated on Nov 11, 2020 16:31 UTC