GitHub Actions Check for Minecraft Data update. #652
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: 'GitHub Actions Check for Minecraft Data update.' | |
on: | |
schedule: | |
# 定时任务,在每天的5点检查更新 | |
- cron: '0 18 * * *' | |
workflow_dispatch: {} | |
jobs: | |
bot: | |
runs-on: ubuntu-latest | |
steps: | |
# 首先copy git仓库到虚拟机上 | |
- name: 'Checkout codes' | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 #安装node.js | |
with: | |
node-version: '18' | |
- name: Running bash | |
run: | | |
git config --global user.name "wifi_left" | |
git config --global user.email "ysy1679682327@outlook.com" | |
bash ./run.sh | |
- name: Make changes | |
run: | | |
node run_git_command_date.js | |
git commit -a -m "Add changes" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
known_hosts: gitlab.com | |
- name: Push files | |
run: | | |
node run_git_commands.js | |
# 执行仓库中的脚本文件 |