Update Checker #78
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: Update Checker | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 18 * * 5' | |
# watch: | |
# types: started | |
env: | |
REPO_URL: https://github.com/coolsnowwolf/lede | |
REPO_BRANCH: master | |
TZ: Asia/Shanghai | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
timeout-minutes: 360 | |
steps: | |
- name: 获取哈希值 | |
id: getHash | |
run: | | |
git clone --depth 1 -b $REPO_BRANCH $REPO_URL . | |
echo "commitHash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- name: 比较哈希值 | |
id: cacheHash | |
uses: actions/cache@main | |
with: | |
path: .commitHash | |
key: HEAD-${{ steps.getHash.outputs.commitHash }} | |
- name: 保存哈希值 | |
if: steps.cacheHash.outputs.cache-hit != 'true' | |
run: | | |
echo ${{ steps.getHash.outputs.commitHash }} | tee .commitHash | |
- name: 设置当前的日期 | |
id: date | |
run: | | |
sudo timedatectl set-timezone "$TZ" | |
echo "date1=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- name: 触发编译 | |
if: steps.cacheHash.outputs.cache-hit != 'true' | |
uses: peter-evans/repository-dispatch@main | |
with: | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
event-type: ${{ env.date1 }} | |
- name: 删除workflow工作流 | |
uses: Mattraks/delete-workflow-runs@main | |
with: | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
repository: ${{ github.repository }} | |
retain_days: 1 | |
keep_minimum_runs: 1 |