Monitor Snapshot Updates #2
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: Monitor Snapshot Updates | |
on: | |
schedule: | |
- cron: '0 * * * *' # 每小时运行一次 | |
workflow_dispatch: | |
jobs: | |
monitor: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 检测更新 | |
run: | | |
URL="https://downloads.immortalwrt.org/snapshots/targets/x86/64/" | |
curl -s $URL | grep -Eo '<a href="[^"]+">' | grep -v "../" > current_files.txt | |
if [ ! -f last_files.txt ] || ! cmp -s current_files.txt last_files.txt; then | |
echo "检测到新更新!" | |
cp current_files.txt last_files.txt | |
else | |
echo "没有检测到更新。" | |
fi |