Skip to content

Update Checker

Update Checker #687

name: Update Checker
on:
workflow_dispatch:
schedule:
- cron: 00 22 * * *
env:
TZ: Asia/Shanghai
jobs:
update:
continue-on-error: true
runs-on: ubuntu-20.04
steps:
- name: Get Commit Hash
id: getHash
run: |
git clone --depth 1 https://github.com/00575/openwrt-packages -b master .
echo "::set-output name=commitHash::$(git rev-parse HEAD)"
- name: Compare Commit Hash
id: cacheHash
uses: actions/cache@v2
with:
path: .commitHash
key: HEAD-${{ steps.getHash.outputs.commitHash }}
- name: Save New Commit Hash
if: steps.cacheHash.outputs.cache-hit != 'true'
run: |
echo ${{ steps.getHash.outputs.commitHash }} | tee .commitHash
- name: 设置当前的日期
run: |
sudo timedatectl set-timezone "$TZ"
echo "date=$(date +%Y.'%m.%d')" >> $GITHUB_ENV
- name: Trigger build
if: steps.cacheHash.outputs.cache-hit != 'true'
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.workflow_token }}
event-type: update-${{ env.date }}
- name: 删除工作流
uses: GitRML/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 0