仓库文件夹备份
name: CI
on: [watch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 配置Git
run: |
git config --global user.name 'wztlink1013'
git config --global user.email '2550374815@qq.com'
- name: 在云端进行复制文件夹操作
env:
Github_Token: ${{ secrets.TOKEN_GITHUBAPI }}
run: |
git clone https://${Github_Token}@github.com/wztlink1013/website-source website-source
cd website-source
cp -r ./Secret文集/ ./backup/
git status
git add .
git commit -m "backup"
git push --force --quiet "https://${Github_Token}@github.com/wztlink1013/website-source" master:master
博客CICD腾讯云函数
Python2.7执行环境
# -*- coding: utf8 -*-
import requests
def main_handler(event, context):
r = requests.post("https://api.github.com/repos/wztlink1013/Blog3.0/dispatches",
json={'event_type': "run-it"},
headers = {"User-Agent":'curl/7.52.1',
'Content-Type': 'application/json',
'Accept': 'application/vnd.github.everest-preview+json',
'Authorization': 'token **********'})
if r.status_code == 204:
return "This's OK!"
else:
return r.status_code
触发器设置
博客CICD阿里云函数
Python3执行环境
# -*- coding: utf-8 -*-
import logging
import requests
OK = b'ok\n'
def handler(environ, start_response):
status = '200 OK'
response_headers = [('Content-type', 'text/plain')]
sync_yuque()
start_response(status, response_headers)
return [OK]
def sync_yuque():
requests.post("https://api.github.com/repos/wztlink1013/Blog3.0/dispatches",
json={'event_type': "run-it"},
headers={"User-Agent":'curl/7.52.1',
'Content-Type': 'application/json',
'Accept': 'application/vnd.github.everest-preview+json',
'Authorization': 'token *********'})
评论区