.github/workflows/blank.yml #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
schedule: | |
- cron: "38 23 * * *" #早上7点45左右推送 | |
workflow_dispatch: | |
jobs: | |
bot: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: 'Checkout codes' | |
uses: actions/checkout@v3 | |
- name: python env | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
# 安装依赖 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
pip install bs4 | |
pip install requests | |
- name: 'Get DataSource' | |
run: curl https://news.topurl.cn > ./index.html | |
- name: 'Get Info' | |
run: python ./getInfo.py | |
- name: 'Get Date' | |
run: | | |
echo "REPORT_DATE=$(TZ=':Asia/Shanghai' date '+%Y-%m-%d %T')" >> $GITHUB_ENV | |
echo "TODAY_DATE=$(TZ=':Asia/Shanghai' date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: 'Get TEXT' | |
run: | | |
echo 'FILE_TEXT<<EOF' >> $GITHUB_ENV | |
cat ./result.txt >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
# - name: 'Send mail' | |
# uses: dawidd6/action-send-mail@master | |
# with: | |
# server_address: smtp.163.com | |
# server_port: 465 | |
# username: ${{ secrets.MAIL_USER_NMAE }} | |
# password: ${{ secrets.MAIL_PWD }} | |
# subject: 今日新闻简报推送 (${{env.REPORT_DATE}}) | |
# body: file://result.txt | |
# to: [email protected] | |
# from: GitHub Actions | |
# content_type: text/html | |
- name: '发送到企业微信群' | |
uses: fifsky/dingtalk-action@master | |
with: | |
url: ${{ secrets.WECHAT_WEBHOOK}} | |
type: text | |
at: all | |
content: | | |
${{env.FILE_TEXT}} | |
- name: '发送到中间件' | |
uses: fifsky/dingtalk-action@master | |
with: | |
url: ${{ secrets.WECHATQUN_WEBHOOK}} | |
type: text | |
at: all | |
content: | | |
${{env.FILE_TEXT}} | |
- name: '发送到TG频道' | |
run: | | |
python send_to_telegram.py | |
env: | |
TELEGRAM_API_TOKEN: ${{ secrets.TELEGRAM_API_TOKEN }} | |
TELEGRAM_CHANNEL_ID: -1001436520490 | |
- name: '打完收工,提交代码!' | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "rcy1314" | |
git remote set-url origin https://${{ github.actor }}:${{ secrets.MYGG_TOKEN }}@github.com/${{ github.repository }} | |
git pull | |
cp -Rf result.txt logs/${{env.TODAY_DATE}}.txt | |
git add . | |
git commit -m "Update By Github Action Bot" | |
git push |