Custom Script #6
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
name: Custom Script | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' # 设置为每天UTC时间的午夜执行,可以根据需要调整 | |
jobs: | |
custom_script: | |
name: Run Custom Script | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Configure Git | |
run: | | |
git config --global user.name "${{ secrets.USERNAME }}" | |
git config --global user.email "${{ secrets.EMAIL }}" | |
env: | |
USERNAME: ${{ secrets.USERNAME }} | |
EMAIL: ${{ secrets.EMAIL }} | |
- name: Execute custom script | |
run: | | |
echo "当前目录:`pwd`" | |
git clone https://github.com/wjlin0/poc-doc.git | |
cd poc-doc && rm -r docs && mkdir -p docs && cd ./docs | |
git clone https://github.com/wy876/POC.git | |
cd POC && rm -rf .git && mv README.md ../../README.md && mv * ../ | |
cd ../ && rm -r POC && cd ../ | |
echo "$(date '+%Y-%m-%d %H:%M:%S')" > ./time | |
echo "当前目录:`pwd`" | |
echo "正在初始化远程仓库" | |
git add . | |
git commit -m "$(date '+%Y-%m-%d %H:%M')" | |
git push origin main -f | |
exit_status=$? | |
if [[ $exit_status -eq 0 ]]; then | |
echo "提交成功 -> https://poc.wjlin0.com" | |
else | |
echo "提交失败: $exit_status" | |
fi | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |