xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

How to fix the inaccurate bug of UTC time set by GitHub scheduled tasks All In One

How to fix the inaccurate bug of UTC time set by GitHub scheduled tasks All In One

如何修复 GitHub 定时任务设置的 UTC 时间执行不准确 bug All In One

GitHub Actions 打卡机器人 🤖️

# This is a basic workflow to help you get started with Actions

name: WX_ROBOT

# Controls when the action will run. 
on:
  # Triggers the workflow on push events but only for the main branch
  push:
    branches: [ main ]
  schedule:
    # 每天下午 4:00 定时发送打卡提醒
    - cron: '00 00-16/1 * * *'

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# 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"
  hello-job:
    # 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

      # Runs a single command using the runners shell
      - name: Run a one-line script
        run: echo Hello, world!

solution

使用第三方的 cron 调度服务,触发执行 GitHub 定时任务

You can configure your workflows to run when specific activity on GitHub happens, at a scheduled time, or when an event outside of GitHub occurs.

您可以将工作流程配置为在 GitHub 上发生特定活动、在计划时间或在 GitHub 外部发生事件时运行。

# todo

on:
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'
        required: true
        default: 'warning'
        type: choice
        options:
        - info
        - warning
        - debug
      tags:
        description: 'Test scenario tags'
        required: false
        type: boolean
      environment:
        description: 'Environment to run tests against'
        type: environment
        required: true

jobs:
  log-the-inputs:
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo "Log level: $LEVEL"
          echo "Tags: $TAGS"
          echo "Environment: $ENVIRONMENT"
        env:
          LEVEL: ${{ inputs.logLevel }}
          TAGS: ${{ inputs.tags }}
          ENVIRONMENT: ${{ inputs.environment }}
$ gh workflow run run-tests.yml -f logLevel=warning -f tags=false -f environment=staging

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows

demos

⏰ 2021-11-25 14:25:39
🎉读书会快捷链接
📘打卡链接
👨🏻‍💻我的链接
💰积分链接
读书会机器人🤖️ features:
1. 大大简化进入打卡的流程,跳过 3s 首页的推荐;
2. 每天早晚两次打卡提醒(16:00) ⏰,降低忘记打卡的风险;

⏰ 2021-11-26 15:20:10
🎉读书会快捷链接
📘打卡链接
👨🏻‍💻我的链接
💰积分链接
读书会机器人🤖️ features:
1. 大大简化进入打卡的流程,跳过 3s 首页的推荐;
2. 每天早晚两次打卡提醒(16:00) ⏰,降低忘记打卡的风险;

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

refs

https://gist.github.com/xgqfrms/ec53c4c74fb1d60a172c329bcaff9a45

https://zhuanlan.zhihu.com/p/379365305



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2021-11-27 00:10  xgqfrms  阅读(218)  评论(1编辑  收藏  举报