Files
NotionNext/.github/workflows/pushUrl.yml
Ghlerrix 669ca7646e [fix] 修复未配置Action Secrets每日定时推送报错
当用户未配置Action Secrets中的URL时每日定时推送会报错,github会发送一条邮件,可能会带来一些不便。
修复后,未配置Action Secrets则相关代码就不会执行。
具体如下:
未配置URL:则啥也不干
未配置Bing API KEY:则不推送至Bing
未配置Baidu Token:则不推送至百度
2023-08-24 09:46:08 +08:00

42 lines
1.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 利用GitHub Actions每天定时给百度推送链接提高收录率 ##
name: pushUrl
# 两种触发方式一、push代码二、每天国际标准时间23点北京时间+8即早上7点运行
on:
push:
schedule:
- cron: '0 23 * * *' # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events-schedule
workflow_dispatch:
inputs:
unconditional-invoking:
description: 'push url unconditionally'
type: boolean
required: true
default: true
# on:
# schedule:
# - cron: '*/5 * * * *' # 每5分钟一次测试用
jobs:
bot:
runs-on: ubuntu-latest # 运行环境为最新版的Ubuntu
steps:
- name: 'Checkout codes' # 步骤一,获取仓库代码
uses: actions/checkout@v2
# - name: 'Run baiduPush' # 步骤二执行sh命令文件
# run: npm install && npm run baiduPush # 运行目录是仓库根目录
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: install requests
run: pip install requests
- name: baiduPush
run: python pushUrl.py --url ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKEN }}
- name: bingPush
run: python pushUrl.py --url ${{ secrets.URL }} --bing_api_key ${{ secrets.BING_API_KEY }}