Github最近推出了Actions功能,能夠用來作不少好玩的事。node
以前我寫過一個腳本,能夠將網易雲音樂每日推薦的歌曲保存爲新歌單,起到備份做用。但那個腳本須要部署在本身的服務器上邊一直運行才行。python
今天我忽然想到能夠利用Github的Actions功能,天天定時運行那個腳本進行備份,這樣既不須要本身的服務器,又省去了維護。git
NeteaseCloudMusicDayActionsgithub
name: 網易雲音樂日推自動建立歌單 on: schedule: # * is a special character in YAML so you have to quote this string - cron: '30 * * * *' jobs: build: runs-on: ubuntu-latest steps: - name: 更新爲中國時間 run: | sudo rm -rf /etc/localtime sudo ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime date - name: 安裝網易雲api run: git clone https://github.com/shanghaobo/NeteaseCloudMusicApi.git - name: 運行網易雲api run: | cd NeteaseCloudMusicApi npm install nohup node app.js & - name: 安裝並腳本 run: git clone https://github.com/shanghaobo/NeteaseCloudMusicDay.git - name: 設置api run: echo "api='http://127.0.0.1:3000'" >> NeteaseCloudMusicDay/config.py - name: 設置網易雲音樂登陸帳號 run: echo "phone='xxxxxxxxxxx'" >> NeteaseCloudMusicDay/config.py - name: 設置網易雲音樂登陸密碼 run: echo "password='xxxxxx'" >> NeteaseCloudMusicDay/config.py - name: 運行腳本 run: python3 NeteaseCloudMusicDay/main2.py