Update Checker #979
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
# | |
# Copyright (c) 2019-2021 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: Update Checker | |
env: | |
REPO_URL: https://github.com/coolsnowwolf/lede | |
REPO_URL1: https://github.com/Erope/openwrt_nezha | |
REPO_BRANCH: master | |
REPO_BRANCH1: main | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 */18 * * * | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Commit Hash | |
id: getHash | |
run: | | |
git clone --depth 1 $REPO_URL -b $REPO_BRANCH lege | |
echo "name=commitHash::$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
git clone --depth 1 $REPO_URL1 -b $REPO_BRANCH1 nezha | |
echo "name=commitHash1::$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- name: Compare LEDE Commit Hash | |
id: cacheHash | |
uses: actions/cache@main | |
with: | |
path: .commitHash | |
key: HEAD-${{ steps.getHash.outputs.commitHash }} | |
- name: Compare NEZHA Commit Hash | |
id: cacheHash1 | |
uses: actions/cache@main | |
with: | |
path: .commitHash1 | |
key: HEAD-${{ steps.getHash.outputs.commitHash1 }} | |
- name: Save New Commit Hash | |
if: steps.cacheHash.outputs.cache-hit != 'true' || steps.cacheHash1.outputs.cache-hit != 'true' | |
run: | | |
echo ${{ steps.getHash.outputs.commitHash }} | tee .commitHash | |
echo ${{ steps.getHash.outputs.commitHash1 }} | tee .commitHash1 | |
- name: Trigger build | |
if: steps.cacheHash.outputs.cache-hit != 'true' | |
uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.ACTIONS_TRIGGER_PAT }} | |
event-type: Source Code Update | |
- name: Delete workflow runs | |
uses: Mattraks/delete-workflow-runs@main | |
with: | |
retain_days: 1 | |
keep_minimum_runs: 1 |