Skip to content

immortalwrt更新检查 #1

immortalwrt更新检查

immortalwrt更新检查 #1

#
# Copyright (c) 2019-2023 P3TERX <https://p3terx.com>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# https://github.com/P3TERX/Actions-OpenWrt
# File: .github/workflows/update-checker.yml
# Description: Source code update checker
#
name: immortalwrt更新检查
env:
REPO_URL: https://github.com/immortalwrt/immortalwrt
REPO_BRANCH: master
on:
workflow_dispatch:
# schedule:
# - cron: 0 */18 * * *
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: 获取Commit Hash
id: getHash
run: |
git clone --depth 1 $REPO_URL -b $REPO_BRANCH .
echo "::set-output name=commitHash::$(git rev-parse HEAD)"
- name: 整理Commit Hash
id: cacheHash
uses: actions/cache@v3
with:
path: .commitHash
key: HEAD-${{ steps.getHash.outputs.commitHash }}
- name: 保存新的Commit Hash
if: steps.cacheHash.outputs.cache-hit != 'true'
run: |
echo ${{ steps.getHash.outputs.commitHash }} | tee .commitHash
- name: Trigger build
if: steps.cacheHash.outputs.cache-hit != 'true'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.ACTIONS_TRIGGER_PAT }}
event-type: 上游源码更新触发编译
- name: 删除运行记录
uses: naoki66/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 1